{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:20+0000",
     "start_time": "2019-02-01T15:20+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "",
       "version_major": 2,
       "version_minor": 0
      },
      "method": "display_data"
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Could not resolve dependencies for:\n",
      "com.github.haifengl : smile-scala_2.11 : 1.5.2 : jar\n"
     ]
    }
   ],
   "source": [
    "%%classpath add mvn\n",
    "com.github.haifengl smile-scala_2.11 1.5.2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "⊕ [beakerx/Java.ipynb at master · twosigma/beakerx](https://github.com/twosigma/beakerx/blob/master/doc/java/Java.ipynb)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:21+0000",
     "start_time": "2019-02-01T15:21+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "test.beaker.BeakerTest"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "package test.beaker;\n",
    "\n",
    "import java.util.Date;\n",
    "import java.text.SimpleDateFormat;\n",
    "\n",
    "public class BeakerTest {\n",
    "  private Date _date;\n",
    "  private SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mmZ\");\n",
    "  \n",
    "  public BeakerTest() {\n",
    "    _date = new Date();\n",
    "  }\n",
    "\n",
    "  public String getDateTxt() {\n",
    "    return \".. Today:\" + sdf.format(_date);\n",
    "  }\n",
    "\n",
    "  public String getDateUpperCaseTxt() {\n",
    "    return getDateTxt().toUpperCase();\n",
    "  }\n",
    "\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:21+0000",
     "start_time": "2019-02-01T15:21+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       ".. Today:2019-02-01T23:21+0800"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "package test.beaker;\n",
    "\n",
    "BeakerTest bt = new BeakerTest();\n",
    "return bt.getDateTxt();"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:21+0000",
     "start_time": "2019-02-01T15:21+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "00c54057-28cb-48f3-a1a0-c677966073f7",
       "version_major": 2,
       "version_minor": 0
      },
      "method": "display_data"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import java.util.List;\n",
    "import java.util.ArrayList;\n",
    "import com.twosigma.beakerx.chart.xychart.Plot;\n",
    "import com.twosigma.beakerx.chart.xychart.plotitem.*;\n",
    "import com.twosigma.beakerx.chart.Color;\n",
    "\n",
    "Plot p = new Plot();\n",
    "\n",
    "p.setTitle(\"this is a Java plot\");\n",
    "\n",
    "Bars b = new Bars();\n",
    "\n",
    "List<Number> yList = new ArrayList<Number>();\n",
    "yList.add(2);\n",
    "yList.add(5);\n",
    "yList.add(4);\n",
    "yList.add(8);\n",
    "\n",
    "b.setY(yList);\n",
    "b.setColor(Color.blue);\n",
    "b.setWidth(0.5);\n",
    "\n",
    "p.add(b);\n",
    "  \n",
    "return p;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:21+0000",
     "start_time": "2019-02-01T15:21+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "test.beaker.DateGetter"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "package test.beaker;\n",
    "interface DateGetter {\n",
    "   public String getDateTxt();\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-02-01T15:22+0000",
     "start_time": "2019-02-01T15:22+0000"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "test.beaker.DG2"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "package test.beaker;\n",
    "public class DG2 extends BeakerTest implements DateGetter {\n",
    "}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Java",
   "language": "java",
   "name": "java"
  },
  "language_info": {
   "codemirror_mode": "text/x-java",
   "file_extension": ".java",
   "mimetype": "",
   "name": "Java",
   "nbconverter_exporter": "",
   "version": "11.0.1"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": false,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": false,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
