org.apache.uima.jcas.cas.TOP Java Examples

The following examples show how to use org.apache.uima.jcas.cas.TOP. 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: BinaryCasSerDes4.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * add strings to the optimizestrings object
  * 
 * If delta, only process for fs's that are new; 
 * modified string values picked up when scanning FsChange items
 * @param fs feature structure
 */
private void extractStrings(TOP fs) {
  if (isDelta && !mark.isNew(fs)) {
    return;
  }
  TypeImpl type = fs._getTypeImpl();
 
  if (type.isArray()) {
    if (type.getComponentSlotKind() == SlotKind.Slot_StrRef) {
      for (String s : ((StringArray)fs)._getTheArray()) {
        os.add(s);
      }
    }
  } else {  // end of is-array        
    for (FeatureImpl feat : type.getFeatureImpls()) {
      if (feat.getSlotKind() == SlotKind.Slot_StrRef) {
        os.add(fs._getStringValueNc(feat));
      }
    } // end of iter over all features
  } // end of if-is-not-array
}
 
Example #2
Source File: XCASSerializer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Add an address to the queue.
 * 
 * @param fs_id
 *          The address.
 * @return <code>false</code> iff we've seen this address before.
 */
private boolean enqueue(TOP fs) {
  if (KEY_ONLY_MATCH == isQueued(fs, INVALID_INDEX)) {
    return false;
  }
  int typeCode = fs._getTypeCode();
  // at this point we don't know if this FS is indexed
  queued.put(fs, NOT_INDEXED);
  queue.push(fs);
  final int typeClass = classifyType(fs._getTypeImpl());
  if (typeClass == LowLevelCAS.TYPE_CLASS_FS) {
    if (mOutOfTypeSystemData != null) {
      enqueueOutOfTypeSystemFeatures(fs);
    }
    enqueueFeatures(fs, typeCode);
  } else if (typeClass == LowLevelCAS.TYPE_CLASS_FSARRAY) {
    enqueueFSArray((FSArray) fs);
  }
  return true;
}
 
Example #3
Source File: BinaryCasSerDes.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
private Sofa makeSofaFromHeap(int sofaAddr, StringHeap stringHeap2, CommonSerDesSequential csds, boolean isUnordered) {
  TOP sofa = csds.addr2fs.get(sofaAddr);
  if (sofa != null) {
    return (Sofa) sofa;
  }
  // create sofa
  int sofaNum = heapFeat(sofaAddr, tsi.sofaNum);
  String sofaName = stringHeap2.getStringForCode(heapFeat(sofaAddr, tsi.sofaId));
  sofa = baseCas.createSofa(sofaNum, sofaName, null);
  if (isUnordered) {
    csds.addFSunordered(sofa, sofaAddr);
  } else {
    csds.addFS(sofa, sofaAddr);
  }
  return (Sofa) sofa;
}
 
Example #4
Source File: XmiCasDeserializer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
private TOP maybeGetFsForXmiId(int xmiId) {
      //first check shared data (but if we're doing a merge, do so only
      //for xmi:ids below the merge point)
      if (mergePoint < 0 || !isNewFS(xmiId) ) {   // not merging or merging but is below the line
        TOP fs = sharedData.getFsForXmiId(xmiId);
        if (fs != null) {
          return fs;
        } else {
          return null;
        }
      } else {
        //if we're merging, then we use a local id map for FSs above the
        //merge point, since each of the different XMI CASes being merged
        //can use these same ids for different FSs.
        return localXmiIdToFs.get(xmiId);
//        if (localAddr != null) {
//          return localAddr.intValue();
//        } else {
//          throw new java.util.NoSuchElementException();
//        }
      }
    }
 
Example #5
Source File: FeaturePathImpl.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * evaluate the built-in function for the returned FeatureStructure
 * 
 * @param returnFS
 *          FeatureStructure that is returned
 * 
 * @return Returns the built-in function value for the given FS.
 */
