Skip to content

Commit

Permalink
Fix Memory/MO data types
Browse files Browse the repository at this point in the history
timestamp and id float->int
  • Loading branch information
EltonCN committed Sep 20, 2024
1 parent 837723d commit 054b59a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/cst_python/core/entities/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def set_evaluation(self, evaluation:float) -> None:

#@alias.alias("getTimestamp")
@abc.abstractmethod
def get_timestamp(self) -> float:
def get_timestamp(self) -> int:
...

#@alias.alias("addMemoryObserver")
Expand All @@ -53,17 +53,17 @@ def remove_memory_observer(self, observer:MemoryObserver) -> None:

#@alias.alias("getId")
@abc.abstractmethod
def get_id(self) -> float:
def get_id(self) -> int:
...

#@alias.alias("setId")
@abc.abstractmethod
def set_id(self, memory_id:float) -> None:
def set_id(self, memory_id:int) -> None:
...

#@alias.alias("getTimestamp")
@abc.abstractmethod
def get_timestamp(self) -> float:
def get_timestamp(self) -> int:
...


Expand Down
18 changes: 9 additions & 9 deletions src/cst_python/core/entities/memory_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
class MemoryObject(Memory):

def __init__(self) -> None:
self._id = 0.0
self._timestamp = 0.0
self._id = 0
self._timestamp = 0
self._evaluation = 0.0
self._info : Any = None
self._name = ""
Expand All @@ -24,18 +24,18 @@ def __getstate__(self) -> object:

return state

def get_id(self) -> float:
def get_id(self) -> int:
return self._id

def set_id(self, memory_id: float) -> None:
def set_id(self, memory_id: int) -> None:
self._id = memory_id

def get_info(self) -> Any:
return self._info

def set_info(self, value: Any) -> int:
self._info = value
self._timestamp = time.time()
self._timestamp = int(time.time()*1000)
self._notify_memory_observers()

return -1
Expand All @@ -47,16 +47,16 @@ def _notify_memory_observers(self) -> None:
def update_info(self, info:Any) -> None:
self.set_info(info)

def get_timestamp(self) -> float:
def get_timestamp(self) -> int:
return self._timestamp

@property
def timestamp(self) -> float:
def timestamp(self) -> int:
return self._timestamp

#@alias.alias("setTimestamp")
@timestamp.setter
def timestamp(self, value:float) -> None:
def timestamp(self, value:int) -> None:
self._timestamp = value

def get_name(self) -> str:
Expand All @@ -72,7 +72,7 @@ def get_evaluation(self) -> float:
return self._evaluation

def set_evaluation(self, evaluation: float) -> None:
return self._evaluation
self._evaluation = evaluation

#@alias.alias("toString", "to_string")
def __str__(self) -> str:
Expand Down

0 comments on commit 054b59a

Please sign in to comment.