示例#1
0
    def __init__(self, _id, name, mutable, learnable, child, minIterations,
                 maxIterations):
        """Constructor of RepeatVariable:
                Each treatment will be repeated at most maxIterations time.
                Each function will call once by iteration its equivalent in the class on the child.
                During an iteration, if the child treatment failed, we canceled the iteration loop.
                If we had done less than minIteration, the global processing is considered failed, else it is considered successful.

                @type child: netzob.Common.MMSTD.Dictionary.Variable.AbstractVariable
                @param child: the unique child which treatments will be repeated.
                @type minIterations: integer
                @param minIterations: the minimum number of iteration each treatment have to be repeated.
                @type maxIterations: integer
                @param maxIterations: the maximum number of iteration each treatment will be repeated.
        """
        AbstractNodeVariable.__init__(self, _id, name, mutable, learnable,
                                      None)
        self.log = logging.getLogger(
            'netzob.Common.MMSTD.Dictionary.Variable.RepeatVariable.py')
        self.setChild(child)
        if minIterations is not None and minIterations >= 0:
            self.minIterations = minIterations
        else:
            self.log.info(
                "Variable {0} (Repeat): Construction of RepeatVariable: minIterations undefined or < 0. minIterations value is fixed to 0."
                .format(self.getName()))
            self.minIterations = 0
        if maxIterations is not None and maxIterations >= minIterations:
            self.maxIterations = maxIterations
        else:
            self.log.info(
                "Variable {0} (Repeat): Construction of RepeatVariable: maxIterations undefined or < minIterations. maxIterations value is fixed to minIterations."
                .format(self.getName()))
            self.maxIterations = self.minIterations
        self.currentIteration = 0  # Tells on which iteration we currently are.
示例#2
0
    def __init__(self, _id, name, mutable, learnable, child, minIterations, maxIterations):
        """Constructor of RepeatVariable:
                Each treatment will be repeated at most maxIterations time.
                Each function will call once by iteration its equivalent in the class on the child.
                During an iteration, if the child treatment failed, we canceled the iteration loop.
                If we had done less than minIteration, the global processing is considered failed, else it is considered successful.

                @type child: netzob.Common.MMSTD.Dictionary.Variable.AbstractVariable
                @param child: the unique child which treatments will be repeated.
                @type minIterations: integer
                @param minIterations: the minimum number of iteration each treatment have to be repeated.
                @type maxIterations: integer
                @param maxIterations: the maximum number of iteration each treatment will be repeated.
        """
        AbstractNodeVariable.__init__(self, _id, name, mutable, learnable, None)
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variable.RepeatVariable.py')
        self.setChild(child)
        if minIterations is not None and minIterations >= 0:
            self.minIterations = minIterations
        else:
            self.log.info("Variable {0} (Repeat): Construction of RepeatVariable: minIterations undefined or < 0. minIterations value is fixed to 0.".format(self.getName()))
            self.minIterations = 0
        if maxIterations is not None and maxIterations >= minIterations:
            self.maxIterations = maxIterations
        else:
            self.log.info("Variable {0} (Repeat): Construction of RepeatVariable: maxIterations undefined or < minIterations. maxIterations value is fixed to minIterations.".format(self.getName()))
            self.maxIterations = self.minIterations
        self.currentIteration = 0  # Tells on which iteration we currently are.
示例#3
0
 def __init__(self, _id, name, mutable, learnable, children=[]):
     """Constructor of AggregateVariable:
     """
     AbstractNodeVariable.__init__(self, _id, name, mutable, learnable,
                                   children)
     self.log = logging.getLogger(
         'netzob.Common.MMSTD.Dictionary.Variable.AggregateVariable.py')
示例#4
0
 def __init__(self, _id, name, mutable, learnable, children=[]):
     """Constructor of AggregateVariable:
     """
     AbstractNodeVariable.__init__(self, _id, name, mutable, learnable, children)
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variable.AggregateVariable.py')