Class IntegerArrayList

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<java.lang.Integer>, java.util.RandomAccess, CommonArrayFS<java.lang.Integer>, FeatureStructure, FeatureStructureImpl, UimaSerializable

    public class IntegerArrayList
    extends TOP
    implements java.lang.Iterable<java.lang.Integer>, UimaSerializable, CommonArrayFS<java.lang.Integer>, java.util.RandomAccess, java.lang.Cloneable
    An ArrayList type containing ints, for UIMA - implements a subset of the List API, Iterable<Integer>, IntListIterator. - it is adjustable, like ArrayList Implementation notes: - implements Iterable + stream, not Collection, because stream returns IntStream - Uses UimaSerializable APIs - two implementations of the array list: -- one uses the original IntegerArray, via a variant of the asList wrapper that returns ints -- This is used until an add or remove operation that changes the size. --- switches to IntVector, resetting the original IntegerArray to null - This enables operation without creating the Java Object in use cases of deserializing and referencing when updating is not being used.
    • Field Detail

      • typeIndexID

        public static final int typeIndexID
      • type

        public static final int type
      • intArrayList

        private final IntVector intArrayList
        lifecycle - starts as empty array list - becomes non-empty when updated (add) -- used from that point on
      • intArrayAsList

        private List_of_ints intArrayAsList
        lifecycle - starts as the empty list - set when _init_from_cas_data() - set to null when update (add/remove) happens
      • _FeatName_intArray

        public static final java.lang.String _FeatName_intArray
        See Also:
        Constant Field Values
      • _FC_intArray

        private static final java.lang.invoke.CallSite _FC_intArray
      • _FH_intArray

        private static final java.lang.invoke.MethodHandle _FH_intArray
    • Constructor Detail

      • IntegerArrayList

        protected IntegerArrayList()
        Never called. Disable default constructor
      • IntegerArrayList

        public IntegerArrayList​(TypeImpl type,
                                CASImpl casImpl)
        Internal - constructor used by generator
        Parameters:
        casImpl - the CAS this Feature Structure belongs to
        type - the type of this Feature Structure
      • IntegerArrayList

        public IntegerArrayList​(JCas jcas)
        Parameters:
        jcas - JCas to which this Feature Structure belongs
      • IntegerArrayList

        public IntegerArrayList​(JCas jcas,
                                int length)
        Make a new ArrayList with an initial size
        Parameters:
        jcas - The JCas
        length - initial size
    • Method Detail

      • getTypeIndexID

        public int getTypeIndexID()
        Overrides:
        getTypeIndexID in class TOP
        Returns:
        index of the type
      • getIntArray

        private IntegerArray getIntArray()
        getter for intArray - gets internal use - holds the ints
        Returns:
        value of the feature
      • setIntArray

        private void setIntArray​(IntegerArray v)
        setter for intArray - sets internal use - holds the ints
        Parameters:
        v - value to set into the feature
      • maybeStartUsingIntegerArrayList

        private void maybeStartUsingIntegerArrayList()
      • _save_to_cas_data

        public void _save_to_cas_data()
        Description copied from interface: UimaSerializable
        This method is called by the framework before serialization of an instance of this JCas class. The implementation should save whatever data is needed into Features of this JCas class that can be serialized by UIMA.
        Specified by:
        _save_to_cas_data in interface UimaSerializable
      • get

        public int get​(int i)
        Parameters:
        i - -
        Returns:
        the indexed value from the corresponding Cas IntegerArray as a Java Model object.
      • set

        public void set​(int i,
                        int v)
        updates the i-th value of the IntegerArrayList
        Parameters:
        i - -
        v - -
      • size

        public int size()
        return the size of the array.
        Specified by:
        size in interface CommonArrayFS<java.lang.Integer>
        Returns:
        The size of the array.
      • copyFromArray

        public void copyFromArray​(java.lang.String[] src,
                                  int srcPos,
                                  int destPos,
                                  int length)
        Not supported, will throw UnsupportedOperationException
        Specified by:
        copyFromArray in interface CommonArrayFS<java.lang.Integer>
        Parameters:
        src - -
        srcPos - -
        destPos - -
        length - -
      • copyToArray

        public void copyToArray​(int srcPos,
                                java.lang.String[] dest,
                                int destPos,
                                int length)
        Copies an array of ints to an Array of Strings.
        Specified by:
        copyToArray in interface CommonArrayFS<java.lang.Integer>
        Parameters:
        srcPos - The index of the first element to copy.
        dest - The array to copy to.
        destPos - Where to start copying into dest.
        length - The number of elements to copy.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - If srcPos < 0 or length > size() or destPos + length > destArray.length.
      • copyValuesFrom

        public void copyValuesFrom​(CommonArrayFS<java.lang.Integer> v)
        Description copied from interface: CommonArrayFS
        Copy values from another array of the same kind
        Specified by:
        copyValuesFrom in interface CommonArrayFS<java.lang.Integer>
        Parameters:
        v - the other array
      • create

        public static IntegerArrayList create​(JCas jcas,
                                              int[] a)
        Convenience - create a IntegerArrayList from an existing array.
        Parameters:
        jcas - -
        a - -
        Returns:
        -
      • contains

        public boolean contains​(int i)
        Parameters:
        i - -
        Returns:
        -
      • indexOf

        public int indexOf​(int i)
        Parameters:
        i - -
        Returns:
        -
        See Also:
        ArrayList.indexOf(java.lang.Object)
      • lastIndexOf

        public int lastIndexOf​(int i)
        Parameters:
        i - -
        Returns:
        -
        See Also:
        ArrayList.lastIndexOf(java.lang.Object)
      • toArray

        public int[] toArray​(int[] a)
        Parameters:
        a - -
        Returns:
        -
        See Also:
        ArrayList.toArray(java.lang.Object[])
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class FeatureStructureImplC
        Returns:
        -
        See Also:
        AbstractCollection.toString()
      • add

        public boolean add​(int e)
        Parameters:
        e - -
        Returns:
        true
        See Also:
        ArrayList.add(java.lang.Object)
      • equals

        public boolean equals​(java.lang.Object o)
        Description copied from interface: FeatureStructure
        A feature structure is equal to another feature structure iff it is identical in the underlying representation.
        Specified by:
        equals in interface FeatureStructure
        Overrides:
        equals in class FeatureStructureImplC
        Parameters:
        o - -
        Returns:
        true if all elements are the same, and in same order, and same number
        See Also:
        AbstractList.equals(java.lang.Object)
      • add

        public void add​(int index,
                        int element)
        Parameters:
        index - -
        element - -
        See Also:
        ArrayList.add(int, java.lang.Object)
      • removeAt

        public int removeAt​(int index)
        Parameters:
        index - -
        Returns:
        -
        See Also:
        ArrayList.remove(int)
      • remove

        public boolean remove​(int o)
        Parameters:
        o - - locate and if found remove this object
        Returns:
        true if removed
        See Also:
        ArrayList.remove(java.lang.Object)
      • hashCode

        public int hashCode()
        Description copied from interface: FeatureStructure
        Will return a hash code that's consistent with equality, i.e., if two FSs are equal, they will also return the same hash code.
        Specified by:
        hashCode in interface FeatureStructure
        Overrides:
        hashCode in class FeatureStructureImplC
        Returns:
        -
        See Also:
        AbstractList.hashCode()
      • clear

        public void clear()
        See Also:
        ArrayList.clear()
      • iterator

        public java.util.PrimitiveIterator.OfInt iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Integer>
        Returns:
        -
        See Also:
        ArrayList.iterator()
      • sort

        public void sort()
      • spliterator

        public java.util.Spliterator.OfInt spliterator()
        Specified by:
        spliterator in interface java.lang.Iterable<java.lang.Integer>
      • stream

        public java.util.stream.IntStream stream()
        Returns:
        a stream over the integers
      • forEach

        public void forEach​(java.util.function.IntConsumer action)
        Version of forEach that doesn't box
        Parameters:
        action - -