congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
PriorityBuffer.percolateUpMaxHeap
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: commons-collections/commons-collections

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

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assume it is a maximum heap.
 *
 * @param element the element
 */
protected void percolateUpMaxHeap(final Object element) {
  elements[++size] = element;
  percolateUpMaxHeap(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: com.alibaba.citrus.tool/antx-autoexpand

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

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

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assume it is a maximum heap.
 *
 * @param element the element
 */
protected void percolateUpMaxHeap(final Object element) {
  elements[++size] = element;
  percolateUpMaxHeap(size);
}
origin: org.apache.directory.api/api-ldap-client-all

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

/**
 * Percolates a new element up heap from the bottom.
 * <p>
 * Assume it is a maximum heap.
 *
 * @param element the element
 */
protected void percolateUpMaxHeap(final Object element) {
  elements[++size] = element;
  percolateUpMaxHeap(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.bufferPriorityBufferpercolateUpMaxHeap

Javadoc

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

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top Sublime Text plugins
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