Exemplo n.º 1
0
    def toState(self, nodes):
        "do a merge of all necessary states, ignoring those that are full"
        raise Exception("This is deprecated!")
        keys = set()
        keys2nodes = dict()
        for node in nodes:
            key   = self.__node2key[node]
            state = self.__key2node[key]
            keys.add(key)
            if key not in keys2nodes:
                keys2nodes[key] = []
            keys2nodes[key].append(node)
        
        stateAll = State.State([])
        for key in keys:
            state = self.get(key)
            if not state.full():
                stateAll = State.merge(stateAll, 
                                       State.subset(state, keys2nodes[key]))

        return stateAll
Exemplo n.º 2
0
 def update(self, newState):
     for state in self.__states:
         newSt = State.subset(newState, state.nodes())
         for st in newSt.states:
             state.addState(st)
Exemplo n.º 3
0
 def setState(self, state):
     constInputs = list(set.intersection(set(state.nodes()), 
                                         set(self.__inputs)))
     constInputs.sort()
     constInputs.reverse()
     self.__state  = State.subset(state, constInputs)