feat: restructured code
This commit is contained in:
46
pjvm/old_jtypes.py
Normal file
46
pjvm/old_jtypes.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from typing import List
|
||||
|
||||
|
||||
class JObj:
|
||||
type = 'java/lang/Object'
|
||||
value = None
|
||||
|
||||
def instance_of(self, java_type: str):
|
||||
return self.type == java_type # todo inheritance
|
||||
|
||||
|
||||
class JInteger(JObj):
|
||||
type = "I"
|
||||
|
||||
def __init__(self, val: int):
|
||||
self.value = val
|
||||
|
||||
|
||||
class JCharacter(JObj):
|
||||
type = 'C'
|
||||
|
||||
def __init__(self, val: int):
|
||||
self.value = val
|
||||
|
||||
|
||||
class JGenericObj(JObj):
|
||||
generic_types: List[str]
|
||||
pass
|
||||
|
||||
|
||||
class JString(JObj):
|
||||
type = 'java/lang/String'
|
||||
value: str
|
||||
|
||||
def __init__(self, value: str):
|
||||
self.value = value
|
||||
|
||||
|
||||
class JArray(JGenericObj):
|
||||
type = 'java/lang/Array'
|
||||
generic_types: List[str]
|
||||
values: List
|
||||
|
||||
def __init__(self, generic_types: List[str], values: List):
|
||||
self.generic_types = generic_types
|
||||
self.values = values
|
||||
Reference in New Issue
Block a user