private String evaluateBuiltInFunction(TOP returnFS) {
  if (this.builtInFunction == FUNCTION_COVERED_TEXT) {
    if (returnFS instanceof AnnotationFS) {
      return ((AnnotationFS) returnFS).getCoveredText();
    } else {
      throw new CASRuntimeException(MESSAGE_DIGEST, "BUILT_IN_FUNCTION_NOT_SUPPORTED",
          new Object[] { FUNCTION_NAME_COVERED_TEXT, returnFS.getType().getName() });
    }
  } else if (this.builtInFunction == FUNCTION_ID) {
    return Integer.toString(returnFS._id);

  } else if (this.builtInFunction == FUNCTION_TYPE_NAME) {
    return returnFS.getType().getName();
  }
  return null;
}
 
Example #6
Source File: CasCompare.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
private int compareFeature(TOP fs1, TOP fs2, TypeImpl ti1, FeatureImpl fi1) {
    int r = 0;
    if (inSortContext && isTypeMapping) {
      if (isSrcCas && typeMapper.getTgtFeature(ti1, fi1) == null) {
        return 0; // skip tests for features not in target type system
                  // so when comparing CASs, the src value won't cause a miscompare
      }
      if (!isSrcCas && typeMapper.getSrcFeature(ti1,  fi1) == null) {
        return 0; // types/features belong to target in this case
      }
    }
    FeatureImpl fi2 = (!inSortContext && isTypeMapping) ? typeMapper.getTgtFeature(ti1, fi1) : fi1;
    if (fi2 != null) {
      r = compareSlot(fs1, fs2, fi1, fi2, ti1);
      if (0 != r) {
        if (!inSortContext) {
//          // debug
//          compareSlot(fs1, fs2, fi1, fi2, ti1);
          mismatchFs(fs1, fs2, fi1, fi2);
        }
        return r;
      }
    } // else we skip the compare - no slot in tgt for src
    return r;
  }
 
Example #7
Source File: OrderedFsSet_array2.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * @see Set#toArray(Object[])
 */
@SuppressWarnings("unchecked")
@Override
public <T> T[] toArray(T[] a1) {
  if (a1.length < size()) {
    a1 = (T[]) Array.newInstance(a.getClass(), size());
  }
  int i = 0;
  for (TOP item : a) {
    if (item != null) {
      a1[i++] = (T) item;
    }
  }
  if (i < a1.length) {
    a1[i] = null;  // contract for toArray, when array bigger than items
  }
  return a1;
}
 
Example #8
Source File: FsIterator_set_sorted.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
@Override
public void moveToPreviousNvc() {
  if (!isGoingForward) {
    if (isCurrentElementFromLastGet) {
      isCurrentElementFromLastGet = false;
    } else {
      maybeTraceCowUsingCopy(fsSetSortIndex, (CopyOnWriteIndexPart) navSet);
      currentElement = iterator.next();
      // leave isCurrentElementFromLastGet false
    } 
  } else {
    //reverse direction
    if (!isCurrentElementFromLastGet) {
      maybeTraceCowUsingCopy(fsSetSortIndex, (CopyOnWriteIndexPart) navSet);
      currentElement = iterator.next();  // need current value to do reverse iterator starting point
    }
    assert(currentElement != null);
    iterator = (Iterator<T>) navSet.headSet((TOP)currentElement, false).descendingIterator();
    isGoingForward = false;
    isCurrentElementFromLastGet = false;
  }  
}
 
Example #9
Source File: TypePrioritiesFactory.java    From uima-uimafit with Apache License 2.0 6 votes vote down vote up
/**
 * Create a TypePriorities given a sequence of ordered type classes
 *
 * @param prioritizedTypes
 *          a sequence of ordered type classes
 * @return type priorities created from the ordered JCas classes
 */
