2 Copyright (C) 1997-2018 JDERobot Developers Team 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU Library General Public License for more details. 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <http://www.gnu.org/licenses/>. 17 Authors : Pushkal Katara (katarapushkal@gmail.com) 21 from visualstates.configs.rosconfig
import RosConfig
26 Import PreBuild State into Current State 32 :param rootState: Root Imported State 33 :param config: Configurations of Imported State 34 :param libraries: Libraries of Imported State 35 :param functions: Functions of Imported State 36 :param variables: Variables of Imported State 38 Returns list of States which needs to be Imported 42 """Wrapper upon all update functions""" 43 importedState = self.
updateActiveState(file[0], klass.automataScene.stateIndex, klass.automataScene.transitionIndex, klass.activeState)
47 return importedState, config, libraries, globalNamespace
50 newFunctions = newNamespace.getFunctions()
51 newVariables = newNamespace.getVariables()
52 if newFunctions
and newVariables:
53 namespace.addFunctions(newFunctions)
54 namespace.addVariables(newVariables)
58 """Updates existing libraries with imported libraries""" 59 for lib
in newLibraries:
60 if lib
not in libraries:
65 """Updates Existing Configurations with imported Configurations""" 69 config.updateROSConfig(newConfig)
73 """Updates Parent State with States to be imported""" 74 importState = self.
updateIDs(importState, stateID, transitionID)
75 for state
in importState.getChildren():
76 activeState.addChild(state)
77 state.setParent(activeState)
78 updatedParentNamespace = self.
updateNamespace(importState.getNamespace(), activeState.namespace)
79 activeState.setNamespace(updatedParentNamespace)
82 def updateIDs(self, importState, stateID, transitionID):
83 """ Wrapper upon UpdateStateIDs """ 89 """ Assign New IDs to Imported State Data Recursively """ 90 for child
in importState.getChildren():
91 child.setID(stateID + child.getID())
95 for child
in importState.getChildrenTransitions():
96 child.setID(transitionID + child.getID())
def updateConfigs(self, newConfig, config)
def updateAuxiliaryData(self, file, klass)
def updateLibraries(self, newLibraries, libraries)
def updateNamespace(self, newNamespace, namespace)
def updateStateIDs(self, importState, stateID)
def updateTranIDs(self, importState, transitionID)
def updateActiveState(self, importState, stateID, transitionID, activeState)
def updateIDs(self, importState, stateID, transitionID)