Module Automata :: Class CAutomaton :: Class __CState
[hide private]
[frames] | no frames]

Class __CState
source code

object --+
         |
        __CState

A class to implement a state object.

This class is privately declared inside the CAutomaton class. Every instance will then be created by the CAutomaton public methods (see the CAutomaton.addState method).

Instance Methods [hide private]
  __init__(self, automaton, id, name, comment, initial, marked)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  getId(self)
  setId(self, id)
Sets the ID of the State.
  getName(self)
  setName(self, name)
Sets the name of the State.
  getComment(self)
  setComment(self, comment)
Sets a comment for the State.
  setInitial(self, initial)
Sets the initial flag for the state.
  isInitial(self)
Returns a flag which states if the current State is initial or not.
  setMarked(self, marked)
Sets the marked flag for the state.
  isMarked(self)
Returns a flag which states if the current State is marked or not.
  isBlocking(self)
Returns a flag which states if the current State is blocking or not.
  getWeight(self)
Returns the weight associated to the state.
  setWeight(self, weight)
Sets a weight to the state.
  addTransition(self, event, arrivalstate)
Adds an outgoing transition to the State.
  getTransition(self, event)
Returns the arrival state associated to the specified event for the outgoing transitions.
  getInTransition(self, event)
Returns the departure state associated to the event for the ingoing transitions.
  cutTransitions(self)
This method called by the CAutomaton.toDeterministicController method cuts the transitions which made the supervisor non-deterministic by rapport to the control function it should achieve.
  getTransitions(self)
Returns a copy of the outgoing transitions dictionary.
  getInTransitions(self)
Returns a copy of the ingoing transitions list.
  expandWeight(self, weight)
Sets the weight for the current state and look for linked states with the same weight.
  getMealyList(self, list)
Returns a list of the unchained controllable events from the current state.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]

Inherited from object: __class__


Properties [hide private]
id  
name  
comment  
initial  
marked  

Method Details [hide private]

__init__(self, automaton, id, name, comment, initial, marked)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

getId(self)

source code 
Returns:
The ID of the State

setId(self, id)

source code 
Sets the ID of the State.
Parameters:
  • id (integer) - the ID of the state
Returns:
void

getName(self)

source code 
Returns:
The Name of the State

setName(self, name)

source code 
Sets the name of the State.
Parameters:
  • name (number) - the name of the State
Returns:
void

getComment(self)

source code 
Returns:
The comment associated to the State

setComment(self, comment)

source code 
Sets a comment for the State.
Parameters:
  • comment (string) - a description of the State
Returns:
void

setInitial(self, initial)

source code 
Sets the initial flag for the state. A True value means that the state is initial, a False value that it is not initial.
Parameters:
  • initial (boolean) - a flag which determines if the State is initial or not
Returns:
void

isInitial(self)

source code 
Returns a flag which states if the current State is initial or not.
Returns:
True if the State is intial, False otherwise

setMarked(self, marked)

source code 
Sets the marked flag for the state. A True value means that the state is marked, a False value that it is not marked.
Parameters:
  • marked (boolean) - a flag which determines if the State is marked or not
Returns:
void

isMarked(self)

source code 
Returns a flag which states if the current State is marked or not.
Returns:
True if the State is marked, False otherwise

isBlocking(self)

source code 
Returns a flag which states if the current State is blocking or not.
Returns:
True if the State is blocking, False otherwise

getWeight(self)

source code 

Returns the weight associated to the state. If a weight has never been set the method returns the -1 value.

The weights are used when an automaton which represents a Supervisor is processed in order to carry out a deterministic Controller (see the CAutomaton.toDeterministicController method).
Returns:
The weight associated to the State

setWeight(self, weight)

source code 

Sets a weight to the state.

The weights are used when an automaton which represents a Supervisor is processed in order to carry out a deterministic Controller (see the CAutomaton.toDeterministicController method).

The weights are usually assigned by the expandWeight method.
Parameters:
  • weight (integer) - a flag which determines the weight of the State
