Package org.apache.uima.internal.util

Examples of org.apache.uima.internal.util.SortedIntSet


    this.initHeap();
  }

  private final void initHeap() {
    this.heap = new int[0];
    this.availablePages = new SortedIntSet();
    this.tempPages = new SortedIntSet();
    // System.out.println("Creating first temp page.");
    newTempPage();
    // System.out.println("Creating first perm page.");
    // newPermPage();
  }
View Full Code Here


    // Copy the shortened version of the heap into a full version.
    this.heap = new int[heapSize];
    System.arraycopy(shortHeap, 0, this.heap, 0, shortHeap.length);

    final int avMax = AVST_POS + md[AVSZ_POS];
    this.availablePages = new SortedIntSet();
    // assert(avMax <= md.length);
    for (int i = AVST_POS; i < avMax; i++) {
      this.availablePages.add(md[i]);
    }
    this.tempPages = new SortedIntSet();
    for (int i = avMax; i < md.length; i++) {
      this.tempPages.add(md[i]);
    }
  }
View Full Code Here

   *
   * @param shortHeap
   */
  private void reinitNoMetaData(int[] shortHeap) {
    this.PAGE_SIZE = (shortHeap.length < MIN_PAGE_SIZE) ? MIN_PAGE_SIZE : shortHeap.length;
    this.availablePages = new SortedIntSet();
    this.tempPages = new SortedIntSet();
    if (shortHeap.length >= this.PAGE_SIZE) {
      this.heap = shortHeap;
    } else {
      System.arraycopy(shortHeap, 0, this.heap, 0, shortHeap.length);
    }
View Full Code Here

   *
   * @param newSize
   */
  void reinitSizeOnly(int newSize) {
    this.PAGE_SIZE = (newSize < MIN_PAGE_SIZE) ? MIN_PAGE_SIZE : newSize;
    this.availablePages = new SortedIntSet();
    this.tempPages = new SortedIntSet();
    this.heap = new int[this.PAGE_SIZE];
    this.tempPages.add(0);
    // Add the rest of the heap as available pages.
    int nextPageEnd = this.PAGE_SIZE * 2;
    // int nextPageStart = PAGE_SIZE;
View Full Code Here

    IndexIteratorCachePair iicp;
    IntPointerIterator it;
    ArrayList<IndexIteratorCachePair> iv, cv;
    // We may need to profile this. If this is a bottleneck, use a different
    // implementation.
    SortedIntSet set;
    int jMax, indStrat;
    // Iterate over indexes with something in there
    for (int i = 0; i < this.usedIndexes.size(); i++) {
      iv = this.indexArray[this.usedIndexes.get(i)];
      // Iterate over the indexes for the type.
      jMax = iv.size();
      // Create a vector of IICPs. If there is at least one sorted or bag
      // index, pick one arbitrarily and add its FSs (since it contains all
      // FSs that all other indexes for the same type contain). If there are
      // only set indexes, create a set of the FSs in those indexes, since they
      // may all contain different elements (different FSs that have the same "key"
      //   are duplicates for one index, but may not be duplicates for a different one).
      cv = new ArrayList<IndexIteratorCachePair>();
      for (int j = 0; j < jMax; j++) {
        iicp = iv.get(j);
        indStrat = iicp.index.getIndexingStrategy();
        if (indStrat == FSIndex.SET_INDEX) {
          cv.add(iicp);
        } else {
          cv.clear()// only need to save this one
          cv.add(iicp);
          break;
        }
      }
      if (cv.size() > 0) {
        // Note: This next loop removes duplicates (and also sorts
        // the fs addrs associated with one type)
        // Duplicates arise from having mulitple sets combined, and
        // also if a non-set index had the same identical FS added
        // multiple times.
        set = new SortedIntSet();
        for (int k = 0; k < cv.size(); k++) {
          it = cv.get(k).index.refIterator();
          while (it.isValid()) {
            set.add(it.get());
            it.inc();
          }
        }
        v.add(set.getArray(), 0, set.size())// bulk add of all elements
//        for (int k = 0; k < set.size(); k++) {
//          v.add(set.get(k));
//        }
      }
    }
View Full Code Here

    IndexIteratorCachePair iicp;
    IntPointerIterator it;
    ArrayList<IndexIteratorCachePair> iv, cv;
    // We may need to profile this. If this is a bottleneck, use a different
    // implementation.
    SortedIntSet set;
    int jMax, indStrat;
    // Iterate over indexes with something in there
    for (int i = 0; i < this.usedIndexes.size(); i++) {
      iv = this.indexArray[this.usedIndexes.get(i)];
      // Iterate over the indexes for the type.
      jMax = iv.size();
      // Create a vector of IICPs. If there is at least one sorted or bag
      // index, pick one arbitrarily and add its FSs (since it contains all
      // FSs that all other indexes for the same type contain). If there are
      // only set indexes, create a set of the FSs in those indexes, since they
      // may all contain different elements (FSs that are duplicates for one
      // index may not be duplicates for a different one).
      cv = new ArrayList<IndexIteratorCachePair>();
      for (int j = 0; j < jMax; j++) {
        iicp = iv.get(j);
        indStrat = iicp.index.getIndexingStrategy();
        if (indStrat == FSIndex.SET_INDEX) {
          cv.add(iicp);
        } else {
          if (cv.size() > 0) {
            cv = new ArrayList<IndexIteratorCachePair>();
          }
          cv.add(iicp);
          break;
        }
      }
      if (cv.size() > 0) {
        set = new SortedIntSet();
        for (int k = 0; k < cv.size(); k++) {
          it = cv.get(k).index.refIterator();
          while (it.isValid()) {
            set.add(it.get());
            it.inc();
          }
        }
        for (int k = 0; k < set.size(); k++) {
          v.add(set.get(k));
        }
      }
    }
    return v.toArray();
  }
View Full Code Here

    IndexIteratorCachePair iicp;
    IntPointerIterator it;
    ArrayList<IndexIteratorCachePair> iv, cv;
    // We may need to profile this. If this is a bottleneck, use a different
    // implementation.
    SortedIntSet set;
    int jMax, indStrat;
    // Iterate over indexes with something in there
    for (int i = 0; i < this.usedIndexes.size(); i++) {
      iv = this.indexArray[this.usedIndexes.get(i)];
      // Iterate over the indexes for the type.
      jMax = iv.size();
      // Create a vector of IICPs. If there is at least one sorted or bag
      // index, pick one arbitrarily and add its FSs (since it contains all
      // FSs that all other indexes for the same type contain). If there are
      // only set indexes, create a set of the FSs in those indexes, since they
      // may all contain different elements (FSs that are duplicates for one
      // index may not be duplicates for a different one).
      cv = new ArrayList<IndexIteratorCachePair>();
      for (int j = 0; j < jMax; j++) {
        iicp = iv.get(j);
        indStrat = iicp.index.getIndexingStrategy();
        if (indStrat == FSIndex.SET_INDEX) {
          cv.add(iicp);
        } else {
          if (cv.size() > 0) {
            cv = new ArrayList<IndexIteratorCachePair>();
          }
          cv.add(iicp);
          break;
        }
      }
      if (cv.size() > 0) {
        set = new SortedIntSet();
        for (int k = 0; k < cv.size(); k++) {
          it = cv.get(k).index.refIterator();
          while (it.isValid()) {
            set.add(it.get());
            it.inc();
          }
        }
        for (int k = 0; k < set.size(); k++) {
          v.add(set.get(k));
        }
      }
    }
    return v.toArray();
  }
