Compare commits

..

No commits in common. "ad6fcd7a244f56ffcce6ca42dce0bac253f32b89" and "ecf669425ffdc51fe496100df4df009364ff742d" have entirely different histories.

2 changed files with 1 additions and 12 deletions

View file

@ -29,9 +29,7 @@ Feature requests:
- When matching edge, match 'any' src/tgt
- Support 'return'-statement in conditions? (just makes syntax nicer)
- RAMification / matching: add `match_subtypes` attribute to each RAMified class.
- Support 'return'-statement in conditions?
- Separate script for running LHS (+NAC) on any model, and visualizing the match.

View file

@ -215,25 +215,16 @@ 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)