trie.html
来自「数据挖掘的最常用工具。由于开源」· HTML 代码 · 共 861 行 · 第 1/2 页
HTML
861 行
<!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.5.0_13) on Tue Jul 15 15:48:45 NZST 2008 --><TITLE>Trie</TITLE><META NAME="keywords" CONTENT="weka.core.Trie class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="Trie";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= 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> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><FONT CLASS="NavBarFont1"><B>Weka's home</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="../../weka/core/TestInstances.html" title="class in weka.core"><B>PREV CLASS</B></A> <A HREF="../../weka/core/Trie.TrieIterator.html" title="class in weka.core"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?weka/core/Trie.html" target="_top"><B>FRAMES</B></A> <A HREF="Trie.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: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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">weka.core</FONT><BR>Class Trie</H2><PRE>java.lang.Object <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>weka.core.Trie</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, <A HREF="../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</A></DD></DL><HR><DL><DT><PRE>public class <B>Trie</B><DT>extends java.lang.Object<DT>implements java.io.Serializable, java.lang.Cloneable, java.util.Collection<java.lang.String>, <A HREF="../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</A></DL></PRE><P>A class representing a Trie data structure for strings. See also <a href="http://en.wikipedia.org/wiki/Trie" target="_blank">Trie</a> on WikiPedia.<P><P><DL><DT><B>Version:</B></DT> <DD>$Revision: 1.2 $</DD><DT><B>Author:</B></DT> <DD>fracpete (fracpete at waikato dot ac dot nz)</DD><DT><B>See Also:</B><DD><A HREF="../../serialized-form.html#weka.core.Trie">Serialized Form</A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_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>Nested Class Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.TrieIterator.html" title="class in weka.core">Trie.TrieIterator</A></B></CODE><BR> Represents an iterator over a trie</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.TrieNode.html" title="class in weka.core">Trie.TrieNode</A></B></CODE><BR> Represents a node in the trie.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_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>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../weka/core/Trie.html#Trie()">Trie</A></B>()</CODE><BR> initializes the data structure</TD></TR></TABLE> <!-- ========== 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="../../weka/core/Trie.html#add(java.lang.String)">add</A></B>(java.lang.String o)</CODE><BR> Ensures that this collection contains the specified element.</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="../../weka/core/Trie.html#addAll(java.util.Collection)">addAll</A></B>(java.util.Collection<? extends java.lang.String> c)</CODE><BR> Adds all of the elements in the specified collection to this collection</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#clear()">clear</A></B>()</CODE><BR> Removes all of the elements from this collection</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.Object</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#clone()">clone</A></B>()</CODE><BR> returns a deep copy of itself</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="../../weka/core/Trie.html#contains(java.lang.Object)">contains</A></B>(java.lang.Object o)</CODE><BR> Returns true if this collection contains the specified element.</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="../../weka/core/Trie.html#containsAll(java.util.Collection)">containsAll</A></B>(java.util.Collection<?> c)</CODE><BR> Returns true if this collection contains all of the elements in the specified collection.</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="../../weka/core/Trie.html#containsPrefix(java.lang.String)">containsPrefix</A></B>(java.lang.String prefix)</CODE><BR> checks whether the given prefix is stored in the trie</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="../../weka/core/Trie.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object o)</CODE><BR> Compares the specified object with this collection for equality.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#getCommonPrefix()">getCommonPrefix</A></B>()</CODE><BR> returns the common prefix for all the nodes</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#getRevision()">getRevision</A></B>()</CODE><BR> Returns the revision string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../weka/core/Trie.TrieNode.html" title="class in weka.core">Trie.TrieNode</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#getRoot()">getRoot</A></B>()</CODE><BR> returns the root node of the trie</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Vector<java.lang.String></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#getWithPrefix(java.lang.String)">getWithPrefix</A></B>(java.lang.String prefix)</CODE><BR> returns all stored strings that match the given prefix</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="../../weka/core/Trie.html#hashCode()">hashCode</A></B>()</CODE><BR> Returns the hash code value for this collection.</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="../../weka/core/Trie.html#isEmpty()">isEmpty</A></B>()</CODE><BR> Returns true if this collection contains no elements.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.util.Iterator<java.lang.String></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#iterator()">iterator</A></B>()</CODE><BR> Returns an iterator over the elements in this collection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#main(java.lang.String[])">main</A></B>(java.lang.String[] args)</CODE><BR> Only for testing (prints the built Trie).</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="../../weka/core/Trie.html#remove(java.lang.Object)">remove</A></B>(java.lang.Object o)</CODE><BR> Removes a single instance of the specified element from this collection, if it is present.</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="../../weka/core/Trie.html#removeAll(java.util.Collection)">removeAll</A></B>(java.util.Collection<?> c)</CODE><BR> Removes all this collection's elements that are also contained in the specified collection</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="../../weka/core/Trie.html#retainAll(java.util.Collection)">retainAll</A></B>(java.util.Collection<?> c)</CODE><BR> Retains only the elements in this collection that are contained in the specified collection</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="../../weka/core/Trie.html#size()">size</A></B>()</CODE><BR> Returns the number of elements in this collection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.Object[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#toArray()">toArray</A></B>()</CODE><BR> Returns an array containing all of the elements in this collection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""><TR ALIGN="right" VALIGN=""><TD NOWRAP><FONT SIZE="-1"><CODE><T> T[]</CODE></FONT></TD></TR></TABLE></CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#toArray(T[])">toArray</A></B>(T[] a)</CODE><BR> Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../weka/core/Trie.html#toString()">toString</A></B>()</CODE><BR> returns the trie in string representation</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>getClass, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_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>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="Trie()"><!-- --></A><H3>Trie</H3><PRE>public <B>Trie</B>()</PRE><DL><DD>initializes the data structure<P></DL><!-- ============ 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="add(java.lang.String)"><!-- --></A><H3>add</H3><PRE>public boolean <B>add</B>(java.lang.String o)</PRE><DL><DD>Ensures that this collection contains the specified element.<P><DD><DL><DT><B>Specified by:</B><DD><CODE>add</CODE> in interface <CODE>java.util.Collection<java.lang.String></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - the string to add<DT><B>Returns:</B><DD>true if the structure changed</DL></DD></DL><HR><A NAME="addAll(java.util.Collection)"><!-- --></A><H3>addAll</H3><PRE>public boolean <B>addAll</B>(java.util.Collection<? extends java.lang.String> c)</PRE><DL><DD>Adds all of the elements in the specified collection to this collection<P><DD><DL><DT><B>Specified by:</B><DD><CODE>addAll</CODE> in interface <CODE>java.util.Collection<java.lang.String></CODE></DL>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?