View Full Code Here

    IndexIteratorCachePair iicp;
    IntPointerIterator it;
    ArrayList iv, cv;
    // We may need to profile this. If this is a bottleneck, use a different
    // implementation.
    SortedIntSet set;
    int jMax, indStrat;
    // Iterate over all types.
    for (int i = 0; i < this.indexArray.length; i++) {
      iv = this.indexArray[i];
      if (iv == null) {
        // The 0 position is the only one that should be null.
        continue;
      }
      // Iterate over the indexes for the type.
      jMax = iv.size();
      // Create a vector of IICPs. If there is at least one sorted or bag
      // index, pick one arbitrarily and add its FSs (since it contains all
      // FSs that all other indexes for the same type contain). If there are
      // only set indexes, create a set of the FSs in those indexes, since they
      // may all contain different elements (FSs that are duplicates for one
      // index may not be duplicates for a different one).
      cv = new ArrayList();
      for (int j = 0; j < jMax; j++) {
        iicp = (IndexIteratorCachePair) iv.get(j);
        indStrat = iicp.index.getIndexingStrategy();
        if (indStrat == FSIndex.SET_INDEX) {
          cv.add(iicp);
        } else {
          if (cv.size() > 0) {
            cv = new ArrayList();
          }
          cv.add(iicp);
          break;
        }
      }
      if (cv.size() > 0) {
        set = new SortedIntSet();
        for (int k = 0; k < cv.size(); k++) {
          it = ((IndexIteratorCachePair) cv.get(k)).index.refIterator();
          while (it.isValid()) {
            set.add(it.get());
            it.inc();
          }
        }
        for (int k = 0; k < set.size(); k++) {
          v.add(set.get(k));
        }
      }
    }
    return v.toArray();
  }
View Full Code Here

    this.initHeap();
  }

  private final void initHeap() {
    this.heap = new int[0];
    this.availablePages = new SortedIntSet();
    this.tempPages = new SortedIntSet();
    // System.out.println("Creating first temp page.");
    newTempPage();
    // System.out.println("Creating first perm page.");
    // newPermPage();
  }
View Full Code Here

    // Copy the shortened version of the heap into a full version.
    this.heap = new int[heapSize];
    System.arraycopy(shortHeap, 0, this.heap, 0, shortHeap.length);

    final int avMax = AVST_POS + md[AVSZ_POS];
    this.availablePages = new SortedIntSet();
    // assert(avMax <= md.length);
    for (int i = AVST_POS; i < avMax; i++) {
      this.availablePages.add(md[i]);
    }
    this.tempPages = new SortedIntSet();
    for (int i = avMax; i < md.length; i++) {
      this.tempPages.add(md[i]);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.internal.util.SortedIntSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.