Returns:
void

addTransition(self, event, arrivalstate)

source code 

Adds an outgoing transition to the State.

To add the transition the event and the arrival state must already be in the automaton.
Parameters:
  • event (a CAutomaton._CAutomaton__CEvent instance) - the event associated to the transition
  • arrivalstate (a CAutomaton._CAutomaton__CState instance) - the arrival state of the transition
Returns:
True if the transition is successfully added, False if some error has occured (mostly the event or the arrivalstate are not present in the automaton)

getTransition(self, event)

source code 
Returns the arrival state associated to the specified event for the outgoing transitions.
Parameters:
  • event (a CAutomaton._CAutomaton__CEvent instance) - the event which drives the transition
Returns:
a CAutomaton._CAutomaton__CState instance

getInTransition(self, event)

source code 
Returns the departure state associated to the event for the ingoing transitions.
Parameters:
  • event (a CAutomaton._CAutomaton__CEvent instance) - the event which drives the transition
Returns:
a CAutomaton._CAutomaton__CState instance

cutTransitions(self)

source code 

This method called by the CAutomaton.toDeterministicController method cuts the transitions which made the supervisor non-deterministic by rapport to the control function it should achieve.

The controllable tranistions for the current state are cut in three steps.
  1. Cutting no-WeightGain End event getWeight(nextstate)>=getWeight(currentstate)
    • The transitions associated to an End event which don't provide a gain in terms of weight are suppressed.
  2. Cutting lossy controllable events getWeight(nextstate)>getWeight(currentstate)
    • The transitions associated to the controllable events which make increase the weight are suppressed.
  3. Using priority to resolve transition conflict
    • When a conflict is present between prioritized events the transition associated to the events with less priority are suppressed.
Returns:
void

getTransitions(self)

source code 
Returns a copy of the outgoing transitions dictionary. The dictionary has the form ['eventname']:CState.
Returns:
a copy of the dictionary of outgoing transitions

getInTransitions(self)

source code 
Returns a copy of the ingoing transitions list. The list has the form [ ['eventname'][CState] ].
Returns:
a copy of the list of ingoing transitions

expandWeight(self, weight)

source code 
Sets the weight for the current state and look for linked states with the same weight. Returns a list of all the linked states with the next weight.
Parameters:
  • weight (integer) - the weight to assign to the current state and to all the same weight linked states.
Returns:
a list of the the linked states which have the next weight (weight + 1)

getMealyList(self, list)

source code 

Returns a list of the unchained controllable events from the current state. When an uncontrollable event is found the chain is interrupted, the arrival state added and the list returned.

List format: [Controllable event,Controllable event,...,Controllable event,Arrival State]
Parameters:
  • list (a list of controllable events names which termines with a CAutomaton._CAutomaton__CState instance) - the first controllable event at the beginning, the list recurisively builded in next step

Property Details [hide private]

id

Get Method:
Automata.CAutomaton.__CState.getId(self)
Set Method:
Automata.CAutomaton.__CState.setId(self, id) - Sets the ID of the State.
Delete Method:
None

name

Get Method:
Automata.CAutomaton.__CState.getName(self)
Set Method:
Automata.CAutomaton.__CState.setName(self, name) - Sets the name of the State.
Delete Method:
None

comment

Get Method:
Automata.CAutomaton.__CState.getComment(self)
Set Method:
Automata.CAutomaton.__CState.setComment(self, comment) - Sets a comment for the State.
Delete Method:
None

initial

Get Method:
Automata.CAutomaton.__CState.isInitial(self) - Returns a flag which states if the current State is initial or not.
Set Method:
Automata.CAutomaton.__CState.setInitial(self, initial) - Sets the initial flag for the state.
Delete Method:
None

marked

Get Method:
Automata.CAutomaton.__CState.isMarked(self) - Returns a flag which states if the current State is marked or not.
Set Method:
Automata.CAutomaton.__CState.setMarked(self, marked) - Sets the marked flag for the state.
Delete Method:
None