Class FSArray<T extends FeatureStructure>

All Implemented Interfaces:
Cloneable, Iterable<T>, ArrayFS<T>, CommonArrayFS<T>, FeatureStructure, FeatureStructureImpl, ArrayFSImpl<T>, SelectViaCopyToArray<T>

public final class FSArray<T extends FeatureStructure> extends TOP implements ArrayFSImpl<T>, Iterable<T>, SelectViaCopyToArray<T>
Java Class model for Cas FSArray type extends FeatureStructure for backwards compatibility when using FSArray with no typing.
  • Field Details

    • _TypeName

      public static final String _TypeName
      See Also:
    • typeIndexID

      public static final int typeIndexID
      each cover class when loaded sets an index. used in the JCas typeArray to go from the cover class or class instance to the corresponding instance of the _Type class
    • type

      public static final int type
  • Constructor Details

    • FSArray

      public FSArray(JCas jcas, int length)
      Make a new FSArray of given size
      Parameters:
      jcas - The JCas
      length - The number of elements in the new array
    • FSArray

      public FSArray(TypeImpl t, CASImpl c, int length)
      used by generator Make a new FSArray of given size
      Parameters:
      c - -
      t - -
      length - the length of the array
    • FSArray

      public FSArray(Class<? extends TOP> clazz, JCas jcas, int length)
      Constructs an instance of a subtype of FSArray having the component type clazz Note: the array with this component type must already be specified in the type system declaration as a feature whose range is FSArray with the specified elementType.
      Parameters:
      clazz - - the FSArray's element's class
      jcas - -
      length - -
  • Method Details

    • getTypeIndexID

      public int getTypeIndexID()
      used to obtain reference to the _Type instance
      Overrides:
      getTypeIndexID in class TOP
      Returns:
      the type array index
    • get

      public <U extends FeatureStructure> U get(int i)
      return the indexed value from the corresponding Cas FSArray as a Java Model object.
      Specified by:
      get in interface ArrayFS<T extends FeatureStructure>
      Type Parameters:
      U - The class of the item being obtained by the get
      Parameters:
      i - index
      Returns:
      The i-th feature structure.
    • set

      public void set(int i, T av)
      updates the Cas, setting the indexed value with the corresponding Cas FeatureStructure.
      Specified by:
      set in interface ArrayFS<T extends FeatureStructure>
      Parameters:
      i - The index.
      av - The value.
    • size

      public int size()
      return the size of the array.
      Specified by:
      size in interface CommonArrayFS<T extends FeatureStructure>
      Returns:
      The size of the array.
    • copyFromArray

      public <U extends FeatureStructure> void copyFromArray(U[] src, int srcPos, int destPos, int length)
      Description copied from interface: ArrayFS
      Copy the contents of an external array into this array.
      Specified by:
      copyFromArray in interface ArrayFS<T extends FeatureStructure>
      Type Parameters:
      U - the class of the array being copied into
      Parameters:
      src - The source array.
      srcPos - Where to start copying in the source array.
      destPos - Where to start copying to in the destination array.
      length - The number of elements to copy.
      See Also:
    • copyToArray

      public <U extends FeatureStructure> void copyToArray(int srcPos, U[] dest, int destPos, int length)
      Description copied from interface: ArrayFS
      Copy the contents of the array from start to end to the destination destArray with destination offset destOffset.
      Specified by:
      copyToArray in interface ArrayFS<T extends FeatureStructure>
      Type Parameters:
      U - the type of the array element
      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.
      See Also:
    • toArray

      public FeatureStructure[] toArray()
      Description copied from interface: ArrayFS
      Creates a new array the this array is copied to. Return type is FeatureStructure to be backwards compatible with V2
      Specified by:
      toArray in interface ArrayFS<T extends FeatureStructure>
      Returns:
      A Java array copy of this FS array.
      See Also:
    • _toArrayForSelect

      public FeatureStructure[] _toArrayForSelect()
      Specified by:
      _toArrayForSelect in interface SelectViaCopyToArray<T extends FeatureStructure>
    • copyFromArray

      public void copyFromArray(String[] src, int srcPos, int destPos, int length)
      Not supported, will throw UnsupportedOperationException
      Specified by:
      copyFromArray in interface CommonArrayFS<T extends FeatureStructure>
      Parameters:
      src - The source array.
      srcPos - Where to start copying in the source array.
      destPos - Where to start copying to in the destination array.
      length - The number of elements to copy.
    • copyToArray

      public void copyToArray(int srcPos, String[] dest, int destPos, int length)
      Copies an array of Feature Structures to an Array of Strings. The strings are the "toString()" representation of the feature structures,
      Specified by:
      copyToArray in interface CommonArrayFS<T extends FeatureStructure>
      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:
      ArrayIndexOutOfBoundsException - If srcPos < 0 or length > size() or destPos + length > destArray.length.
    • _getTheArray

      public TOP[] _getTheArray()
    • copyValuesFrom

      public void copyValuesFrom(CommonArrayFS<T> v)
      Description copied from interface: CommonArrayFS
      Copy values from another array of the same kind
      Specified by:
      copyValuesFrom in interface CommonArrayFS<T extends FeatureStructure>
      Parameters:
      v - the other array
    • create

      public static <U extends FeatureStructure> FSArray<U> create(JCas jcas, FeatureStructure[] a)
      Convenience - create a FSArray from an existing FeatureStructure[]
      Type Parameters:
      U - the element type of the FSArray, subtype of FeatureStructure
      Parameters:
      jcas - -
      a - -
      Returns:
      -
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends FeatureStructure>
    • spliterator

      public Spliterator<T> spliterator()
      Specified by:
      spliterator in interface Iterable<T extends FeatureStructure>
    • stream

      public Stream<T> stream()
    • contains

      public boolean contains(Object o)
    • toArray

      public <U extends TOP> U[] toArray(U[] a)
      Description copied from interface: ArrayFS
      Populates an existing array from this FS Array.
      Specified by:
      toArray in interface ArrayFS<T extends FeatureStructure>
      Type Parameters:
      U - the type of the element
      Parameters:
      a - the existing array
      Returns:
      the populated array