Пример #1
0
 def ParseXMLNode(self,actionNode,problemManager):
     """
     Generate an Iterator action from the xml tree node. 
     """
   
     self.number = GetAttributeValueOrDefault(actionNode,"number",self.number)
     for child in GetChildren(actionNode):
       type = GetXMLTag(child)
       self.actions.append(  ActionFactory.CreateFromXML(type,child,problemManager) )
     return
           
    @classmethod
    def CreateFromXML(cls,actionNode,problemManager):
      """This creates a ComparativeSensitivityAction object from an xml node by initiating an empty class and parsing the xml node."""
      rv = cls()
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """Generate comparitive sensitivity action from xml tree node."""
       if(HasAttribute(actionNode,"type")):
         self.type = GetAttributeString(actionNode,"type")
         
       self.parameters = GetAttributeVectorString(actionNode,"parameters")
       self.minValues = GetAttributeVector(actionNode,"minima")
       self.maxValues = GetAttributeVector(actionNode,"maxima")
    
    def WriteXMLNode(self, node): 
       """Write the ComparativeSensitivityAction action to an XML tree node."""
       if(self.type):
         SetAttributeString(node,"type",self.type)
       return node
       
    class Factory:
      """The factory that creates the ComparativeSensitivityAction Object."""
      def CreateFromXML(self,xmlNode,problemManager): return ComparativeSensitivityAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(ComparativeSensitivityAction.typeStr,ComparativeSensitivityAction.Factory())
    @classmethod
    def CreateFromXML(cls,actionNode,problemManager):
      # this creates the class from an xml node by initiating an empty class and parsing the xml node
      rv = cls()
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """
       Generate named action from xml tree node. 
       """
       if(HasAttribute(actionNode,"type")):
         self.type = GetAttributeString(actionNode,"type")
       if(HasAttribute(actionNode,"samples")):
         self.samples = GetAttributeString(actionNode,"samples")
    
    def WriteXMLNode(self, node): 
       if(self.type):
         SetAttributeString(node,"type",self.type)
       if(self.samples):
         SetAttributeString(node,"samples",self.samples)
       return node
       
    # The factory that creates the RegionalCalculationAction Object 
    class Factory:
      def CreateFromXML(self,xmlNode,problemManager): return RegionalCalculationAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(RegionalCalculationAction.typeStr,RegionalCalculationAction.Factory())
