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

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

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

origin: commons-collections/commons-collections

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
origin: wildfly/wildfly

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
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.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
origin: org.apache.openjpa/openjpa-all

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
origin: org.apache.directory.api/api-ldap-client-all

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
origin: org.jboss.eap/wildfly-client-all

/**
 * Gets and removes the next element (pop).
 *
 * @return the next element
 * @throws BufferUnderflowException if the buffer is empty
 */
public Object remove() {
  final Object result = get();
  elements[1] = elements[size--];
  // set the unused element to 'null' so that the garbage collector
  // can free the object if not used anywhere else.(remove reference)
  elements[size + 1] = null;
  if (size != 0) {
    // percolate top element to it's place in tree
    if (ascendingOrder) {
      percolateDownMinHeap(1);
    } else {
      percolateDownMaxHeap(1);
    }
  }
  return result;
}
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.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: 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; 
}
origin: org.jboss.eap/wildfly-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; 
}
org.apache.commons.collections.bufferPriorityBufferpercolateDownMinHeap

Javadoc

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

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • findViewById (Activity)
  • requestLocationUpdates (LocationManager)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Permission (java.security)
    Legacy security code; do not use.
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Collectors (java.util.stream)
  • JLabel (javax.swing)
  • Github Copilot alternatives
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