@SafeVarargs
public static TypePriorities createTypePriorities(Class<? extends TOP>... prioritizedTypes) {
  String[] typeNames = new String[prioritizedTypes.length];
  for (int i = 0; i < prioritizedTypes.length; i++) {
    if (!TOP.class.isAssignableFrom(prioritizedTypes[i])) {
      throw new IllegalArgumentException("[" + prioritizedTypes[i] + "] is not a JCas type");
    }
    
    String typeName = prioritizedTypes[i].getName();
    if (typeName.startsWith(UIMA_BUILTIN_JCAS_PREFIX)) {
      typeName = "uima." + typeName.substring(UIMA_BUILTIN_JCAS_PREFIX.length());
    }

    typeNames[i] = typeName;
  }
  return createTypePriorities(typeNames);
}
 
Example #10
Source File: XCASDeserializer.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
TOP maybeCreateWithV2Id(int id, Supplier<TOP> create) {
  if (cas.is_ll_enableV2IdRefs()) {
    cas.set_reuseId(id);
    try {
      TOP fs = create.get();
      if (highestIdFs == null) {
        highestIdFs = fs;
      } else if (highestIdFs._id < fs._id) {
        highestIdFs = fs;  // for setting up getNextId at end
      } 
      return fs;
    } finally {           
      cas.set_reuseId(0); // in case of error throw
    }
  } else {
    return create.get();          
  }
}
 
Example #11
Source File: OrderedFsSet_array2.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * @see SortedSet#first()
 */
@Override
public TOP first() {
  processBatch();
  if (size == 0) {
    throw new NoSuchElementException();
  }
  for (int i = a_firstUsedslot; i < a_nextFreeslot; i++) {
    TOP item = a[i];
    if (null != item) {
      if (i > a_firstUsedslot) {
        a_firstUsedslot = i;
      }
      return item; 
    }
  }
  Misc.internalError();
  return null;
}
 
Example #12
Source File: FsIterator_set_sorted2.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
   * Starting at a position where the item is equal to fs
   * using the compare without id, 
   * move to the leftmost one
   * 
   * search opportunistically, starting at 1 before, 2, 4, 8, 16, etc.
   * then doing binary search in the opposite dir
   * 
   * These methods are in this class because they manipulate "pos"
   * @param fs -
   */
  private void moveToLeftMost(FeatureStructure fs) {
    
    // adjust to move to left-most equal item
    boolean comparedEqual = false;
    int origPos = pos;
    int span = 1;
    while (isValid()) {
      int upperValidPos = pos;
      pos = origPos - span;
      pos = Math.max(-1,  pos);
//      decrToSkipOverNulls();
      if (!isValid()) {
        moveToLeftMostUp(fs, upperValidPos);
        return;
      }
      comparedEqual = (0 == comparatorMaybeNoTypeWithoutID.compare((TOP)get(), (TOP) fs));
      if (!comparedEqual) {
        moveToLeftMostUp(fs, upperValidPos);
        return;
      }
      span = span << 1;
    }
  }
 
Example #13
Source File: FsIndex_flat.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
   * Flat array filled, ordered
   * @param flatArray the array to fill
   */
  private TOP[] fillFlatArray() {
    
    TOP[] a =  (TOP[]) Array.newInstance(TOP.class, iicp.size());
    
    FSIterator<T> it = iicp.iterator();
    int i = 0;
    while (it.hasNext()) {
      a[i++] = (TOP) it.nextNvc();
    }
    
    if (i != a.length) {
//      System.out.println("Debug - got iterator invalid before all items filled, i = " + i + ", size = " + flatArray.length);
      throw new ConcurrentModificationException();
    }
    return a;
  }
 
Example #14
Source File: CASImpl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Convert base FS to Pear equivalent
 * 3 cases:
 *   1) no trampoline needed, no conversion, return the original fs
 *   2) trampoline already exists - return that one
 *   3) create new trampoline
 * @param aFs
 * @return
 */
static <T extends FeatureStructure> T pearConvert(T aFs) {
  if (null == aFs) {
    return null;
  }
  final TOP fs = (TOP) aFs;
  final CASImpl view = fs._casView;
  final TypeImpl ti = fs._getTypeImpl();
  final FsGenerator3 generator = view.svd.generators[ti.getCode()];
  if (null == generator) {
    return aFs;
  }
  return (T) view.pearConvert(fs, generator);
}
 
