Java Code Examples for org.apache.uima.jcas.cas.FSArray#_getTheArray
The following examples show how to use
org.apache.uima.jcas.cas.FSArray#_getTheArray .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XCASSerializer.java From uima-uimaj with Apache License 2.0 | 5 votes |
private void enqueueFSArray(FSArray fs) { TOP[] theArray = fs._getTheArray(); for (TOP element : theArray) { if (element != null) { enqueue(element); } } }
Example 2
Source File: CasSerializerSupport.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Enqueues all FS reachable from an FSArray. * * @param addr * Address of an FSArray */ private void enqueueFSArrayElements(FSArray fsArray) throws SAXException { for (TOP elem : fsArray._getTheArray()) { if (elem != null) { enqueueFsAndMaybeFeatures(elem); } } }
Example 3
Source File: CasCopier.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * @param arrayFS * @return a copy of the array */ private TOP copyArray(TOP srcFS) { final CommonArrayFS srcCA = (CommonArrayFS) srcFS; final int size = srcCA.size(); final TypeImpl tgtTi = getTargetType(((TOP)srcFS)._getTypeImpl()); // could be null for src = e.g. Annotation[] if (tgtTi == null) { return null; // can't copy } if (srcFS instanceof CommonPrimitiveArray) { CommonArrayFS copy = (CommonArrayFS) tgtCasViewImpl.createArray(tgtTi, size); copy.copyValuesFrom(srcCA); return (TOP) copy; } // is reference array, either // FSArray or // subtype of that (e.g. Annotation[]) FSArray fsArray = (FSArray) tgtCasViewImpl.createArray(tgtTi, size); // we do a direct recursive call here because the depth of this is limited to the depth of array nesting // Contrast with normal FS copying, where the depth could be very large (e.g. FS Lists) int i = 0; TOP[] tgtArray = fsArray._getTheArray(); for (TOP srcItem : ((FSArray)srcFS)._getTheArray()) { if (null != srcItem) { tgtArray[i] = copyFsInner(srcItem); } i++; } return fsArray; }
Example 4
Source File: SelectFSs_impl.java From uima-uimaj with Apache License 2.0 | 4 votes |
public SelectFSs_impl(FSArray source) { this(source._casView); isAltSource = true; sourceFSArray = source._getTheArray(); }
Example 5
Source File: JsonCasSerializer.java From uima-uimaj with Apache License 2.0 | 4 votes |
private void writeFSArray(TOP array, int array_size) throws NumberFormatException, IOException { FSArray fsArray = (FSArray) array; List<XmiArrayElement> ootsArrayElementsList = cds.sharedData == null ? null : cds.sharedData.getOutOfTypeSystemArrayElements(fsArray); int ootsIndex = 0; TOP[] fsItems = fsArray._getTheArray(); for (int j = 0; j < array_size; j++) { // j used to id the oots things TOP fsItem = fsItems[j]; // int heapValue = cds.cas.getHeapValue(pos++); if (fsItem == null) { // this null array element might have been a reference to an // out-of-typesystem FS, which, when deserialized, was replaced with NULL, // so check the ootsArrayElementsList boolean found = false; if (ootsArrayElementsList != null) { while (ootsIndex < ootsArrayElementsList.size()) { XmiArrayElement arel = ootsArrayElementsList.get(ootsIndex++); if (arel.index == j) { jg.writeNumber(Integer.parseInt(arel.xmiId)); found = true; break; } } } if (!found) { jg.writeNumber(0); } // else, not null FS ref } else { if (cds.isFiltering) { // return as null any references to types not in target TS String typeName = fsItem._getTypeImpl().getName(); if (cds.filterTypeSystem_inner.getType(typeName) == null) { fsItem = null; } } writeFsOrRef(fsItem); // allow embedding in array } } // end of loop over all refs in FS array }