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

Class CAutomaton
source code

object --+
         |
        CAutomaton

A Class for a Deterministic Finite Automaton DFA

Nested Classes [hide private]
__CEvent A class to implement an event object.
__CState A class to implement a state object.

Instance Methods [hide private]
  __init__(self, name, comment, Type)
Initializes the CAutomaton class.
  getName(self)
  setName(self, name)
Sets the name of the Automaton.
  getComment(self)
  setComment(self, comment)
Sets a comment for the Automaton.
  getType(self)
  setType(self, Type)
Sets the type of Automaton.
  resetWeights(self)
Resets the weights of the state in the Automaton.
  setWeights2End(self)
Sets the weight of every state of the Automaton.
  toDeterministicController(self)
For each state of the Automaton cuts the transitions which make the controller not-deterministic.
  addState(self, id, name, comment, initial, marked)
Adds a state to the Automaton.
  addEvent(self, id, name, comment, controllable)
Adds an event to the Automaton.
  getEvent(self, name)
Returns the event instance corresponding to the specified name
  getEventFromId(self, id)
Returns the event instance corresponding to the specified id
  getEvents(self)
Returns a copy of the list of events.
  getInitialStates(self)
Returns a copy of the list of initial states.
  getStates(self)
Returns a copy of the list of states.
  getState(self, name)
Returns the state instance corresponding to the specified name
  getStateFromId(self, id)
Returns the state instance corresponding to the specified id
  getTransitionsNumber(self)
Return the number of transitions present in the current automaton
  getMarkedStates(self)
Returns a copy of the list of marked states.
  __mul__(self, automaton)
Returns an automaton obtained with a synchronous composition between the current automaton and the one given as parameter.

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


Class Variables [hide private]

Inherited from object: __class__


Properties [hide private]
name  
Type  
comment  
events  

Method Details [hide private]

__init__(self, name, comment, Type)
(Constructor)

source code 

Initializes the CAutomaton class.

The new automaton has no events or state.
Parameters:
  • name (string) - The name of the Automaton
  • comment (string) - A description of the Automaton
  • Type (string) - The type of Automaton ('Plant', 'Specification', 'Supervisor')
Returns:
void
Overrides: object.__init__

getName(self)

source code 
Returns:
The Name of the Automaton

setName(self, name)

source code 
Sets the name of the Automaton.
Parameters:
  • name (string) - the name of the Automaton
Returns:
void

getComment(self)

source code 
Returns:
The comment associated to the Automaton

setComment(self, comment)

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

getType(self)

source code 
Returns:
The type associated to the Automaton

setType(self, Type)

source code 
Sets the type of Automaton.
Parameters:
  • Type (string) - The type of Automaton ('Plant', 'Specification', 'Supervisor')
Returns:
void

resetWeights(self)

source code 
Resets the weights of the state in the Automaton. The default set weight is -1.
Returns:
void

setWeights2End(self)

source code 

Sets the weight of every state of the Automaton.

The weight represents the minimum number of End events to reach a marked state. This method uses the CAutomaton._CAutomaton__CState.expandWeight recursive method to assign the weights.
Returns:
True if the weights are assigned, False if an error has occurred (mostly the End event is not present in the alphabet events).

toDeterministicController(self)

source code 

For each state of the Automaton cuts the transitions which make the controller not-deterministic.

The controller must be deterministic meaning that a given input sequence should then always produce the same sequence of outputs. To avoid a non-deterministic choice during the code generation it is then necessary to suppress this choice among more controllable events.

The CAutomaton._CAutomaton__CState.cutTransitions methos is invoked for each state.
Returns:
void

addState(self, id, name, comment, initial, marked)

source code 
Adds a state to the Automaton.
Parameters:
  • id (integer) - an id for the state (univocal key)
  • name (string) - the name of the State
  • comment (string) - a description of the State
  • initial (boolean) - a flag which determines if the State is initial or not
  • marked (boolean) - a flag which determines if the State is marked or not
Returns:
a new CAutomaton._CAutomaton__CState instance

addEvent(self, id, name, comment, controllable)

source code 
Adds an event to the Automaton.
Parameters:
  • id (integer) - an id for the Event (univocal key)
  • name (string) - the name of the Event
  • comment (string) - a description of the State
  • controllable (boolean) - a flag which determines if the Event is controllable or not
Returns:
a new CAutomaton._CAutomaton__CEvent instance

getEvent(self, name)

source code 
Returns the event instance corresponding to the specified name
Parameters:
  • name (string) - the name of the Event
Returns:
the corresponding CAutomaton._CAutomaton__CEvent instance if it exist, False otherwise

getEventFromId(self, id)

source code 
Returns the event instance corresponding to the specified id
Parameters:
  • id (integer) - the id of the Event (univocal key)
Returns:
the corresponding CAutomaton._CAutomaton__CEvent instance if it exist, False otherwise

getEvents(self)

source code 
Returns a copy of the list of events.
Returns:
a list of CAutomaton._CAutomaton__CEvent instances

getInitialStates(self)

source code 
Returns a copy of the list of initial states. In a DFA it is present just one initial state.
Returns:
a list of CAutomaton._CAutomaton__CState instances

getStates(self)

source code 
Returns a copy of the list of states.
Returns:
a list of CAutomaton._CAutomaton__CState instances

getState(self, name)

source code 
Returns the state instance corresponding to the specified name
Parameters:
  • name (string) - the name of the State
Returns:
the corresponding CAutomaton._CAutomaton__CState instance if it exist, False otherwise

getStateFromId(self, id)

source code 
Returns the state instance corresponding to the specified id
Parameters:
  • id (integer) - the id of the State (univocal key)
Returns:
the corresponding CAutomaton._CAutomaton__CState instance if it exist, False otherwise

getTransitionsNumber(self)

source code 
Return the number of transitions present in the current automaton
Returns:
the number of transitions

getMarkedStates(self)

source code 
Returns a copy of the list of marked states.
Returns:
a list of CAutomaton._CAutomaton__CState instances

__mul__(self, automaton)

source code 
Returns an automaton obtained with a synchronous composition between the current automaton and the one given as parameter.
>>> #Example:
>>> resulting_automaton=a*b
Parameters:
  • automaton (a CAutomaton instance) - the second automaton in the multiplication operation
Returns:
the composed automaton

Property Details [hide private]

name

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

Type

Get Method:
Automata.CAutomaton.getType(self)
Set Method:
Automata.CAutomaton.setType(self, Type) - Sets the type of Automaton.
Delete Method:
None

comment

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

events

Get Method:
Automata.CAutomaton.getEvents(self) - Returns a copy of the list of events.
Set Method:
None
Delete Method:
None