Example #15
Source File: CASImpl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
public Collection<?> collectNonPearVersions(Collection<?> c) {
  if (c.size() == 0 || !inPearContext()) {
    return c;
  }
  ArrayList<Object> items = new ArrayList<>(c.size());
  for (Object o : c) {
    if (o instanceof TOP) {
      items.add(pearConvert((TOP) o));
    }
  }
  return items;
}
 
Example #16
Source File: FsIterator_subtypes_ordered.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Only used to compare two iterator's with different types position
 * @param fsLeft the left iterator's element
 * @param fsRight the right iterator's element
 * @return  1 if left > right,   (compare maybe ignores type)
 *         -1 if left < right,   (compare maybe ignores type)
 *          1 if left == right and left.id > right.id
 *         -1 if left == right and left.id < right.id
 */
private int compare(FeatureStructure fsLeft, FeatureStructure fsRight) {
  int d = comparatorMaybeNoTypeWithoutId.compare((TOP)fsLeft, (TOP)fsRight);

  // If two FSs are identical wrt the comparator of the index,
  // we still need to be able to distinguish them to be able to have a
  // well-defined sequence. In that case, we arbitrarily order FSs by
  // their ids. We need to do this in order to be able to ensure that a
  // reverse iterator produces the reverse order of the forward iterator.
  if (d == 0) {
    d = fsLeft._id() - fsRight._id();
  }
  return d;
}
 
Example #17
Source File: JsonCasSerializer.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeView(Sofa sofa, Collection<TOP> added, Collection<TOP> deleted, Collection<TOP> reindexed) throws IOException {
  jch.writeNlJustBeforeNext();
  jg.writeFieldName(cds.getXmiId(sofa));
  jg.writeStartObject();
  writeViewForDeltas(ADDED_MEMBERS_NAME, added);
  writeViewForDeltas(DELETED_MEMBERS_NAME, deleted);
  writeViewForDeltas(REINDEXED_MEMBERS_NAME, reindexed);      
  jg.writeEndObject();
}
 
Example #18
Source File: FSIndexRepositoryImpl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
private void removeIndexExcludingType(int indexingStrategy, FSIndexComparatorImpl comparatorForIndexSpecs) {
  Iterator<FsIndex_iicp<TOP>> it = indexesForType.iterator();
  while (it.hasNext()) {
    FsIndex_singletype<TOP> singleTypeIndex = it.next().fsIndex_singletype;
    if (singleTypeIndex.getIndexingStrategy() == indexingStrategy) {
      FSIndexComparatorImpl indexComp = singleTypeIndex.getComparatorImplForIndexSpecs();
      if (indexComp.equalsWithoutType(comparatorForIndexSpecs)) {
        it.remove();
        break;
      }
    }
  }
}
 
Example #19
Source File: OrderedFsSet_array2.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * @see Set#contains(Object)
 */
@Override
public boolean contains(Object o) {
  if (o == null) {
    throw new IllegalArgumentException();
  }
  if (isEmpty()) {
    return false;
  }
  TOP fs = (TOP) o;
  processBatch();
  return find(fs) >= 0;
}
 
Example #20
Source File: BinaryCasSerDes6.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * For Serialization only.
 * 
 * Map src FS to tgt seq number:
 *   fs == null -> 0
 *   type not in target -> 0
 *   map src fs._id to tgt seq
 * @param fs
 * @return 0 or the mapped src id
 */
private int getTgtSeqFromSrcFS(TOP fs) {
  if (null == fs) return 0;
  if (isTypeMapping) {
    if (typeMapper.mapTypeSrc2Tgt(fs._getTypeImpl()) == null) {
      return 0;
    }
  }
  int v = fsStartIndexes.getTgtSeqFromSrcAddr(fs._id);
  assert(v != -1); // tgt must always be present at this point
  return v; 
}
 
