Class KeyGroupRange

    • Field Detail

      • EMPTY_KEY_GROUP_RANGE

        public static final KeyGroupRange EMPTY_KEY_GROUP_RANGE
        The empty key-group
    • Constructor Detail

      • KeyGroupRange

        public KeyGroupRange​(int startKeyGroup,
                             int endKeyGroup)
        Defines the range [startKeyGroup, endKeyGroup]
        Parameters:
        startKeyGroup - start of the range (inclusive)
        endKeyGroup - end of the range (inclusive)
    • Method Detail

      • contains

        public boolean contains​(int keyGroup)
        Checks whether or not a single key-group is contained in the range.
        Specified by:
        contains in interface KeyGroupsList
        Parameters:
        keyGroup - Key-group to check for inclusion.
        Returns:
        True, only if the key-group is in the range.
      • getIntersection

        public KeyGroupRange getIntersection​(KeyGroupRange other)
        Create a range that represent the intersection between this range and the given range.
        Parameters:
        other - A KeyGroupRange to intersect.
        Returns:
        Key-group range that is the intersection between this and the given key-group range.
      • getNumberOfKeyGroups

        public int getNumberOfKeyGroups()
        Description copied from interface: KeyGroupsList
        Returns the number of key group ids in the list.
        Specified by:
        getNumberOfKeyGroups in interface KeyGroupsList
        Returns:
        The number of key-groups in the range
      • getStartKeyGroup

        public int getStartKeyGroup()
        Returns:
        The first key-group in the range.
      • getEndKeyGroup

        public int getEndKeyGroup()
        Returns:
        The last key-group in the range.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • prettyPrintInterval

        public String prettyPrintInterval()
      • of

        public static KeyGroupRange of​(int startKeyGroup,
                                       int endKeyGroup)
        Factory method that also handles creation of empty key-groups.
        Parameters:
        startKeyGroup - start of the range (inclusive)
        endKeyGroup - end of the range (inclusive)
        Returns:
        the key-group from start to end or an empty key-group range.