Package org.apache.uima.cas
Interface ArrayFS<E extends FeatureStructure>
- All Superinterfaces:
Cloneable
,CommonArrayFS<E>
,FeatureStructure
- All Known Subinterfaces:
ArrayFSImpl<E>
- All Known Implementing Classes:
FSArray
Feature structure array interface. To create a FS array object, use
CAS.createArrayFS(int length)
or new FSArray(aJCas, length)-
Method Summary
Modifier and TypeMethodDescription<T extends FeatureStructure>
voidcopyFromArray
(T[] src, int srcOffset, int destOffset, int length) Copy the contents of an external array into this array.<U extends FeatureStructure>
voidcopyToArray
(int srcOffset, U[] dest, int destOffset, int length) Copy the contents of the array fromstart
toend
to the destinationdestArray
with destination offsetdestOffset
.<U extends FeatureStructure>
Uget
(int i) Get the i-th feature structure from the array.void
Set the i-th value.toArray()
Creates a new array the this array is copied to.<T extends TOP>
T[]toArray
(T[] a) Populates an existing array from this FS Array.Methods inherited from interface org.apache.uima.cas.CommonArrayFS
copyFromArray, copyToArray, copyValuesFrom, getValuesAsCommaSeparatedString, isEmpty, size, toStringArray
Methods inherited from interface org.apache.uima.cas.FeatureStructure
_getTypeCode, _id, clone, equals, getAddress, getBooleanValue, getByteValue, getCAS, getDoubleValue, getFeatureValue, getFeatureValueAsString, getFloatValue, getIntValue, getJCas, getLongValue, getShortValue, getStringValue, getType, hashCode, setBooleanValue, setByteValue, setDoubleValue, setFeatureValue, setFeatureValueFromString, setFloatValue, setIntValue, setLongValue, setShortValue, setStringValue
-
Method Details
-
get
Get the i-th feature structure from the array.- Type Parameters:
U
- The class of the item being obtained by the get- Parameters:
i
- index- Returns:
- The i-th feature structure.
- Throws:
ArrayIndexOutOfBoundsException
- If the index is out of bounds.
-
set
Set the i-th value.- Parameters:
i
- The index.fs
- The value.- Throws:
ArrayIndexOutOfBoundsException
- Ifi
is out of bounds.
-
copyToArray
<U extends FeatureStructure> void copyToArray(int srcOffset, U[] dest, int destOffset, int length) throws ArrayIndexOutOfBoundsException Copy the contents of the array fromstart
toend
to the destinationdestArray
with destination offsetdestOffset
.- Type Parameters:
U
- the type of the array element- Parameters:
srcOffset
- The index of the first element to copy.dest
- The array to copy to.destOffset
- Where to start copying intodest
.length
- The number of elements to copy.- Throws:
ArrayIndexOutOfBoundsException
- IfsrcOffset < 0
orlength > size()
ordestOffset + length > destArray.length
.
-
copyFromArray
<T extends FeatureStructure> void copyFromArray(T[] src, int srcOffset, int destOffset, int length) throws ArrayIndexOutOfBoundsException Copy the contents of an external array into this array.- Type Parameters:
T
- the class of the array being copied into- Parameters:
src
- The source array.srcOffset
- Where to start copying in the source array.destOffset
- Where to start copying to in the destination array.length
- The number of elements to copy.- Throws:
ArrayIndexOutOfBoundsException
- IfsrcOffset < 0
orlength > size()
ordestOffset + length > destArray.length
.
-
toArray
FeatureStructure[] toArray()Creates a new array the this array is copied to. Return type is FeatureStructure to be backwards compatible with V2- Returns:
- A Java array copy of this FS array.
-
toArray
Populates an existing array from this FS Array.- Type Parameters:
T
- the type of the element- Parameters:
a
- the existing array- Returns:
- the populated array
-