Example #21
Source File: XmiCasDeserializer.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Update existing array.  The size has already been checked to be equal, but could be 0
 * @param arrayType
 * @param values
 * @param existingArray
 */
private void updateExistingArray(List<String> values, CommonArrayFS existingArray) {
  final int sz = values.size();
  
  if (existingArray instanceof FSArray) {
    final FSArray fsArray = (FSArray) existingArray;
    for (int i = 0; i < sz; i++) {
      
      String featVal = values.get(i);  
      if (emptyVal(featVal)) { // can be empty if JSON
        fsArray.set(i,  null);
      
      } else {
        maybeSetFsArrayElement(values, i, fsArray);
        final int xmiId = Integer.parseInt(featVal);
        final int pos = i;
        TOP tgtFs = maybeGetFsForXmiId(xmiId);
        if (null == tgtFs) {
          fixupToDos.add( () -> finalizeFSArrayRefValue(xmiId, fsArray, pos));
        } else {
          fsArray.set(i,  tgtFs);
        }
      }          
    }
    return;
  }
  
  CommonPrimitiveArray existingPrimitiveArray = (CommonPrimitiveArray) existingArray;
  for (int i = 0; i < sz; i++) {
    existingPrimitiveArray.setArrayValueFromString(i, values.get(i));
  }
}
 
Example #22
Source File: CasCompare.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/** called to sort all the FSs before doing the equality compares */
  private void sort(List<TOP> fss) {
    inSortContext = true;
    // do before sorting
    clearPrevFss();

    try {
      fss.sort((afs1, afs2) -> sortCompare(afs1, afs2));
//            (afs1, afs2) -> Integer.compare(afs1._id, afs2._id));
    } finally {
      inSortContext = false;
    }
  }
 
Example #23
Source File: FSClassRegistry.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
JCasClassInfo(Class<? extends TOP> jcasClass, FsGenerator3 generator, int jcasType) {
      this.generator = generator;
      this.jcasClass = jcasClass;
      this.jcasType = jcasType;    // typeId for jcas class, **NOT Typecode**
      this.features = getJCasClassFeatureInfo(jcasClass);
      
//      System.out.println("debug create jcci, class = " + jcasClass.getName() + ", typeint = " + jcasType);
    }
 
Example #24
Source File: CASImpl.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @return an array of FsChange items, one per modified Fs, 
 *         sorted in order of fs._id
 */
FsChange[] getModifiedFSList() {
  final Map<TOP, FsChange> mods = this.svd.modifiedPreexistingFSs;
 FsChange[] r = mods.values().toArray(new FsChange[mods.size()]);
 Arrays.sort(r, 0, mods.size(), (c1, c2) -> Integer.compare(c1.fs._id, c2.fs._id));
 return r;
}
 
Example #25
Source File: XmiSerializationSharedData.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * For debugging purposes only.
 */
public String toString() {
  StringBuilder buf = new StringBuilder();
  TOP[] keys = getAndSortByIdAllFSsInIdMap();
  for (TOP fs : keys) {
    buf.append(fs._id).append(": ").append(fsToXmiId.get(fs)).append('\n');
  }
  return buf.toString();
}
 
Example #26
Source File: JCasUtilv3Test.java    From uima-uimafit with Apache License 2.0 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testGetNonAnnotationType() {
  String text = "Rot wood cheeses dew?";
  tokenBuilder.buildTokens(jCas, text);

  // There is no alternative in UIMA v3
  getAnnotationType(jCas, TOP.class);
}
 
Example #27
Source File: FsIndex_set_sorted.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
   * 
   */
  @Override
  public boolean deleteFS(T fs) {
    if (((TOP)fs)._getTypeImpl() != this.type) {
      throw new IllegalArgumentException(
          String.format("Wrong type %s passed to deleteFS of index over type %s", 
            ((TOP)fs)._getTypeImpl().getName(), this.type.getName()));
    }
//    maybeProcessBulkAdds(); // moved to OrderedFsSet_array class
    maybeCopy();
    return this.indexedFSs.remove(fs);
  }
 
Example #28
Source File: BinaryCasSerDes6.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Add all the strings ref'd by this FS.
 *   - if it is a string array, do all the array items
 *   - else scan the features and do all string-valued features, in feature offset order
 * For delta, this isn't done here - another routine driven by FsChange info does this.
 */
private void addStringsFromFS(TOP fs) {
  if (fs instanceof StringArray) {
    for (String s : ((StringArray)fs)._getTheArray()) {
      os.add(s);
    }
    return;
  }
  
  for (FeatureImpl fi : fs._getTypeImpl().getFeatureImpls()) {
    if (fi.getRange() instanceof TypeImpl_string) {
      os.add(fs._getStringValueNc(fi));
    }
  }
}
 
Example #29
Source File: JCasHashMapTest.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
public void testMultiThread() throws Exception {
    final Random random = new Random();
    int numberOfThreads = Misc.numberOfCores;    
    System.out.format("test JCasHashMap with up to %d threads%n", numberOfThreads);

    
    for (int th = 2; th <= numberOfThreads; th *=2) {
      JCasHashMap.setDEFAULT_CONCURRENCY_LEVEL(th);
      final JCasHashMap m = new JCasHashMap(200);   
      MultiThreadUtils.Run2isb run2isb = new MultiThreadUtils.Run2isb() {
        
        public void call(int threadNumber, int repeatNumber, StringBuilder sb) {
          for (int k = 0; k < 4; k++) {
            for (int i = 0; i < SIZE / 4; i++) {
              final int key = addrs[random.nextInt(SIZE / 16)];
              m.putIfAbsent(key, x -> TOP._createSearchKey(x));
//              TOP fs = m.getReserve(key);
//              if (null == fs) {
//            
//                m.put(TOP._createSearchKey(key));
//              }
            }
            try {
              Thread.sleep(0, random.nextInt(1000));
            } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
  //        System.out.println(sb.toString());
        }
      };  
      MultiThreadUtils.tstMultiThread("JCasHashMapTest",  numberOfThreads,  10, run2isb,
          new Runnable() {
            public void run() {
              m.clear();
            }});
    }
  }
 
Example #30
Source File: BinaryCasSerDes.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
   * Called 3 times to process non-compressed binary deserialization of aux array modifications
   *   - once for byte/boolean, short, and long/double
   * @return heapsz (used by caller to do word alignment)
   * @throws IOException 
   */
  int updateAuxArrayMods(Reading r, Int2ObjHashMap<TOP, TOP> auxAddr2fsa, 
      Consumer_T_int_withIOException<TOP> setter) throws IOException {
    final int heapsz = r.readInt();
    if (heapsz > 0) {
      final int[] tempHeapAddrs = new int[heapsz];
      final int[] sortedArrayAddrs = auxAddr2fsa.getSortedKeys();
      int sortedArrayAddrsIndex = 0;

      for (int i = 0; i < heapsz; i++) {
        tempHeapAddrs[i] = r.readInt();
      }
      
      for (int i = 0; i < heapsz; i++) {
        sortedArrayAddrsIndex = getSortedArrayAddrsIndex(sortedArrayAddrs, tempHeapAddrs[i], sortedArrayAddrsIndex);
        final int arrayStart = sortedArrayAddrs[sortedArrayAddrsIndex];
        TOP fs = auxAddr2fsa.get(arrayStart);
        final int arrayIndex = tempHeapAddrs[i] - arrayStart;
        setter.accept(fs, arrayIndex);
//         EXAMPLE of setter:
//        if (la instanceof LongArray) {
//          ((LongArray)la).set(arrayIndex, r.readLong());
//        } else {
//          ((DoubleArray)la).set(arrayIndex, CASImpl.long2double(r.readLong()));
//        }
      }
    }    
    return heapsz;
  }