/javadoc/edu/stanford/nlp/util/Heap.html
HTML | 366 lines | 303 code | 43 blank | 20 comment | 0 complexity | 805a7ffd3f72e04575d5bd6d9397912f MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!--NewPage-->
- <HTML>
- <HEAD>
- <!-- Generated by javadoc (build 1.6.0_07) on Fri Jan 16 20:00:56 PST 2009 -->
- <TITLE>
- Heap (Stanford JavaNLP API)
- </TITLE>
- <META NAME="date" CONTENT="2009-01-16">
- <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
- <SCRIPT type="text/javascript">
- function windowTitle()
- {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="Heap (Stanford JavaNLP API)";
- }
- }
- </SCRIPT>
- <NOSCRIPT>
- </NOSCRIPT>
- </HEAD>
- <BODY BGCOLOR="white" onload="windowTitle();">
- <HR>
- <!-- ========= START OF TOP NAVBAR ======= -->
- <A NAME="navbar_top"><!-- --></A>
- <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_top_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../edu/stanford/nlp/util/HasIntegerIdentity.html" title="interface in edu.stanford.nlp.util"><B>PREV CLASS</B></A>
- <A HREF="../../../../edu/stanford/nlp/util/Index.html" title="class in edu.stanford.nlp.util"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../index.html?edu/stanford/nlp/util/Heap.html" target="_top"><B>FRAMES</B></A>
- <A HREF="Heap.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_top"></A>
- <!-- ========= END OF TOP NAVBAR ========= -->
- <HR>
- <!-- ======== START OF CLASS DATA ======== -->
- <H2>
- <FONT SIZE="-1">
- edu.stanford.nlp.util</FONT>
- <BR>
- Interface Heap<E></H2>
- <DL>
- <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../edu/stanford/nlp/util/ArrayHeap.html" title="class in edu.stanford.nlp.util">ArrayHeap</A></DD>
- </DL>
- <HR>
- <DL>
- <DT><PRE>public interface <B>Heap<E></B></DL>
- </PRE>
- <P>
- 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.
- <p/>
- 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:
- <code>public Heap(Comparator cmp) {}</code>
- <P>
- <P>
- <DL>
- <DT><B>Author:</B></DT>
- <DD>Dan Klein</DD>
- </DL>
- <HR>
- <P>
- <!-- ========== METHOD SUMMARY =========== -->
- <A NAME="method_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Method Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> boolean</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#add(E)">add</A></B>(<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> o)</CODE>
- <BR>
- Adds the object to the heap.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> int</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#decreaseKey(E)">decreaseKey</A></B>(<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> o)</CODE>
- <BR>
- Raises the priority of an object in the heap.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> <A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#extractMin()">extractMin</A></B>()</CODE>
- <BR>
- Returns the minimum object, then removes that object from the heap.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> boolean</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#isEmpty()">isEmpty</A></B>()</CODE>
- <BR>
- Returns true iff the heap is empty.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A>></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#iterator()">iterator</A></B>()</CODE>
- <BR>
- Returns an iterator over its elements, in order.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> <A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A></CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#min()">min</A></B>()</CODE>
- <BR>
- Returns the minimum Object in this heap.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> int</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../../../edu/stanford/nlp/util/Heap.html#size()">size</A></B>()</CODE>
- <BR>
- The number of elements currently in the heap.</TD>
- </TR>
- </TABLE>
-
- <P>
- <!-- ============ METHOD DETAIL ========== -->
- <A NAME="method_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Method Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="extractMin()"><!-- --></A><H3>
- extractMin</H3>
- <PRE>
- <A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> <B>extractMin</B>()</PRE>
- <DL>
- <DD>Returns the minimum object, then removes that object from the heap.
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>the minimum object</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="min()"><!-- --></A><H3>
- min</H3>
- <PRE>
- <A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> <B>min</B>()</PRE>
- <DL>
- <DD>Returns the minimum Object in this heap. The heap is not modified.
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>the minimum object</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="add(java.lang.Object)"><!-- --></A><A NAME="add(E)"><!-- --></A><H3>
- add</H3>
- <PRE>
- boolean <B>add</B>(<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> o)</PRE>
- <DL>
- <DD>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).
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>o</CODE> - a new element
- <DT><B>Returns:</B><DD>true, always</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="size()"><!-- --></A><H3>
- size</H3>
- <PRE>
- int <B>size</B>()</PRE>
- <DL>
- <DD>The number of elements currently in the heap.
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>the heap's size</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="isEmpty()"><!-- --></A><H3>
- isEmpty</H3>
- <PRE>
- boolean <B>isEmpty</B>()</PRE>
- <DL>
- <DD>Returns true iff the heap is empty.
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>a <code>boolean</code> value</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="decreaseKey(java.lang.Object)"><!-- --></A><A NAME="decreaseKey(E)"><!-- --></A><H3>
- decreaseKey</H3>
- <PRE>
- int <B>decreaseKey</B>(<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A> o)</PRE>
- <DL>
- <DD>Raises the priority of an object in the heap. This works in a
- somewhat unusual way -- the object <code>o</code> 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.
- <P>
- <DD><DL>
- <DT><B>Parameters:</B><DD><CODE>o</CODE> - an <code>Object</code> value which has changed wrt the heap's ordering
- <DT><B>Returns:</B><DD>the cost of the decrease-key operation, for analysis</DL>
- </DD>
- </DL>
- <HR>
- <A NAME="iterator()"><!-- --></A><H3>
- iterator</H3>
- <PRE>
- <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><<A HREF="../../../../edu/stanford/nlp/util/Heap.html" title="type parameter in Heap">E</A>> <B>iterator</B>()</PRE>
- <DL>
- <DD>Returns an iterator over its elements, in order.
- <P>
- <DD><DL>
- <DT><B>Returns:</B><DD>an <code>Iterator</code> value</DL>
- </DD>
- </DL>
- <!-- ========= END OF CLASS DATA ========= -->
- <HR>
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <A NAME="navbar_bottom"><!-- --></A>
- <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_bottom_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../edu/stanford/nlp/util/HasIntegerIdentity.html" title="interface in edu.stanford.nlp.util"><B>PREV CLASS</B></A>
- <A HREF="../../../../edu/stanford/nlp/util/Index.html" title="class in edu.stanford.nlp.util"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../../../index.html?edu/stanford/nlp/util/Heap.html" target="_top"><B>FRAMES</B></A>
- <A HREF="Heap.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_bottom"></A>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <HR>
- <FONT SIZE=2><A HREF="http://nlp.stanford.edu">Stanford NLP Group</A></FONT>
- </BODY>
- </HTML>