59 lines
1.4 KiB
Plaintext
59 lines
1.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import import_ipynb\n",
|
|
"from sortedcontainers import SortedDict\n",
|
|
"import TypeIndex\n",
|
|
"\n",
|
|
"class RBTreeIndex(TypeIndex.TypeIndex):\n",
|
|
" #container for Index which consists of an orderable Attribute and List of TypeTuple as Key,Value pair\n",
|
|
" index_map = SortedDict()\n",
|
|
"\n",
|
|
"\n",
|
|
" def insert(attribute, Tuple):\n",
|
|
" tupleList = []\n",
|
|
" #try: block\n",
|
|
" tupleList.append(index_map.get(attribute))\n",
|
|
" if not tupleList:\n",
|
|
" tupleList.append(Tuple)\n",
|
|
" index_map[attribute] = tupleList\n",
|
|
" else:\n",
|
|
" tupleList.append(Tuple)\n",
|
|
"\n",
|
|
"\n",
|
|
" def search_tuples(attribute):\n",
|
|
" #try: block\n",
|
|
" result = []\n",
|
|
" result.append(index_map.get(attribute))\n",
|
|
" return result\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.7.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|