Tabnine Logo
PriorityBuffer.size
Code IndexAdd Tabnine to your IDE (free)

How to use
size
method
in
org.apache.commons.collections.buffer.PriorityBuffer

Best Java code snippets using org.apache.commons.collections.buffer.PriorityBuffer.size (Showing top 5 results out of 315)

origin: commons-collections/commons-collections

/**
 * Returns a string showing the contents of the heap formatted as a tree.
 * Makes no attempt at padding levels or handling wrapping. 
 */
protected String showTree(PriorityBuffer h) {
  int count = 1;
  StringBuffer buffer = new StringBuffer();
  for (int offset = 1; count < h.size() + 1; offset *= 2) {
    for (int i = offset; i < offset * 2; i++) {
      if (i < h.elements.length && h.elements[i] != null) 
        buffer.append(h.elements[i] + " ");
      count++;
    }
    buffer.append('\n');
  }
  return buffer.toString();
}
origin: commons-collections/commons-collections

  h.add(new Integer(randGenerator.nextInt(heapSize)));
assertTrue(h.size() == heapSize);
PriorityBuffer h1 = serializeAndRestore(h);
assertTrue(h1.size() == heapSize);
Iterator hit = h.iterator();
while (hit.hasNext()) {
origin: apache/accumulo

@VisibleForTesting
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;
}
origin: org.apache.accumulo/accumulo-tserver

@VisibleForTesting
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;
}
origin: org.apache.accumulo/accumulo-server

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;
}
org.apache.commons.collections.bufferPriorityBuffersize

Javadoc

The number of elements currently in this buffer.

Popular methods of PriorityBuffer

  • get
    Gets the next element to be removed without actually removing it (peek).
  • isEmpty
  • compare
    Compares two objects using the comparator if specified, or the natural order otherwise.
  • grow
    Increases the size of the heap to support additional elements
  • isAtCapacity
    Tests if the buffer is at capacity.
  • percolateDownMaxHeap
    Percolates element down heap from the position given by the index. Assumes it is a maximum heap.
  • percolateDownMinHeap
    Percolates element down heap from the position given by the index. Assumes it is a minimum heap.
  • percolateUpMaxHeap
    Percolates a new element up heap from the bottom. Assume it is a maximum heap.
  • percolateUpMinHeap
    Percolates a new element up heap from the bottom. Assumes it is a minimum heap.
  • <init>
    Constructs a new empty buffer specifying the sort order and comparator.
  • add
    Adds an element to the buffer. The element added will be sorted according to the comparator in use.
  • remove
  • add,
  • remove,
  • contains,
  • iterator

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Permission (java.security)
    Legacy security code; do not use.
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now