congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
PriorityBuffer.percolateUpMinHeap
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: commons-collections/commons-collections

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: wildfly/wildfly

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: commons-collections/commons-collections

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: wildfly/wildfly

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: commons-collections/commons-collections

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
origin: wildfly/wildfly

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: org.apache.openjpa/openjpa-all

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assumes it is a minimum heap.
 *
 * @param element the element
 */
protected void percolateUpMinHeap(final Object element) {
  elements[++size] = element;
  percolateUpMinHeap(size);
}
origin: org.apache.openjpa/openjpa-all

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Adds an element to the buffer.
 * <p>
 * The element added will be sorted according to the comparator in use.
 *
 * @param element  the element to be added
 * @return true always
 */
public boolean add(Object element) {
  if (isAtCapacity()) {
    grow();
  }
  // percolate element to it's place in tree
  if (ascendingOrder) {
    percolateUpMinHeap(element);
  } else {
    percolateUpMaxHeap(element);
  }
  return true;
}
origin: org.apache.directory.api/api-ldap-client-all

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
origin: com.alibaba.citrus.tool/antx-autoexpand

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
origin: org.apache.openjpa/openjpa-all

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

public void remove() {
  if (lastReturnedIndex == -1) {
    throw new IllegalStateException();
  }
  elements[ lastReturnedIndex ] = elements[ size ];
  elements[ size ] = null;
  size--;  
  if( size != 0 && lastReturnedIndex <= size) {
    int compareToParent = 0;
    if (lastReturnedIndex > 1) {
      compareToParent = compare(elements[lastReturnedIndex], 
        elements[lastReturnedIndex / 2]);  
    }
    if (ascendingOrder) {
      if (lastReturnedIndex > 1 && compareToParent < 0) {
        percolateUpMinHeap(lastReturnedIndex); 
      } else {
        percolateDownMinHeap(lastReturnedIndex);
      }
    } else {  // max heap
      if (lastReturnedIndex > 1 && compareToParent > 0) {
        percolateUpMaxHeap(lastReturnedIndex); 
      } else {
        percolateDownMaxHeap(lastReturnedIndex);
      }
    }          
  }
  index--;
  lastReturnedIndex = -1; 
}
org.apache.commons.collections.bufferPriorityBufferpercolateUpMinHeap

Javadoc

Percolates element up heap from the position given by the index.

Assumes it is a minimum heap.

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.
  • <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
  • size
    Returns the number of elements in this buffer.
  • remove,
  • size,
  • contains,
  • iterator

Popular in Java

  • Finding current android device location
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • JPanel (javax.swing)
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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