def convertToString(self, parseNode: ParseNodeDrawable):
     if parseNode.isLeaf():
         return self.__converter.leafConverter(parseNode)
     else:
         st = ""
         for i in range(parseNode.numberOfChildren()):
             st += self.convertToString(parseNode.getChild(i))
         return st
Пример #2
0
 def satisfies(self, parseNode: ParseNodeDrawable) -> bool:
     return parseNode.numberOfChildren() > 0 and parseNode.getData().isVP()
 def satisfies(self, parseNode: ParseNodeDrawable) -> bool:
     if parseNode.numberOfChildren() > 0:
         return parseNode.getData().__str__() == self.__symbol
     else:
         return False
 def nodeModify(self, parseNode: ParseNodeDrawable):
     self.__nodeModifier.modifier(parseNode)
     for i in range(parseNode.numberOfChildren()):
         self.nodeModify(parseNode.getChild(i))
 def collectNodes(self, parseNode: ParseNodeDrawable, collected: list):
     if self.__condition is None or self.__condition.satisfies(parseNode):
         collected.append(parseNode)
     for i in range(parseNode.numberOfChildren()):
         self.collectNodes(parseNode.getChild(i), collected)
 def satisfies(self, parseNode: ParseNodeDrawable) -> bool:
     return parseNode.numberOfChildren() == 0