Class CodeListSet<E extends CodeList<E>>

  • Type Parameters:
    E - the type of code list elements in the set.
    All Implemented Interfaces:
    Serializable, Cloneable, Iterable<E>, Collection<E>, Set<E>, Checked­Container<E>

    public class CodeListSet<E extends CodeList<E>>
    extends AbstractSet<E>
    implements CheckedContainer<E>, Cloneable, Serializable
    A specialized Set implementation for use with Code­List values. All elements in a Code­List­Set are of the same Code­List class, which must be final. Iterators traverse the elements in the order in which the code list constants are declared.
    Implementation note
    Code­List­Set is implemented internally by bit vectors for compact and efficient storage. All bulk operations (add­All, remove­All, contains­All) are very quick if their argument is also a Code­List­Set instance.
    Usage example
    The following example creates a set of Axis­Directions for a (x,y,z) coordinate system:
    CodeListSet<AxisDirection> codes = new CodeListSet<>(AxisDirection.class);
    Collections.addAll(codes, AxisDirection.EAST, AxisDirection.NORTH, AxisDirection.UP),
    Since:
    0.3
    See Also:
    Enum­Set, Serialized Form

    Defined in the sis-utility module

    • Constructor Detail

      • CodeListSet

        public CodeListSet​(Class<E> elementType)
                    throws IllegalArgumentException
        Creates an initially empty set for code lists of the given type. The given Code­List type shall be final.
        Parameters:
        element­Type - the type of code list elements to be included in this set.
        Throws:
        Illegal­Argument­Exception - if the given class is not final.
      • CodeListSet

        public CodeListSet​(Class<E> elementType,
                           boolean fill)
                    throws IllegalArgumentException
        Creates set for code lists of the given type. If the fill argument is false, then the new set will be initially empty. Otherwise the new set will be filled with all code list elements of the given type that are known at construction time. Note that if new code list elements are created after the invocation of this Code­List­Set constructor, then those new elements will not be in this set.
        Parameters:
        element­Type - the type of code list elements to be included in this set.
        fill - true for filling the set with all known elements of the given type, or false for leaving the set empty.
        Throws:
        Illegal­Argument­Exception - if the given class is not final.