6.1.1.2.1.3.1.5. pycropml.transpiler.rules.javaRules module¶
-
class
pycropml.transpiler.rules.javaRules.
JavaRules
[source]¶ Bases:
pycropml.transpiler.rules.generalRule.GeneralRule
-
binary_op
= {'!=': '!=', '*': '*', '+': '+', '-': '-', '/': '/', '<': '<', '<=': '<=', '==': '==', '>': '>', '>=': '>=', 'and': '&&', 'not': '!', 'or': '||'}¶
-
constant
= {'math': {'pi': 'Math.PI'}}¶
-
constructor
= '\n public %s() { }'¶
-
copy_constr
= '\n public %s(%s toCopy, boolean copyAll) // copy constructor \n {\n if (copyAll)\n {'¶
-
copy_constrArray
= '\n for (int i = 0; i < %s; i++)\n {\n _%s[i] = toCopy._%s[i];\n }'¶
-
copy_constrList
= '\n for (%s c : toCopy.%s)\n {\n _%s.add(c);\n }\n this.%s = _%s;'¶
-
copy_constr_compo
= '\n public %s(%s toCopy) // copy constructor \n {'¶
-
functions
= {'datetime': {'datetime': <function translateDateTime>}, 'io': {'print': <function translatePrint>, 'read': 'readLine', 'read_file': 'File.ReadAllText', 'write_file': 'File.WriteAllText'}, 'math': {'acos': 'Math.acos', 'asin': 'Math.asin', 'atan': 'Math.atan', 'ceil': '(int) Math.ceil', 'cos': 'Math.cos', 'exp': 'Math.exp', 'ln': 'Math.log', 'log': 'Math.log', 'pow': 'Math.pow', 'round': 'Math.round', 'sin': 'Math.sin', 'sqrt': 'Math.sqrt', 'tan': 'Math.tan'}, 'system': {'abs': 'Math.abs', 'max': 'Math.max', 'min': 'Math.min', 'pow': <function translatePow>}}¶
-
get_properties
= '\n { return %s; }'¶
-
get_properties_compo
= '\n { return _%s.get%s(); }'¶
-
methods
= {'array': {'append': '.add', 'len': <function translateLenArray>}, 'dict': {'get': '.get', 'keys': <function translateDictkeys>, 'len': <function translateLenDict>, 'values': <function translateDictValues>}, 'float': {'float': '(double)', 'int': '(int)'}, 'int': {'float': '(double)'}, 'list': {'append': '.add', 'contains?': '.contains', 'index': '.indexOf', 'insert_at': '.insert', 'len': <function translateLenList>, 'not contains?': <function translateNotContains>, 'pop': '.remove', 'sum': <function translateSum>}, 'str': {'find': '.IndexOf', 'float': 'Double.', 'int': 'Integer.parseInt'}}¶
-
set_properties
= '\n { this.%s= _%s; } \n '¶
-
set_properties_compo
= '\n { %s } '¶
-
types
= {'array': '%s[] %s= new %s', 'bool': 'boolean', 'datetime': 'Date', 'dict': 'HashMap', 'float': 'double', 'int': 'int', 'list': 'List', 'str': 'String', 'tuple': 'Pair'}¶
-
types2
= {'Date': 'Date', 'bool': 'Boolean', 'datetime': 'Date', 'float': 'Double', 'int': 'Integer', 'str': 'String'}¶
-
unary_op
= {'+': '+', '-': '-', 'not': '!', '~': '~'}¶
-