yasmin_editor.model package
Submodules
- yasmin_editor.model.concurrence module
ConcurrenceConcurrence.add_outcome()Concurrence.add_state()Concurrence.add_text_block()Concurrence.class_nameConcurrence.default_outcomeConcurrence.descriptionConcurrence.file_nameConcurrence.get_state()Concurrence.is_containerConcurrence.keysConcurrence.layoutConcurrence.moduleConcurrence.nameConcurrence.outcome_mapConcurrence.outcomesConcurrence.package_nameConcurrence.parameter_mappingsConcurrence.parametersConcurrence.remappingsConcurrence.remove_outcome()Concurrence.remove_outcome_rule()Concurrence.remove_state()Concurrence.remove_text_block()Concurrence.rename_child_state_outcome()Concurrence.rename_outcome()Concurrence.rename_state()Concurrence.set_outcome_rule()Concurrence.state_typeConcurrence.statesConcurrence.text_blocksConcurrence.to_string()
iter_outcome_rule_values()
- yasmin_editor.model.key module
- yasmin_editor.model.layout module
LayoutLayout.create_outcome_alias()Layout.ensure_outcome_placement()Layout.get_outcome_placement()Layout.get_outcome_placements()Layout.get_outcome_position()Layout.get_state_position()Layout.materialize_primary_outcome_position()Layout.outcome_placementsLayout.outcome_positionsLayout.remove_outcome_placement()Layout.remove_outcome_position()Layout.remove_state_position()Layout.rename_outcome_position()Layout.rename_state_position()Layout.set_outcome_position()Layout.set_primary_outcome_position()Layout.set_state_position()Layout.state_positions
OutcomePlacementPosition
- yasmin_editor.model.outcome module
- yasmin_editor.model.parameter module
- yasmin_editor.model.state module
StateState.add_key()State.add_outcome()State.add_parameter()State.class_nameState.descriptionState.file_nameState.get_outcome()State.is_containerState.is_leafState.keysState.moduleState.nameState.outcomesState.package_nameState.parameter_mappingsState.parametersState.remappingsState.rename_outcome()State.state_typeState.to_string()
- yasmin_editor.model.state_machine module
StateMachineStateMachine.add_outcome()StateMachine.add_state()StateMachine.add_text_block()StateMachine.add_transition()StateMachine.class_nameStateMachine.descriptionStateMachine.file_nameStateMachine.get_state()StateMachine.is_containerStateMachine.keysStateMachine.layoutStateMachine.moduleStateMachine.nameStateMachine.outcomesStateMachine.package_nameStateMachine.parameter_mappingsStateMachine.parametersStateMachine.remappingsStateMachine.remove_outcome()StateMachine.remove_state()StateMachine.remove_text_block()StateMachine.remove_transition()StateMachine.rename_child_state_outcome()StateMachine.rename_outcome()StateMachine.rename_state()StateMachine.rename_transition_owner()StateMachine.start_stateStateMachine.state_typeStateMachine.statesStateMachine.text_blocksStateMachine.to_string()StateMachine.transitions
- yasmin_editor.model.text_block module
- yasmin_editor.model.transition module
- yasmin_editor.model.validation module
Module contents
Pure Python data model for the YASMIN editor.
- class yasmin_editor.model.Concurrence(name: str, description: str = '', keys: list[Key] = <factory>, outcomes: list[Outcome] = <factory>, parameters: list[Parameter] = <factory>, remappings: dict[str, str] = <factory>, parameter_mappings: dict[str, str] = <factory>, state_type: str | None = None, module: str | None = None, class_name: str | None = None, package_name: str | None = None, file_name: str | None = None, default_outcome: str | None = None, states: dict[str, State] = <factory>, outcome_map: dict[str, dict[str, list[str]]] = <factory>, layout: Layout = <factory>, text_blocks: list[TextBlock] = <factory>)
Bases:
StateRepresents a YASMIN concurrence container.
- add_outcome(outcome) None
Add a final outcome to the concurrence.
- class_name: str | None
- default_outcome: str | None
- description: str
- file_name: str | None
- property is_container: bool
Return whether this state contains child states.
- module: str | None
- name: str
- outcome_map: dict[str, dict[str, list[str]]]
- package_name: str | None
- parameter_mappings: dict[str, str]
- remappings: dict[str, str]
- remove_outcome(name: str) None
Remove a final outcome and its outcome-map rule.
- remove_outcome_rule(outcome: str, state_name: str, state_outcome: str | None = None) None
Remove one outcome rule entry from the concurrence.
- remove_state(name: str) None
Remove a child state and all related outcome rules.
- rename_child_state_outcome(state_name: str, old_outcome: str, new_outcome: str) None
Rename one child-state outcome used by the outcome map.
- rename_outcome(old_name: str, new_name: str) None
Rename a final outcome and update all related references.
- rename_state(old_name: str, new_name: str) None
Rename a child state and update all related outcome rules.
- set_outcome_rule(outcome: str, state_name: str, state_outcome: str) None
Set one outcome rule entry for the concurrence.
- state_type: str | None
- to_string(indent: int = 0) str
Return a human-readable representation of the concurrence.
- class yasmin_editor.model.Key(name: str, key_type: str = 'in', description: str = '', default_type: str = '', default_value: Any | None = None)
Bases:
objectRepresents a blackboard key definition.
- default_type: str
- default_value: Any
- description: str
- property has_default: bool
Return whether a default value is defined for this key.
- key_type: str
- name: str
- class yasmin_editor.model.Layout(state_positions: dict[str, ~yasmin_editor.model.layout.Position] = <factory>, outcome_positions: dict[str, ~yasmin_editor.model.layout.Position] = <factory>, outcome_placements: dict[str, ~yasmin_editor.model.layout.OutcomePlacement] = <factory>)
Bases:
objectStores positions for child states and final outcomes inside a container.
- create_outcome_alias(name: str, x: float, y: float) str
Create a new visual alias for an existing logical outcome.
- ensure_outcome_placement(outcome_name: str, x: float, y: float, instance_id: str | None = None) str
Create or update one visual placement for a logical outcome.
- get_outcome_placement(instance_id: str) OutcomePlacement | None
Return one outcome placement by its instance identifier.
- get_outcome_placements(outcome_name: str | None = None) list[OutcomePlacement]
Return all stored outcome placements, optionally filtered by outcome name.
- get_outcome_position(name: str) Position | None
Return the primary position of a logical final outcome if present.
- materialize_primary_outcome_position(name: str) str | None
Convert one legacy primary position into an explicit alias instance.
This is useful when a layout initially loaded one legacy outcome placement without an
instance_idand later needs more than one visual alias for the same logical outcome.
- outcome_placements: dict[str, OutcomePlacement]
- remove_outcome_placement(instance_id: str) None
Remove one visual placement of a final outcome.
- remove_outcome_position(name: str) None
Remove all stored placements of a logical final outcome.
- remove_state_position(name: str) None
Remove the stored position of a child state.
- rename_outcome_position(old_name: str, new_name: str) None
Rename the stored placements of a logical final outcome.
- rename_state_position(old_name: str, new_name: str) None
Rename the stored position of a child state.
- set_outcome_position(name: str, x: float, y: float, instance_id: str | None = None) str
Update one stored final-outcome placement.
Without an
instance_idthis updates the primary visible alias. Usecreate_outcome_alias()when a new visual alias should be created.
- set_primary_outcome_position(name: str, x: float, y: float) None
Store the primary legacy outcome position without creating an alias.
Legacy XML can describe one final outcome position without an explicit
instance_id. The editor still supports that representation for stable roundtrips, so callers that intentionally want a non-alias primary placement should use this method instead ofset_outcome_position().
- set_state_position(name: str, x: float, y: float) None
Set the position of a child state.
- class yasmin_editor.model.Outcome(name: str, description: str = '')
Bases:
objectRepresents an outcome of a state or container.
- description: str
- name: str
- class yasmin_editor.model.Position(x: float = 0.0, y: float = 0.0)
Bases:
objectRepresents a 2D position in the editor canvas.
- x: float
- y: float
- class yasmin_editor.model.State(name: str, description: str = '', keys: list[~yasmin_editor.model.key.Key] = <factory>, outcomes: list[~yasmin_editor.model.outcome.Outcome] = <factory>, parameters: list[~yasmin_editor.model.parameter.Parameter] = <factory>, remappings: dict[str, str] = <factory>, parameter_mappings: dict[str, str] = <factory>, state_type: str | None = None, module: str | None = None, class_name: str | None = None, package_name: str | None = None, file_name: str | None = None)
Bases:
objectBase model for all YASMIN states.
- class_name: str | None
- description: str
- file_name: str | None
- property is_container: bool
Return whether this state contains child states.
- property is_leaf: bool
Return whether this state is a leaf state.
- module: str | None
- name: str
- package_name: str | None
- parameter_mappings: dict[str, str]
- remappings: dict[str, str]
- rename_outcome(old_name: str, new_name: str) None
Rename one outcome of this state.
- state_type: str | None
- to_string(indent: int = 0) str
Return a human-readable representation of the state.
- class yasmin_editor.model.StateMachine(name: str, description: str = '', keys: list[Key] = <factory>, outcomes: list[Outcome] = <factory>, parameters: list[Parameter] = <factory>, remappings: dict[str, str] = <factory>, parameter_mappings: dict[str, str] = <factory>, state_type: str | None = None, module: str | None = None, class_name: str | None = None, package_name: str | None = None, file_name: str | None = None, start_state: str | None = None, states: dict[str, State] = <factory>, transitions: dict[str, list[Transition]] = <factory>, layout: Layout = <factory>, text_blocks: list[TextBlock] = <factory>)
Bases:
StateRepresents a YASMIN state machine container.
- add_outcome(outcome) None
Add a final outcome to the state machine.
- add_transition(state_name: str, transition: Transition) None
Add a transition for a child state.
- class_name: str | None
- description: str
- file_name: str | None
- property is_container: bool
Return whether this state contains child states.
- module: str | None
- name: str
- package_name: str | None
- parameter_mappings: dict[str, str]
- remappings: dict[str, str]
- remove_outcome(name: str) None
Remove a final outcome and all related transitions.
- remove_state(name: str) None
Remove a child state and all related transitions.
- remove_transition(state_name: str, source_outcome: str, target: str) None
Remove a transition for a child state.
- rename_child_state_outcome(state_name: str, old_outcome: str, new_outcome: str) None
Rename one outcome referenced by transitions of a child state.
- rename_outcome(old_name: str, new_name: str) None
Rename a final outcome and update all related references.
- rename_state(old_name: str, new_name: str) None
Rename a child state and update all related references.
- rename_transition_owner(old_owner: str, new_owner: str) None
Rename one transition owner entry inside this container.
- start_state: str | None
- state_type: str | None
- to_string(indent: int = 0) str
Return a human-readable representation of the state machine.
- transitions: dict[str, list[Transition]]
- class yasmin_editor.model.TextBlock(x: float = 0.0, y: float = 0.0, content: str = '')
Bases:
objectRepresents a free-form text annotation inside a container.
- content: str
- x: float
- y: float
- class yasmin_editor.model.Transition(source_outcome: str, target: str, target_instance_id: str = '')
Bases:
objectRepresents a transition from one outcome to a target state or final outcome.
- source_outcome: str
- target: str
- target_instance_id: str
- class yasmin_editor.model.ValidationMessage(path: str, message: str)
Bases:
objectRepresents one validation message.
- message: str
- path: str
- class yasmin_editor.model.ValidationResult(errors: list[~yasmin_editor.model.validation.ValidationMessage] = <factory>, warnings: list[~yasmin_editor.model.validation.ValidationMessage] = <factory>)
Bases:
objectCollects validation errors and warnings.
- add_error(path: str, message: str) None
Add one validation error.
- add_warning(path: str, message: str) None
Add one validation warning.
- errors: list[ValidationMessage]
- extend(other: ValidationResult) None
Merge another validation result into this one.
- property is_valid: bool
Return whether the validated model contains no errors.
- warnings: list[ValidationMessage]
- yasmin_editor.model.validate_model(model: State) ValidationResult
Validate a model tree.