Class Id2FS

java.lang.Object
org.apache.uima.cas.impl.Id2FS
All Implemented Interfaces:
Iterable<TOP>

public class Id2FS extends Object implements Iterable<TOP>
A map from ints representing FS id's (or "addresses") to those FSs There is one map instance per CAS (all views). The map is not populated, normally. It is only populated when there is a need to be able to map from the id to the FS, or to prevent the FS from being GC'd -- The low level CAS apis for creating FSs have this need, because they return the id, and this won't prevent the FS from being GC'd. Removes not supported; they happen when the map is reset / cleared This corresponds to the v2 property of "once created, a FS cannot be reclaimed (until reset)" Threading: to support read-only views, concurrent with updates, needs to be thread safe
  • Field Details

  • Constructor Details

    • Id2FS

      public Id2FS(int initialHeapSize)
  • Method Details

    • maybeReport

      private void maybeReport()
    • put

      void put(int id, TOP fs)
      put but assert wasn't there before
    • putUnconditionally

      void putUnconditionally(TOP fs)
      Skips the assert that the item wasn't already present
      Parameters:
      fs - the fs to add
    • putChange

      void putChange(int id, TOP fs)
      make an id map to an fs, asserting there was a previous mapping for this id
      Parameters:
      id - -
      fs - -
    • put

      void put(TOP fs)
    • get

      TOP get(int id)
    • size

      int size()
    • clear

      void clear()
      adjusts the underlying array down in size if grew beyond the reset heap size value
    • traceWeakGets

      void traceWeakGets()
    • trace

    • dumpCallers

      private static void dumpCallers(String title, Map<Id2FS.MeasureCaller,Id2FS.MeasureCaller> map)
    • iterator

      public IteratorNvc<TOP> iterator()
      Specified by:
      iterator in interface Iterable<TOP>