⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ternarytree.html

📁 java编程java编程java编程java编程java编程java编程java编程
💻 HTML
📖 第 1 页 / 共 3 页
字号:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The actual insertion function, recursive version.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#insert(java.lang.String, char)">insert</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A>&nbsp;key,       char&nbsp;val)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Branches are initially compressed, needing one node per key plus the size of the string key. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#insertBalanced(java.lang.String[], char[], int, int)">insertBalanced</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A>[]&nbsp;k,               char[]&nbsp;v,               int&nbsp;offset,               int&nbsp;n)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Recursively insert the median first and then the median of the lower and upper halves, and so on in order to get a balanced tree. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Enumeration.html">Enumeration</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#keys()">keys</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#knows(java.lang.String)">knows</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A>&nbsp;key)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#printStats()">printStats</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#redimNodeArrays(int)">redimNodeArrays</A></B>(int&nbsp;newsize)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#size()">size</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#strcmp(char[], int, char[], int)">strcmp</A></B>(char[]&nbsp;a,       int&nbsp;startA,       char[]&nbsp;b,       int&nbsp;startB)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares 2 null terminated char arrays</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#strcmp(java.lang.String, char[], int)">strcmp</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A>&nbsp;str,       char[]&nbsp;a,       int&nbsp;start)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares a string with null terminated char array</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#strcpy(char[], int, char[], int)">strcpy</A></B>(char[]&nbsp;dst,       int&nbsp;di,       char[]&nbsp;src,       int&nbsp;si)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#strlen(char[])">strlen</A></B>(char[]&nbsp;a)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#strlen(char[], int)">strlen</A></B>(char[]&nbsp;a,       int&nbsp;start)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/lowagie/text/pdf/hyphenation/TernaryTree.html#trimToSize()">trimToSize</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Each node stores a character (splitchar) which is part of some key(s). </TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#finalize()">finalize</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()">toString</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="lo"><!-- --></A><H3>
lo</H3>
<PRE>
protected char[] <B>lo</B></PRE>
<DL>
<DD>Pointer to low branch and to rest of the key when it is stored directly in this node, we don't have unions in java!
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="hi"><!-- --></A><H3>
hi</H3>
<PRE>
protected char[] <B>hi</B></PRE>
<DL>
<DD>Pointer to high branch.
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="eq"><!-- --></A><H3>
eq</H3>
<PRE>
protected char[] <B>eq</B></PRE>
<DL>
<DD>Pointer to equal branch and to data when this node is a string terminator.
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="sc"><!-- --></A><H3>
sc</H3>
<PRE>
protected char[] <B>sc</B></PRE>
<DL>
<DD><P>The character stored in this node: splitchar Two special values are reserved:</P> <ul><li>0x0000 as string terminator</li> <li>0xFFFF to indicate that the branch starting at this node is compressed</li></ul> <p>This shouldn't be a problem if we give the usual semantics to strings since 0xFFFF is garanteed not to be an Unicode character.</p>
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="kv"><!-- --></A><H3>
kv</H3>
<PRE>
protected <A HREF="../../../../../com/lowagie/text/pdf/hyphenation/CharVector.html">CharVector</A> <B>kv</B></PRE>
<DL>
<DD>This vector holds the trailing of the keys when the branch is compressed.
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="root"><!-- --></A><H3>
root</H3>
<PRE>
protected char <B>root</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="freenode"><!-- --></A><H3>
freenode</H3>
<PRE>
protected char <B>freenode</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="length"><!-- --></A><H3>
length</H3>
<PRE>
protected int <B>length</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="BLOCK_SIZE"><!-- --></A><H3>
BLOCK_SIZE</H3>
<PRE>
protected static final int <B>BLOCK_SIZE</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#com.lowagie.text.pdf.hyphenation.TernaryTree.BLOCK_SIZE">Constant Field Values</A></DL>
</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="TernaryTree()"><!-- --></A><H3>
TernaryTree</H3>
<PRE>
<B>TernaryTree</B>()</PRE>
<DL>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="init()"><!-- --></A><H3>
init</H3>
<PRE>
protected void <B>init</B>()</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="insert(java.lang.String, char)"><!-- --></A><H3>
insert</H3>
<PRE>
public void <B>insert</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A>&nbsp;key,                   char&nbsp;val)</PRE>
<DL>
<DD>Branches are initially compressed, needing one node per key plus the size of the string key. They are decompressed as needed when another key with same prefix is inserted. This saves a lot of space, specially for long keys.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="insert(char[], int, char)"><!-- --></A><H3>
insert</H3>
<PRE>
public void <B>insert</B>(char[]&nbsp;key,                   int&nbsp;start,                   char&nbsp;val)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="insert(char, char[], int, char)"><!-- --></A><H3>
insert</H3>
<PRE>
private char <B>insert</B>(char&nbsp;p,                    char[]&nbsp;key,                    int&nbsp;start,                    char&nbsp;val)</PRE>
<DL>
<DD>The actual insertion function, recursive version.
<P>
<DD><DL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -