Class ContainerIterators.ClosureIteratorEvaluator

    • Field Detail

      • stopOnCycle

        private boolean stopOnCycle
    • Constructor Detail

      • ClosureIteratorEvaluator

        private ClosureIteratorEvaluator​(boolean stopOnCycle)
        Creates the closure iterator.
        Parameters:
        stopOnCycle - stop on a cycle or just ignore the already vited nodes and go on
    • Method Detail

      • aggregate

        public Value aggregate​(EvaluationAccessor result,
                               Value iter,
                               EvaluationAccessor value,
                               java.util.Map<java.lang.Object,​java.lang.Object> data)
                        throws ValueDoesNotMatchTypeException
        Description copied from interface: IIteratorEvaluator
        Aggregate value to result.
        Parameters:
        result - the aggregating result
        iter - the current value of the iterator
        value - the value to be aggregated
        data - arbitrary data to be hold while actually evaluating the function
        Returns:
        a boolean value to indicate whether iteration/evaluation shall stop (true if iteration shall stop due to this evaluation, false else), a collection of values as instance of ListWrapperValue where to go on
        Throws:
        ValueDoesNotMatchTypeException - in case of type compatibility problems
      • hasCycle

        protected boolean hasCycle​(java.util.Map<java.lang.Object,​java.lang.Object> data)
        Returns whether a cycle was detected.
        Parameters:
        data - the data object
        Returns:
        true for cycle, false else
      • handleNextValue

        private boolean handleNextValue​(Value value,
                                        ContainerValue result,
                                        java.util.Map<java.lang.Object,​java.lang.Object> data,
                                        java.util.List<Value> nextValues)
                                 throws ValueDoesNotMatchTypeException
        Handles the next value by checking whether it was already added.
        Parameters:
        value - the value
        result - the result container to be changed if not already added
        data - the temporary data storing already added elements
        nextValues - the next values to be considered for iteration
        Returns:
        true if value was added to result, false else
        Throws:
        ValueDoesNotMatchTypeException - if adding value to result is failing
      • handleResult

        private void handleResult​(boolean changed,
                                  EvaluationAccessor result,
                                  EvaluationAccessor value,
                                  int index)
        Handles the bound container elements of result.
        Parameters:
        changed - whether the result container was changed by the last evaluation
        result - the result accessor to be modified
        value - the value accessor
        index - the index of the bound element, no index if negative