/** * @see org.apache.uima.cas.FSIndex#getType() */ @Override public Type getType() { return this.iicp.fsLeafIndex.getType(); }
private ComparableIntPointerIterator[] initPointerIterator() { // Note to maintainers: Make sure the iterator cache exists on all paths calling this final ArrayList<?> cachedSubIndexes = iicp.cachedSubFsLeafIndexes; final int length = cachedSubIndexes.size(); final ArrayList<ComparableIntPointerIterator> pia = new ArrayList<ComparableIntPointerIterator>(cachedSubIndexes.size()); // put all non-empty leaf iterators into the iteration, and if all are empty, put the last one in // (to avoid handling 0 as a special case) for (int i = 0; i < length; i++) { final FSLeafIndexImpl<?> leafIndex = (FSLeafIndexImpl<?>) cachedSubIndexes.get(i); if ((leafIndex.size() > 0) || ((i == length -1) && // this logic puts in the last one if all are empty (0 == pia.size()))) { pia.add(leafIndex.pointerIterator( this.iteratorComparator, FSIndexRepositoryImpl.this.detectIllegalIndexUpdates, ((TypeImpl) leafIndex.getType()).getCode())); } } ComparableIntPointerIterator[] piaa = new ComparableIntPointerIterator[pia.size()]; return pia.toArray(piaa); }
@Override public String toString() { return String.format("FlatIterator [size=%,d, type=%s, pos=%s, %s]", ifsa.length, iicp.getFsLeafIndex().getType().getName(), pos, idInfo()); }
/** * Maybe not used 3/2015 * * Compares first using the type code of the main types * If those are equal, * Compares using the comparator objects * @see java.lang.Comparable#compareTo(Object) * */ public int compareTo(IndexIteratorCachePair<? extends FeatureStructure> cp) { final int typeCode1 = ((TypeImpl) this.fsLeafIndex.getType()).getCode(); final int typeCode2 = ((TypeImpl) cp.fsLeafIndex.getType()).getCode(); if (typeCode1 < typeCode2) { return -1; } else if (typeCode1 > typeCode2) { return 1; } else { // types are equal return this.fsLeafIndex.getComparator().compareTo(cp.fsLeafIndex.getComparator()); } }
@Override public TI get() throws NoSuchElementException { if (!isValid()) { throw new NoSuchElementException(); } final TI fs = (TI) ifsa[pos]; final int typeCode = ((FeatureStructureImpl)fs).getavoidcollisionTypeCode(); if (debugTypeCodeUnstable) { if ((fs instanceof TOP) && // insures jcas in use !iicp.subsumes(((TOP)fs).jcasType.casTypeCode, typeCode)) { throw new RuntimeException(String.format("debug type switch from %s to %s", ((TOP)fs).jcasType.casType.getName(), fs.getType().getName())); } } // check for index update // if (indexUpdateCountsResetValues[offset_indexUpdateCountsAtReset.get(typeCode)] == // iicp.getDetectIllegalIndexUpdates(typeCode)) { if (iicp.isUpdateFreeSinceLastCounterReset(typeCode)) { return fs; } throw new ConcurrentModificationException(); }
final Type indexType = iicp.fsLeafIndex.getType(); if (!this.sii.tsi.subsumes(indexType, type)) { final CASRuntimeException cre = new CASRuntimeException(