All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.nlp.util.Heap Maven / Gradle / Ivy

Go to download

Stanford CoreNLP provides a set of natural language analysis tools which can take raw English language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, mark up the structure of sentences in terms of phrases and word dependencies, and indicate which noun phrases refer to the same entities. It provides the foundational building blocks for higher level text understanding applications.

There is a newer version: 4.5.7
Show newest version
package edu.stanford.nlp.util;

import java.util.Iterator;

/**
 * Heap interface.
 * These heaps implement a decreaseKey operation, which requires
 * a separate Object to Index map, and for objects to be unique in the Heap.
 * 

* An interface cannot specify constructors, but it is nevertheless * expected that an implementation of this interface has a constructor * that takes a Comparator, which is used for ordering ("scoring") * objects: * public Heap(Comparator cmp) {} * * @author Dan Klein * @version 12/14/00 */ public interface Heap { /** * Returns the minimum object, then removes that object from the heap. * * @return the minimum object */ public E extractMin(); /** * Returns the minimum Object in this heap. The heap is not modified. * * @return the minimum object */ public E min(); /** * Adds the object to the heap. If the object is in the heap, this * should act as a decrease-key (if the new version has better * priority) or a no-op (otherwise). * * @param o a new element * @return true, always */ public boolean add(E o); /** * The number of elements currently in the heap. * * @return the heap's size */ public int size(); /** * Returns true iff the heap is empty. * * @return a boolean value */ public boolean isEmpty(); /** * Raises the priority of an object in the heap. This works in a * somewhat unusual way -- the object o should have * changed with respect to the comparator passed in to the heap on * construction. However, it should NOT have changed with respect * to its equals() method. This is unlike the Java SortedSet where * the comparator should be consistent with equals(); here they * should not match. * * @param o an Object value which has changed wrt the heap's ordering * @return the cost of the decrease-key operation, for analysis */ public int decreaseKey(E o); // should be void; int for analysis /** * Returns an iterator over its elements, in order. * * @return an Iterator value */ public Iterator iterator(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy