Class ArithmeticGroupFunction.Or

  • All Implemented Interfaces:
    GroupFunction
    Direct Known Subclasses:
    ArithmeticGroupFunction.NOr
    Enclosing interface:
    ArithmeticGroupFunction

    public static class ArithmeticGroupFunction.Or
    extends Object
    implements GroupFunction
    This does a logical 'or' operation. If at least one item is of 'activeState' this is returned, otherwise the 'passiveState' is returned. Through the getStateAs() method, it can be determined, how many items actually are in the 'activeState'.
    Author:
    Kai Kreuzer - Initial contribution
    • Field Detail

      • activeState

        protected final State activeState
      • passiveState

        protected final State passiveState
    • Constructor Detail

      • Or

        public Or​(State activeValue,
                  State passiveValue)
    • Method Detail

      • calculate

        public State calculate​(List<Item> items)
        Description copied from interface: GroupFunction
        Determines the current state of a group based on a list of items
        Specified by:
        calculate in interface GroupFunction
        Parameters:
        items - the items to calculate a group state for
        Returns:
        the calculated group state
      • getStateAs

        public State getStateAs​(List<Item> items,
                                Class<? extends State> stateClass)
        Description copied from interface: GroupFunction
        Calculates the group state and returns it as a state of the requested type.
        Specified by:
        getStateAs in interface GroupFunction
        Parameters:
        items - the items to calculate a group state for
        stateClass - the type in which the state should be returned
        Returns:
        the calculated group state of the requested type or null, if type is not supported