Package org.apache.commons.collections.buffer

Examples of org.apache.commons.collections.buffer.PriorityBuffer


    }
    return true;
  }
 
  public synchronized boolean seek(WritableComparable key) throws IOException {
    PriorityBuffer reheap = new PriorityBuffer(heap.size());
    boolean result = false;
    for (Object obj : heap) {
      Index index = (Index) obj;
      try {
        WritableComparable found = index.reader.getClosest(key, index.value, true);
        if (found != null && found.equals(key)) {
          result = true;
        }
      } catch (EOFException ex) {
        // thrown if key is beyond all data in the map
      }
      index.cached = false;
      reheap.add(index);
    }
    heap = reheap;
    return result;
  }
View Full Code Here


    }
    return true;
  }
 
  public synchronized boolean seek(WritableComparable key) throws IOException {
    PriorityBuffer reheap = new PriorityBuffer(heap.size());
    boolean result = false;
    for (Object obj : heap) {
      Index index = (Index) obj;
      try {
        WritableComparable found = index.reader.getClosest(key, index.value, true);
        if (found != null && found.compareTo(key) == 0) {
          result = true;
        }
      } catch (EOFException ex) {
        // thrown if key is beyond all data in the map
      }
      index.cached = false;
      reheap.add(index);
    }
    heap = reheap;
    return result;
  }
View Full Code Here

 
  protected void createHeap(int maxSize) {
    if (heap != null)
      throw new IllegalStateException("heap already exist");
   
    heap = new PriorityBuffer(maxSize == 0 ? 1 : maxSize);
  }
View Full Code Here

    }
    return true;
  }
 
  public synchronized boolean seek(WritableComparable key) throws IOException {
    PriorityBuffer reheap = new PriorityBuffer(heap.size());
    boolean result = false;
    for (Object obj : heap) {
      Index index = (Index) obj;
      try {
        WritableComparable found = index.reader.getClosest(key, index.value, true);
        if (found != null && found.equals(key)) {
          result = true;
        }
      } catch (EOFException ex) {
        // thrown if key is beyond all data in the map
      }
      index.cached = false;
      reheap.add(index);
    }
    heap = reheap;
    return result;
  }
View Full Code Here

 
  protected void createHeap(int maxSize) {
    if (heap != null)
      throw new IllegalStateException("heap already exist");
   
    heap = new PriorityBuffer(maxSize == 0 ? 1 : maxSize);
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.buffer.PriorityBuffer

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.