Compare commits
2 commits
ecf669425f
...
ad6fcd7a24
| Author | SHA1 | Date | |
|---|---|---|---|
| ad6fcd7a24 | |||
| a245d0a406 |
2 changed files with 12 additions and 1 deletions
4
TODO.txt
4
TODO.txt
|
|
@ -29,7 +29,9 @@ Feature requests:
|
|||
|
||||
- When matching edge, match 'any' src/tgt
|
||||
|
||||
- Support 'return'-statement in conditions?
|
||||
- Support 'return'-statement in conditions? (just makes syntax nicer)
|
||||
|
||||
- RAMification / matching: add `match_subtypes` attribute to each RAMified class.
|
||||
|
||||
- Separate script for running LHS (+NAC) on any model, and visualizing the match.
|
||||
|
||||
|
|
|
|||
|
|
@ -215,16 +215,25 @@ class ODAPI:
|
|||
|
||||
def overwrite_primitive_value(self, name: str, value: any, is_code=False):
|
||||
referred_model = UUID(self.bottom.read_value(self.get(name)))
|
||||
to_overwrite_type = self.get_type_name(self.get(name))
|
||||
# watch out: in Python, 'bool' is subtype of 'int'
|
||||
# so we must check for 'bool' first
|
||||
if isinstance(value, bool):
|
||||
if to_overwrite_type != "Boolean":
|
||||
raise Exception(f"Cannot assign boolean value '{value}' to value of type {to_overwrite_type}.")
|
||||
Boolean(referred_model, self.state).create(value)
|
||||
elif isinstance(value, int):
|
||||
if to_overwrite_type != "Integer":
|
||||
raise Exception(f"Cannot assign integer value '{value}' to value of type {to_overwrite_type}.")
|
||||
Integer(referred_model, self.state).create(value)
|
||||
elif isinstance(value, str):
|
||||
if is_code:
|
||||
if to_overwrite_type != "ActionCode":
|
||||
raise Exception(f"Cannot assign code to value of type {to_overwrite_type}.")
|
||||
ActionCode(referred_model, self.state).create(value)
|
||||
else:
|
||||
if to_overwrite_type != "String":
|
||||
raise Exception(f"Cannot assign string value '{value}' to value of type {to_overwrite_type}.")
|
||||
String(referred_model, self.state).create(value)
|
||||
else:
|
||||
raise Exception("Unimplemented type "+value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue