Class GroupFunction.Equality

  • All Implemented Interfaces:
    GroupFunction
    Enclosing interface:
    GroupFunction

    public static class GroupFunction.Equality
    extends Object
    implements GroupFunction
    This is the default group function that does nothing else than to check if all member items have the same state. If this is the case, this state is returned, otherwise UNDEF is returned.
    Author:
    Kai Kreuzer - Initial contribution
    • Constructor Detail

      • Equality

        public Equality()
    • Method Detail

      • calculate

        public State calculate​(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
        Parameters:
        items - the items to calculate a group state for
        Returns:
        the calculated group state
      • getStateAs

        public <T extends State> T getStateAs​(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
        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
      • getParameters

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