Class ArithmeticGroupFunction.And

All Implemented Interfaces:
Direct Known Subclasses:
Enclosing interface:

public static class ArithmeticGroupFunction.And extends Object implements GroupFunction
This does a logical 'and' operation. Only if all items are of 'activeState' this is returned, otherwise the 'passiveState' is returned. Through the getStateAs() method, it can be determined, how many items actually are not in the 'activeState'.
  • Field Details

    • activeState

      protected final State activeState
    • passiveState

      protected final State passiveState
  • Constructor Details

    • And

      public And(@Nullable State activeValue, @Nullable State passiveValue)
  • Method Details

    • calculate

      public State calculate(@Nullable Set<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
      items - the items to calculate a group state for
      the calculated group state
    • getStateAs

      public <T extends State> @Nullable T getStateAs(@Nullable Set<Item> items, Class<T> 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
      items - the items to calculate a group state for
      stateClass - the type in which the state should be returned
      the calculated group state of the requested type or null, if type is not supported
    • getParameters

      public State[] getParameters()
      Description copied from interface: GroupFunction
      Returns the parameters of the function as an array.
      Specified by:
      getParameters in interface GroupFunction
      the parameters of this function