Class AliasSet

  • All Implemented Interfaces:
    Iterable<String>

    public final class AliasSet
    extends Object
    implements Iterable<String>
    An alias set consists of a set of name aliases and optionally a token order.
    • Method Detail

      • remap

        public AliasSet remap​(FieldRemapping mapping)
        Applies the field remapping to the names in this set, returning a new set. This set is not modified
        Parameters:
        mapping - the field remapping
        Returns:
        a new set
      • getKeys

        public Set<String> getKeys()
        Returns the aliases in this set
        Returns:
        the aliases in this set
      • getOrder

        public TokenOrder getOrder()
        Return the order associated with this set.
        Returns:
        the order. Will never be null but might not be relavant in the context in which this set is used.
      • isEmpty

        public boolean isEmpty()
        Returns whether this is an empty set
        Returns:
        whether this is an empty set
      • containsAny

        public boolean containsAny​(AliasSet other)
        Returns true if this set contains any of the member of the other set
        Parameters:
        other - the other set
        Returns:
        whether the union of this set and the other set is non-empty
      • contains

        public boolean contains​(String name)
        Returns whether this set contains the given alias
        Parameters:
        name - the alias
        Returns:
        whether this set contains the given alias
      • first

        public String first()
        Returns the first member of this set
        Returns:
        the first member of this set
      • firstSortKey

        public SortKey firstSortKey()
        Returns the first member of this set, combined with the order to make a SortKey
        Returns:
        the first SortKey of this set
      • createSet

        public static AliasSet createSet​(String key)
        Creates a set consisting of a single key. Order defaults to ascending
        Parameters:
        key - the key
        Returns:
        a new set
      • createSet

        public static AliasSet createSet​(String[] keys)
        Creates a set consisting of an array of keys. Order defaults to ascending
        Parameters:
        keys - the keys
        Returns:
        a set consisting of an array of keys
      • createSet

        public static AliasSet createSet​(String[] keys,
                                         TokenOrder order)
        Creates a set consisting of an array of keys and specified order
        Parameters:
        keys - the keys
        order - the order
        Returns:
        a set consisting of an array of keys
      • createSet

        public static AliasSet createSet​(SortKey key)
        Creates a set consisting of the given ordered key
        Parameters:
        key - the key
        Returns:
        a new set
      • createSets

        public static AliasSet[] createSets​(String[] keys)
        Creates multiple single-key sets. Order defaults to ascending.
        Parameters:
        keys - the keys
        Returns:
        the new sets
      • createSets

        public static AliasSet[] createSets​(SortKey[] keys)
        Creates multiple single-key sets of specified order.
        Parameters:
        keys - the keys
        Returns:
        the new sets
      • first

        public static String[] first​(AliasSet[] sets)
        Returns the first keys in each of the given sets
        Parameters:
        sets - the sets
        Returns:
        the first keys
      • firstSortKeys

        public static SortKey[] firstSortKeys​(AliasSet[] sets)
        Returns the first sort keys in each of the given sets
        Parameters:
        sets - the sets
        Returns:
        the first sort keys
      • remap

        public static AliasSet[] remap​(AliasSet[] sets,
                                       FieldRemapping mapping)
        Remaps each set according to the given remapping
        Parameters:
        sets - the sets to remap
        mapping - the remapping
        Returns:
        the remapped sets
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object