Files
secondo/apis/python2/SecondoAPI/.ipynb_checkpoints/PGenobjects-checkpoint.ipynb

70 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2026-01-23 17:03:45 +08:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"#equivalent of MemoryObjects.java\n",
"import import_ipynb\n",
"\n",
"from PGenType import *\n",
"from PTuple import *\n",
"from PRelation import *\n",
"from PInt import *\n",
"from PReal import *\n",
"from PBool import *\n",
"from PString import *\n",
"from PText import *\n",
"\n",
"class Objects(PGenType):\n",
" \n",
" def __init__(self):\n",
" self.cls_name = {'bool':globals()[\"PBool\"],'int':globals()[\"PInt\"],'float':globals()[\"PReal\"],'String':globals()[\"PString\"],'Text':globals()[\"PText\"],'Tuple':globals()[\"PTuple\"],'General_Type':globals()[\"PGenType\"], 'Relation':globals()[\"PRelation\"]}\n",
" # 'Relation':globals()[\"PRelation\"]\n",
" \n",
" def getTypeName(self, typeClass):\n",
" \n",
" for k,v in self.cls_name.items():\n",
" if v == typeClass: \n",
" return k\n",
" return None\n",
" def getTypeClass(self, typeName):\n",
" try:\n",
" return self.cls_name[typeName].__name__\n",
" except KeyError:\n",
" return None\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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
}