Logo Search packages:      
Sourcecode: uimaj version File versions  Download package

LowLevelIteratorWrapper.java

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.uima.cas.impl;

import java.util.NoSuchElementException;

import org.apache.uima.internal.util.IntPointerIterator;

/**
 * Implements the LowLevelIterator interface.
 * 
 */
00030 class LowLevelIteratorWrapper implements LowLevelIterator {

  private final IntPointerIterator it;

  private final LowLevelIndex index;

  LowLevelIteratorWrapper(IntPointerIterator it, LowLevelIndex index) {
    super();
    this.it = it;
    this.index = index;
  }

00042   public final void moveToFirst() {
    this.it.moveToFirst();
  }

00046   public final void moveToLast() {
    this.it.moveToLast();
  }

00050   public final boolean isValid() {
    return this.it.isValid();
  }

00054   public final int ll_get() throws NoSuchElementException {
    return this.it.get();
  }

00058   public void moveToNext() {
    this.it.inc();
  }

00062   public void moveToPrevious() {
    this.it.dec();
  }

00066   public void moveTo(int fsRef) {
    this.it.moveTo(fsRef);
  }

00070   public Object copy() {
    return this.it.copy();
  }

00074   public int ll_indexSize() {
    // TODO: make this more efficient
    if (!this.isValid()) {
      return 0;
    }
    IntPointerIterator count = (IntPointerIterator) this.it.copy();
    count.moveToFirst();
    int size = 0;
    while (count.isValid()) {
      ++size;
      count.inc();
    }
    return size;
  }

00089   public LowLevelIndex ll_getIndex() {
    return this.index;
  }

}

Generated by  Doxygen 1.6.0   Back to index