Пример #4
0
    @classmethod
    def CreateFromXML(cls, actionNode, problemManager):
        # this creates the class from an xml node by initiating an empty class and parsing the xml node
        rv = cls()
        rv.ParseXMLNode(actionNode, problemManager)
        return rv

    def ParseXMLNode(self, actionNode, problemManager):
        """
       Generate named action from xml tree node. 
       """
        if (HasAttribute(actionNode, "type")):
            self.type = GetAttributeString(actionNode, "type")

    def WriteXMLNode(self, node):
        if (self.type):
            SetAttributeString(node, "type", self.type)
        return node

    # The factory that creates the RegionalCalculationAction Object
    class Factory:
        def CreateFromXML(self, xmlNode, problemManager):
            return HydrogenRegionalCalculationAction.CreateFromXML(
                xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(HydrogenRegionalCalculationAction.typeStr,
                         HydrogenRegionalCalculationAction.Factory())
Пример #5
0
            self.infrastructureType, self.coords)
        return

    @classmethod
    def CreateFromXML(cls, actionNode, problemManager):
        """Create the AddInfrastructureAction class from an xml node by initiating an empty class and parsing the xml node."""
        rv = cls()
        rv.ParseXMLNode(actionNode, problemManager)
        return rv

    def ParseXMLNode(self, actionNode, problemManager):
        """Generate AddInfrastructureAction action from xml tree node."""
        self.infrastructureType = GetAttributeString(actionNode, "type")
        self.coords = GetAttributeVector(actionNode, "coords")

    def WriteXMLNode(self, node):
        """Export the AddInfrastructureAction action to an xml tree node."""
        SetAttributeString(node, "type", self.infrastructureType)
        SetAttributeVector(node, "coords", self.coords)
        return node

    class Factory:
        """The factory that creates the AddInfrastructureAction Object."""
        def CreateFromXML(self, xmlNode, problemManager):
            return AddInfrastructureAction.CreateFromXML(
                xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(AddInfrastructureAction.typeStr,
                         AddInfrastructureAction.Factory())
Пример #6
0
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """
       Generate the solver call from the xml input
       """
       self.solverName = GetAttributeString(actionNode,"name")
       
       attributes = GetAttributes(actionNode)
       
       for attributeStr in attributes:
         self.solverArgs[attributeStr] = GetAttributeString(actionNode,attributeStr)
       return
    
    def WriteXMLNode(self, node): 
       """
       Write the solver call to the xml tree
       """
       SetAttributeString(node,"name",self.solverName)
       return node
       
     # The factory that creates the ExitAction Object 
    class Factory:
      def CreateFromXML(self,xmlNode,problemManager): 
         return RunSolverAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(RunSolverAction.typeStr,RunSolverAction.Factory())
    @classmethod
    def CreateFromXML(cls,actionNode,problemManager):
      # this creates the class from an xml node by initiating an empty class and parsing the xml node
      rv = cls()
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """
       Generate named action from xml tree node. 
       """
       if(HasAttribute(actionNode,"type")):
         self.type = GetAttributeString(actionNode,"type")
         
       self.parameter = GetAttributeString(actionNode,"parameter")
       self.minValue = GetAttributeString(actionNode,"min")
       self.maxValue = GetAttributeString(actionNode,"max")
    
    def WriteXMLNode(self, node): 
       if(self.type):
         SetAttributeString(node,"type",self.type)
       return node
       
    # The factory that creates the RegionalSensitivityAction Object 
    class Factory:
      def CreateFromXML(self,xmlNode,problemManager): return RegionalSensitivityAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(RegionalSensitivityAction.typeStr,RegionalSensitivityAction.Factory())
Пример #8
0
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
        """
        Generate an Iterator action from the xml tree node. 
        """
      
        self.number = GetAttributeValueOrDefault(actionNode,"number",self.number)
        for child in GetChildren(actionNode):
          type = GetXMLTag(child)
          self.actions.append(  ActionFactory.CreateFromXML(type,child,problemManager) )
        return
    
    def WriteXMLNode(self, node): 
       """Write the iterator action to an xml tree node."""
       SetAttributeString(node,"number",self.number)
       for action in self.actions:
          type = action.typeStr
          actnNode = AddChild(node,type)
          action.WriteXMLNode(actnNode)
       return node
       
    class Factory:
      """The factory that creates the Iterator Action Object """
      def CreateFromXML(self,xmlNode,problemManager): return IterationAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(IterationAction.typeStr,IterationAction.Factory())
        
Пример #9
0
    def Run(self,problemManager):
    
        problemManager.theMineDataManager.SetActiveOrebody(self.orebodyName)
           
    @classmethod
    def CreateFromXML(cls,actionNode,problemManager):
      # this creates the class from an xml node by initiating an empty class and parsing the xml node
      rv = cls()
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """
       Generate named action from xml tree node. 
       """
       if(HasAttribute(actionNode,"name")):
         self.orebodyName = GetAttributeString(actionNode,"name")
    
    def WriteXMLNode(self, node): 
       if(self.orebodyName):
         SetAttributeString(node,"name",self.orebodyName)
       return node
       
    # The factory that creates the RegionalCalculationAction Object 
    class Factory:
      def CreateFromXML(self,xmlNode,problemManager): return SelectOrebodyAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(SelectOrebodyAction.typeStr,SelectOrebodyAction.Factory())
Пример #10
0
        print(self.msg)

    @classmethod
    def CreateFromXML(cls, actionNode, problemManager):
        """ Create a print action object from an xml node by initiating an empty class and parsing the xml node."""
        rv = cls()
        rv.ParseXMLNode(actionNode, problemManager)
        return rv

    def ParseXMLNode(self, actionNode, problemManager):
        """
       Generate print action from xml tree node. 
       """
        self.msg = GetAttributeString(actionNode, "msg")

    def WriteXMLNode(self, node):
        """
       Write the print action to an xml tree node. 
       """
        SetAttributeString(node, "msg", self.msg)
        return node

    class Factory:
        """Factory that creates Print Action Objects. """
        def CreateFromXML(self, xmlNode, problemManager):
            return PrintAction.CreateFromXML(xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(PrintAction.typeStr, PrintAction.Factory())
       self.dummy = ""
       
    def Run(self,problemManager):
        problemManager.EvaluateOCUGMines()
           
    @classmethod
    def CreateFromXML(cls,actionNode,problemManager):
      # this creates the class from an xml node by initiating an empty class and parsing the xml node
      rv = cls()
      rv.ParseXMLNode(actionNode,problemManager)
      return rv
    
    def ParseXMLNode(self,actionNode,problemManager):
       """
       Generate named action from xml tree node. 
       """
       # empty
       return
    
    def WriteXMLNode(self, node): 
       # empty
       return node
       
     # The factory that creates the ExitAction Object 
    class Factory:
      def CreateFromXML(self,xmlNode,problemManager): return SingleSiteEvaluationAction.CreateFromXML(xmlNode,problemManager)


# Factory Registrator
ActionFactory.AddFactory(SingleSiteEvaluationAction.typeStr,SingleSiteEvaluationAction.Factory())
Пример #12
0
        """
       Generate named action from xml tree node. 
       """
        if (HasAttribute(actionNode, "filename")):
            self.saveFullPath = GetAttributeValueOrDefault(
                actionNode, "save_full_path", self.saveFullPath)
            if (self.saveFullPath):
                self.filename = GetAttributeFileString(actionNode, "filename")
            else:
                self.filename = GetAttributeString(actionNode, "filename")
        self.recordSha = GetAttributeValueOrDefault(actionNode, "record_sha",
                                                    self.recordSha)

    def WriteXMLNode(self, node):
        SetAttributeString(node, "filename", self.filename)
        if (not self.saveFullPath):
            SetAttributeString(node, "save_full_path", self.saveFullPath)
        if (not self.recordSha):
            SetAttributeString(node, "record_sha", self.recordSha)

        return node

    # The factory that creates the SaveXMLAction Object
    class Factory:
        def CreateFromXML(self, xmlNode, problemManager):
            return SaveXMLAction.CreateFromXML(xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(SaveXMLAction.typeStr, SaveXMLAction.Factory())
Пример #13
0
            print(self.exitMessage)
        exit()

    @classmethod
    def CreateFromXML(cls, actionNode, problemManager):
        # this creates the class from an xml node by initiating an empty class and parsing the xml node
        rv = cls()
        rv.ParseXMLNode(actionNode, problemManager)
        return rv

    def ParseXMLNode(self, actionNode, problemManager):
        """
       Generate named action from xml tree node. 
       """
        if (HasAttribute(actionNode, "msg")):
            self.exitMessage = GetAttributeString(actionNode, "msg")

    def WriteXMLNode(self, node):
        if (self.exitMessage):
            SetAttributeString(node, "msg", self.exitMessage)
        return node

    # The factory that creates the ExitAction Object
    class Factory:
        def CreateFromXML(self, xmlNode, problemManager):
            return ExitAction.CreateFromXML(xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(ExitAction.typeStr, ExitAction.Factory())
Пример #14
0
        """
       Generate named action from xml tree node. 
       """
        if (HasAttribute(actionNode, "filename")):
            self.saveFullPath = GetAttributeValueOrDefault(
                actionNode, "save_full_path", self.saveFullPath)
            if (self.saveFullPath):
                self.filename = GetAttributeFileString(actionNode, "filename")
            else:
                self.filename = GetAttributeString(actionNode, "filename")
        self.recordSha = GetAttributeValueOrDefault(actionNode, "record_sha",
                                                    self.recordSha)

    def WriteXMLNode(self, node):
        SetAttributeString(node, "filename", self.filename)
        #if(not self.saveFullPath):
        #  SetAttributeString(node,"save_full_path",self.saveFullPath)
        if (not self.recordSha):
            SetAttributeString(node, "record_sha", self.recordSha)

        return node

    # The factory that creates the SaveNotesAction Object
    class Factory:
        def CreateFromXML(self, xmlNode, problemManager):
            return SaveNotesAction.CreateFromXML(xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(SaveNotesAction.typeStr, SaveNotesAction.Factory())
    @classmethod
    def CreateFromXML(cls, actionNode, problemManager):
        # this creates the class from an xml node by initiating an empty class and parsing the xml node
        rv = cls()
        rv.ParseXMLNode(actionNode, problemManager)
        return rv

    def ParseXMLNode(self, actionNode, problemManager):
        """
       Generate named action from xml tree node. 
       """
        self.doPlots = GetAttributeValueOrDefault(actionNode, "doPlots",
                                                  self.doPlots)
        return

    def WriteXMLNode(self, node):
        # empty
        SetAttributeString(node, "doPlots", self.doPlots)
        return node

    # The factory that creates the ExitAction Object
    class Factory:
        def CreateFromXML(self, xmlNode, problemManager):
            return HydrogenSingleSiteEvaluationAction.CreateFromXML(
                xmlNode, problemManager)


# Factory Registrator
ActionFactory.AddFactory(HydrogenSingleSiteEvaluationAction.typeStr,
                         HydrogenSingleSiteEvaluationAction.Factory())