Package org.apache.uima.internal.util

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


      int lvi = this.indexes.length - 1;
      // Need to consider all iterators.
      // Set all iterators to insertion point.
      int i=0;
      while (i<=lvi) {
        final ComparableIntPointerIterator it = this.indexes[i];
        it.resetConcurrentModification();
        it.moveToFirst();
        if (it.isValid()) {
          heapify_up(it, i, 1);
          ++i;
        } else {
          // swap this iterator with the last possibly valid one
          // lvi might be equal to i, this will not be a problem
View Full Code Here


      int lvi = this.indexes.length - 1;
      // Need to consider all iterators.
      // Set all iterators to insertion point.
      int i=0;
      while (i<=lvi) {
        final ComparableIntPointerIterator it = this.indexes[i];
        it.resetConcurrentModification();
        it.moveToLast();
        if (it.isValid()) {
          heapify_up(it, i, -1);
          ++i;
        } else {
          // swap this iterator with the last possibly valid one
          // lvi might be equal to i, this will not be a problem
View Full Code Here

    public void moveToNext() {
      if (!isValid()) {
        return;
      }

      final ComparableIntPointerIterator it0 = checkConcurrentModification(0);

      if (this.wentForward) {
        it0.inc();
        heapify_down(it0, 1);
      } else {
        // We need to increment everything.
        int lvi = this.indexes.length - 1;
        int i=1;
        while (i<=lvi) {
          // Any iterator other than the current one needs to be
          // incremented until it's pointing at something that's
          // greater than the current element.
          final ComparableIntPointerIterator it = checkConcurrentModification(i);
          // If the iterator we're considering is not valid, we
          // set it to the first element. This should be it for this iterator...
          if (!it.isValid()) {
            it.moveToFirst();
          }
          // Increment the iterator while it is valid and pointing
          // at something smaller than the current element.
          while (it.isValid() && is_before(it, it0, 1)) {
            it.inc();
          }

          // find placement
          if (it.isValid()) {
            heapify_up(it, i, 1);
            ++i;
          } else {
            // swap this iterator with the last possibly valid one
            // lvi might be equal to i, this will not be a problem
View Full Code Here

    public void moveToPrevious() {
      if (!isValid()) {
        return;
      }

      final ComparableIntPointerIterator it0 = checkConcurrentModification(0);
      if (!this.wentForward) {
        it0.dec();
        // this also takes care of invalid iterators
        heapify_down(it0, -1);
      } else {
        // We need to decrement everything.
        int lvi = this.indexes.length - 1;
        int i=1;
        while (i<=lvi) {
          // Any iterator other than the current one needs to be
          // decremented until it's pointing at something that's
          // smaller than the current element.
          final ComparableIntPointerIterator it = checkConcurrentModification(i);
          // If the iterator we're considering is not valid, we
          // set it to the last element. This should be it for this iterator...
          if (!it.isValid()) {
            it.moveToLast();
          }
          // Decrement the iterator while it is valid and pointing
          // at something greater than the current element.
          while (it.isValid() && is_before(it, it0, -1)) {
            it.dec();
          }

          // find placement
          if (it.isValid()) {
            heapify_up(it, i, -1);
            ++i;
          } else {
            // swap this iterator with the last possibly valid one
            // lvi might be equal to i, this will not be a problem
View Full Code Here

      int lvi = this.indexes.length - 1;
      // Need to consider all iterators.
      // Set all iterators to insertion point.
      int i=0;
      while (i<=lvi) {
        final ComparableIntPointerIterator it = this.indexes[i];
        it.resetConcurrentModification();
        it.moveTo(fs);
        if (it.isValid()) {
          heapify_up(it, i, 1);
          ++i;
        } else {
          // swap this iterator with the last possibly valid one
          // lvi might be equal to i, this will not be a problem
View Full Code Here

      ArrayList iteratorCache = iicp0.iteratorCache;
      this.indexesSize = iteratorCache.size();
      this.indexes = new ComparableIntPointerIterator[this.indexesSize];
      this.numIndexes = this.indexesSize;
      this.iteratorComparator = new IteratorComparator((FSLeafIndexImpl) iteratorCache.get(0));
      ComparableIntPointerIterator it;
      for (int i = 0; i < this.indexesSize; i++) {
        final FSLeafIndexImpl leafIndex = ((FSLeafIndexImpl) iteratorCache.get(i));
        it = leafIndex.pointerIterator(this.iteratorComparator,
            FSIndexRepositoryImpl.this.detectIllegalIndexUpdates, ((TypeImpl) leafIndex.getType())
                .getCode());
View Full Code Here

      // We're valid as long as at least one index is.
      return (this.numIndexes > 0);
    }

    private ComparableIntPointerIterator checkConcurrentModification(int i) {
      ComparableIntPointerIterator cipi = this.indexes[i];
      if (cipi.isConcurrentModification())
        throw new ConcurrentModificationException();
      return cipi;
    }
View Full Code Here

        throw new ConcurrentModificationException();
      return cipi;
    }

    private void resetConcurrentModification(int i) {
      ComparableIntPointerIterator cipi = this.indexes[i];
      cipi.resetConcurrentModification();
    }
View Full Code Here

        } else {
          // Else we shrink the array and swap the previously last
          // element to
          // the position where we want to delete the index.
          --this.numIndexes;
          ComparableIntPointerIterator tempIt = this.indexes[index];
          this.indexes[index] = this.indexes[this.numIndexes];
          this.indexes[this.numIndexes] = tempIt;
        }
      }
    }
View Full Code Here

        // Make sure it's still valid.
        ensureIndexValidity(this.currentIndex);
      } else {
        // Else we need to increment everything, including the currently
        // inactive indexes!
        ComparableIntPointerIterator it;
        for (int i = 0; i < this.indexesSize; i++) {
          // Any iterator other than the current one needs to be
          // incremented
          // until it's pointing at something that's greater than the
          // current
          // element.
          if (i != this.currentIndex) {
            it = this.indexes[i];
            // If the iterator we're considering is not valid, we
            // set it to the
            // first element. This should be it for this iterator...
            if (!it.isValid()) {
              it.moveToFirst();
            }
            // while (it.isValid() &&
            // (it.compareTo(indexes[this.currentIndex]) < 0)) {
            // Increment the iterator while it is valid and pointing
            // at something
            // smaller than the current element.
            while (it.isValid()
                && (this.iteratorComparator
                    .compare(it.get(), this.indexes[this.currentIndex].get()) < 0)) {
              it.inc();
            }
          }
        }
        // Increment the current index.
        this.indexes[this.currentIndex].inc();
View Full Code Here

TOP

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

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.