Scenario

Scenarios

class scenario.Scenario

Base class for any Scenario. A scenario has a list of blocks and a list of links. Blocks and links each have an ID which is unique (a block and a link can’t either have the same ID) within a scenario and makes easier the reference to them. This ID is gotten from the get_new_id method when the object is added to the Scenario.

activate()

Activates this scenario, i.e. the links between ports of blocks become active: they are translated into observer-observed relationships.

add_block(new_block)

Adds the block given as argument to the scenario and returns its ID within the scenario.

Adds a link from the source port of the source block to the destination port of the destination block given as arguments. The blocks and ports are referenced by their respective IDs. Returns the id of the new link.

deactivate()

Deactivates this scenario, i. e. resets all the observer-observed relationships previously set.

get_new_id()

Returns an unique identifier in order to reference blocks and links within a scenario.

remove_block(block_id)

Removes the block whose ID has been specified from the list of blocks of this Scenario and returns the Block. If the ID is not found, the method returns False.

Removes the link whose ID has been specified from the list of links of this Scenario and returns the Link. If the ID is not found, the method returns False.

Blocks

class scenario.Block
class scenario.SimpleBlock
class scenario.CompositeBlock

Nodes

class scenario.Node(name, value_type)
class scenario.SimpleNode(name, value_type)
class scenario.CompositeNode(name, value_type)

Basic types of blocks

class scenario.Constant(value)
class scenario.Not
class scenario.And
class scenario.Or
class scenario.Multiply

Table Of Contents

Previous topic

Models

Next topic

Implementation examples

This Page