basegenerator.py
Go to the documentation of this file.
1 class BaseGenerator():
2  def __init__(self, _libraries, _config, _states, _globalNamespace):
3  self.libraries = _libraries
4  self.config = _config
5  self.states = _states
6  self.globalNamespace = _globalNamespace
7 
8  def getAllStates(self):
9  addedStates = {}
10  allStates = []
11  for state in self.states:
12  if state.id not in addedStates:
13  addedStates[state.id] = state
14  allStates.append(state)
15 
16  for childState in state.getChildren():
17  if childState.id not in addedStates:
18  addedStates[childState.id] = childState
19  allStates.append(childState)
20 
21  return allStates
22 
23  def getAllTransitions(self):
24  addedTransitions = {}
25  transitions = []
26  for state in self.states:
27  for tran in state.getOriginTransitions():
28  if tran.id not in addedTransitions:
29  addedTransitions[tran.id] = tran
30  transitions.append(tran)
31  for childState in state.getChildren():
32  for tran in childState.getOriginTransitions():
33  if tran.id not in addedTransitions:
34  addedTransitions[tran.id] = tran
35  transitions.append(tran)
36 
37  return transitions
38 
39  def getStateById(self, id):
40  for state in self.states:
41  if state.id == id:
42  return state
43  return None
44 
45  def getRootState(self):
46  for state in self.states:
47  if state.parent is None:
48  return state
49 
50  # def getAllNamespaces(self):
51  # allNamespaces = []
52  # for state in self.getAllStates():
53  # allNamespaces.append(state.getNamespace())
54  # return allNamespaces
def __init__(self, _libraries, _config, _states, _globalNamespace)
Definition: basegenerator.py:2


visualstates
Author(s):
autogenerated on Thu Apr 1 2021 02:42:20