📄 stringcounter.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Tue Feb 04 15:01:34 PST 2003 -->
<TITLE>
: Class StringCounter
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <AX HREF="deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <AX HREF="help-doc.html"><FONT ID="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">
<AX HREF="DT.html"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<AX HREF="index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="StringCounter.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | 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>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Class StringCounter</H2>
<PRE>
java.lang.Object
|
+--<B>StringCounter</B>
</PRE>
<HR>
<DL>
<DT>public class <B>StringCounter</B><DT>extends java.lang.Object</DL>
<P>
A StringCounter object summarizes any number of pairs of Strings; the first String in each pair is the "attribute" and the second String is the "class". When the same pair of Strings is add'd more than once to a StringCounter object, the object increments an internal count variable. Thus the space requirements is big O of the number of distinct pairs inserted into the object.
<P>
<DL>
<DT><B>Author: </B><DD>Dan Frost</DD>
</DL>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="StringCounter.html#StringCounter()">StringCounter</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></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="StringCounter.html#add(java.lang.String, java.lang.String)">add</A></B>(java.lang.String attrValue, java.lang.String classValue)</CODE>
<BR>
The add method puts a new pair of Strings into the StringCounter.</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="StringCounter.html#attrAndClassOccurences(int, int)">attrAndClassOccurences</A></B>(int attrIndex, int classIndex)</CODE>
<BR>
attrAndClassValOccurences returns the number of calls to add that were made with the specific attribute and class values indicated by the index parameters.</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="StringCounter.html#attrValOccurences(int)">attrValOccurences</A></B>(int attrIndex)</CODE>
<BR>
attrValOccurences returns the number of calls to add that were made with the attribute indexed by the parameter, regardless of the class String associated with the attribute.</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="StringCounter.html#getClassValue(int)">getClassValue</A></B>(int classIndex)</CODE>
<BR>
getClassValue returns the class value String associated with the index parameter.</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="StringCounter.html#numAdded()">numAdded</A></B>()</CODE>
<BR>
numAdded returns the number of calls to add that have been made on this object.</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="StringCounter.html#numDistinctAttrValues()">numDistinctAttrValues</A></B>()</CODE>
<BR>
numDistinctAttrValues returns the number of distinct attribute values that have been add'd to this object.</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="StringCounter.html#numDistinctClassValues()">numDistinctClassValues</A></B>()</CODE>
<BR>
numDistinctClassValues returns the number of distinct class values that have been add'd to this object.</TD>
</TR>
</TABLE>
<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.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= 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="StringCounter()"><!-- --></A><H3>
StringCounter</H3>
<PRE>
public <B>StringCounter</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="add(java.lang.String, java.lang.String)"><!-- --></A><H3>
add</H3>
<PRE>
public void <B>add</B>(java.lang.String attrValue, java.lang.String classValue)</PRE>
<DL>
<DD>The add method puts a new pair of Strings into the StringCounter.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>attrValue</CODE> - the first String stored, the "attribute"<DD><CODE>classValue</CODE> - the second String stored, the "class"</DL>
</DD>
</DL>
<HR>
<A NAME="numDistinctAttrValues()"><!-- --></A><H3>
numDistinctAttrValues</H3>
<PRE>
public int <B>numDistinctAttrValues</B>()</PRE>
<DL>
<DD>numDistinctAttrValues returns the number of distinct attribute values that have been add'd to this object. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of this method would be 3.<DD><DL>
<DT><B>Returns:</B><DD>the number of unique attribute values in the object.</DL>
</DD>
</DL>
<HR>
<A NAME="numDistinctClassValues()"><!-- --></A><H3>
numDistinctClassValues</H3>
<PRE>
public int <B>numDistinctClassValues</B>()</PRE>
<DL>
<DD>numDistinctClassValues returns the number of distinct class values that have been add'd to this object. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of this method would be 2.<DD><DL>
<DT><B>Returns:</B><DD>the number of unique class values in the object.</DL>
</DD>
</DL>
<HR>
<A NAME="getClassValue(int)"><!-- --></A><H3>
getClassValue</H3>
<PRE>
public java.lang.String <B>getClassValue</B>(int classIndex)</PRE>
<DL>
<DD>getClassValue returns the class value String associated with the index parameter. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of getClassValue(1) would be "dog".<DD><DL>
<DT><B>Parameters:</B><DD><CODE>classIndex</CODE> - index (0 based) into the list of distinct class values.<DT><B>Returns:</B><DD>String associated with the index parameter.</DL>
</DD>
</DL>
<HR>
<A NAME="attrValOccurences(int)"><!-- --></A><H3>
attrValOccurences</H3>
<PRE>
public int <B>attrValOccurences</B>(int attrIndex)</PRE>
<DL>
<DD>attrValOccurences returns the number of calls to add that were made with the attribute indexed by the parameter, regardless of the class String associated with the attribute. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of attrValOccurences(1) would be 2, since the 1'th attribute is "blue" and it was add'ed twice.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>attrIndex</CODE> - 0 based index into the list of distinct attribute values.<DT><B>Returns:</B><DD>number of calls to add with that value.</DL>
</DD>
</DL>
<HR>
<A NAME="attrAndClassOccurences(int, int)"><!-- --></A><H3>
attrAndClassOccurences</H3>
<PRE>
public int <B>attrAndClassOccurences</B>(int attrIndex, int classIndex)</PRE>
<DL>
<DD>attrAndClassValOccurences returns the number of calls to add that were made with the specific attribute and class values indicated by the index parameters. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of attrAndClassOccurences(0, 0) would be 2, since the 0'th attribute is "red", the 0'th class is "cat", and the two values were add'ed twice.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>attrIndex</CODE> - 0 based index into the list of distinct attribute values.<DD><CODE>classIndex</CODE> - 0 based index into the list of distinct class values.<DT><B>Returns:</B><DD>number of calls to add with those two values.</DL>
</DD>
</DL>
<HR>
<A NAME="numAdded()"><!-- --></A><H3>
numAdded</H3>
<PRE>
public int <B>numAdded</B>()</PRE>
<DL>
<DD>numAdded returns the number of calls to add that have been made on this object. For instance, if the following calls were made: add("red", "cat"), add("blue", "dog"), add("red", "cat"), add("green", "cat"), add("blue, "cat") then the return value of numAdded would be 5.<DD><DL>
<DT><B>Returns:</B><DD>number of String pairs add'ed to the object.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <AX HREF="deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <AX HREF="help-doc.html"><FONT ID="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">
<AX HREF="DT.html"><B>PREV CLASS</B></A>
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<AX HREF="index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="StringCounter.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | 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>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -