Template Abstraction

This commit is contained in:
EduardDurech 2025-02-07 17:06:50 +00:00
parent 227319f1da
commit c2e3dbc826
8 changed files with 325 additions and 387 deletions

View file

@ -12,6 +12,7 @@ class AttributeType(Enum):
STATIC = "static" # Each level is independent
UBOUND = "ubound" # Each level is an upper bound
APPEND = "append" # Each level includes all previous levels
APPEND_LIST = "append_list" # Each level includes all previous levels
@dataclass
class AttributeDefinition:
@ -143,4 +144,9 @@ class AttributeDefinition:
available_values = self.levels[:level + 1]
return lambda: rng.choice(available_values)
case AttributeType.APPEND_LIST:
# Returns random choice from accumulated values up to current level
available_values = sum(self.levels[:level + 1], [])
return lambda: rng.choice(available_values)
raise ValueError(f"Unknown attribute type: {self.attr_type} for attribute '{self.description}'")