Class ContainerOperations


  • public class ContainerOperations
    extends java.lang.Object
    Implements the default container operations.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • ContainerOperations

        private ContainerOperations()
        Prevent instance creation.
    • Method Detail

      • register

        public static void register()
        Registers the defined operations.
      • convert

        private static final EvaluationAccessor convert​(EvaluationAccessor operand,
                                                        IDatatype targetType)
        Performs the conversion of the operand to the given (container) datatype.
        Parameters:
        operand - the operand to be converted
        targetType - the target datatype
        Returns:
        the converted operand
      • min

        private static final EvaluationAccessor min​(EvaluationAccessor operand,
                                                    EvaluationAccessor[] arguments)
        Performs the MIN operation the given (container) datatype.
        Parameters:
        operand - the operand to be converted
        arguments - the arguments
        Returns:
        The result of the arithmetic operation, null if the operation cannot be applied
      • max

        private static final EvaluationAccessor max​(EvaluationAccessor operand,
                                                    EvaluationAccessor[] arguments)
        Performs the MAX operation the given (container) datatype.
        Parameters:
        operand - the operand to be converted
        arguments - the arguments
        Returns:
        The result of the arithmetic operation, null if the operation cannot be applied
      • addAll

        static final void addAll​(ContainerOperations.ContainerArgument cnt,
                                 java.util.List<Value> result,
                                 EvaluationAccessor resAcc)
        Adds all elements in cnt to result.
        Parameters:
        cnt - the source of the elements
        result - the target (to be modified as a side effect)
        resAcc - the accessor to cont for taking over bound elements
      • addAll

        static final void addAll​(ContainerOperations.ContainerArgument cnt,
                                 java.util.Set<Value> result,
                                 EvaluationAccessor resAcc)
        Adds all elements in cnt to result.
        Parameters:
        cnt - the source of the elements
        result - the target (to be modified as a side effect)
        resAcc - the accessor to cont for taking over bound elements
      • found

        static final EvaluationAccessor found​(EvaluationAccessor operand,
                                              EvaluationAccessor[] arguments,
                                              boolean negate)
        Returns whether the first argument value can be found in the operand given that operand is a container.
        Parameters:
        operand - the operand
        arguments - the arguments
        negate - negate the result, i.e., from found to not found
        Returns:
        whether the first argument was (not) found in operand
      • flatten

        static void flatten​(Value value,
                            java.util.Collection<Value> result)
        (Recursively) Flattens the given value if needed.
        Parameters:
        value - the value to be flattened
        result - the flattened values (modified as a side effect)