📄 bitset.html
字号:
<PRE>protected final int <B>bitsPerInt</B></PRE><DL><DD>The number of bits contained in a single integer.</DL><HR><A NAME="initialCapacity"><!-- --></A><H3>initialCapacity</H3><PRE>protected final int <B>initialCapacity</B></PRE><DL><DD>The initial capacity of the set, by default.</DL><HR><A NAME="data"><!-- --></A><H3>data</H3><PRE>protected int[] <B>data</B></PRE><DL><DD>The array of integers that contains the set's bits</DL><HR><A NAME="allocated"><!-- --></A><H3>allocated</H3><PRE>protected int <B>allocated</B></PRE><DL><DD>The current number of integers allocated.</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="BitSet()"><!-- --></A><H3>BitSet</H3><PRE>public <B>BitSet</B>()</PRE><DL><DD>Constructs an empty bitset.</DL><HR><A NAME="BitSet(int)"><!-- --></A><H3>BitSet</H3><PRE>public <B>BitSet</B>(int count)</PRE><DL><DD>Constructs an empty bitset with potential to hold values between 0..count-1.<DD><DL><DT><B>Parameters:</B><DD><CODE>count</CODE> - The number of distinct values possibly in set.</DL></DD></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(int)"><!-- --></A><H3>add</H3><PRE>public void <B>add</B>(int i)</PRE><DL><DD>Adds a bit to the bitset, if not already there. Set is potentially extended.<DD><DL><DT><B>Parameters:</B><DD><CODE>i</CODE> - The number of the bit to be added.<DT><B>Precondition:</B><DD>i >= 0<DT><B>Postcondition:</B><DD>i is added to the set</DL></DD></DL><HR><A NAME="remove(int)"><!-- --></A><H3>remove</H3><PRE>public void <B>remove</B>(int i)</PRE><DL><DD>Remove bit i from the bitset.<DD><DL><DT><B>Parameters:</B><DD><CODE>i</CODE> - The index of the bit to be removed.<DT><B>Precondition:</B><DD>i >= 0<DT><B>Postcondition:</B><DD>removes i from set if present</DL></DD></DL><HR><A NAME="contains(int)"><!-- --></A><H3>contains</H3><PRE>public boolean <B>contains</B>(int i)</PRE><DL><DD>Determine if a bit is a member of the set.<DD><DL><DT><B>Parameters:</B><DD><CODE>i</CODE> - The bit index of potential bit.<DT><B>Precondition:</B><DD>i >= 0<DT><B>Postcondition:</B><DD>returns true iff i in set<DT><B>Returns:</B><DD>True iff bit i is in the set.</DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>()</PRE><DL><DD>Remove all bits from the set.<DD><DL><DT><B>Postcondition:</B><DD>removes all values from set</DL></DD></DL><HR><A NAME="clear(int)"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>(int count)</PRE><DL><DD>Remove bits from set; set size to count.<DD><DL><DT><B>Parameters:</B><DD><CODE>count</CODE> - The new capacity of the newly empty set.<DT><B>Postcondition:</B><DD>removes all values from set, sets set size to count</DL></DD></DL><HR><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> <B>clone</B>()</PRE><DL><DD>Returns a copy of the set.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone()">clone</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Postcondition:</B><DD>constructs a copy of the set<DT><B>Returns:</B><DD>A new BitSet with the same values as this.</DL></DD></DL><HR><A NAME="union(structure.BitSet)"><!-- --></A><H3>union</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> <B>union</B>(<A HREF="../structure/BitSet.html">BitSet</A> other)</PRE><DL><DD>Compute a new set that is the union of this set and other. Elements of the new set appear in at least one of the two sets.<DD><DL><DT><B>Parameters:</B><DD><CODE>other</CODE> - The set to be unioned with this.<DT><B>Precondition:</B><DD>other is non-null<DT><B>Postcondition:</B><DD>constructs set w/elements from this and other<DT><B>Returns:</B><DD>The union of the two sets.</DL></DD></DL><HR><A NAME="intersection(structure.BitSet)"><!-- --></A><H3>intersection</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> <B>intersection</B>(<A HREF="../structure/BitSet.html">BitSet</A> other)</PRE><DL><DD>Return the intersection of this set and the other. A bit is in the result if it is in this set and other.<DD><DL><DT><B>Parameters:</B><DD><CODE>other</CODE> - The other set to be intersected with this.<DT><B>Precondition:</B><DD>other is not null<DT><B>Postcondition:</B><DD>constructs set w/elements in this and other</DL></DD></DL><HR><A NAME="difference(structure.BitSet)"><!-- --></A><H3>difference</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> <B>difference</B>(<A HREF="../structure/BitSet.html">BitSet</A> other)</PRE><DL><DD>Computes the difference between this set and the other. An element is in the difference if it is in this, but not in other.<DD><DL><DT><B>Parameters:</B><DD><CODE>other</CODE> - The difference between this set and other.<DT><B>Precondition:</B><DD>other is not null<DT><B>Postcondition:</B><DD>constructs set w/elements from this but not other</DL></DD></DL><HR><A NAME="subset(structure.BitSet)"><!-- --></A><H3>subset</H3><PRE>public boolean <B>subset</B>(<A HREF="../structure/BitSet.html">BitSet</A> other)</PRE><DL><DD>Returns true iff this set is a subset of the other. A set is a subset of another if its elements are elements of the other.<DD><DL><DT><B>Parameters:</B><DD><CODE>other</CODE> - The potential superset.<DT><B>Precondition:</B><DD>other is not null<DT><B>Postcondition:</B><DD>returns true iff elements of this are all in other<DT><B>Returns:</B><DD>The difference between this and other.</DL></DD></DL><HR><A NAME="isEmpty()"><!-- --></A><H3>isEmpty</H3><PRE>public boolean <B>isEmpty</B>()</PRE><DL><DD>Determine if a set is empty.<DD><DL><DT><B>Postcondition:</B><DD>returns true iff this set is empty<DT><B>Returns:</B><DD>True iff this set is empty.</DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> o)</PRE><DL><DD>Return true iff this set and o contain the same elements.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>o</CODE> - Another non-null bitset.<DT><B>Precondition:</B><DD>o is not null<DT><B>Postcondition:</B><DD>returns true iff this and o have same elements<DT><B>Returns:</B><DD>True iff this set has the same elements as o.</DL></DD></DL><HR><A NAME="indexOf(int)"><!-- --></A><H3>indexOf</H3><PRE>protected int <B>indexOf</B>(int b)</PRE><DL><DD>Determine the int index associated with a bit number.<DD><DL><DT><B>Precondition:</B><DD>bit >= 0<DT><B>Postcondition:</B><DD>returns index of integer containing bit b<DT><B>Returns:</B><DD>the index in array of bit b.</DL></DD></DL><HR><A NAME="offsetOf(int)"><!-- --></A><H3>offsetOf</H3><PRE>protected int <B>offsetOf</B>(int bit)</PRE><DL><DD>Return the bit index within the associated int of bit "bit"<DD><DL><DT><B>Parameters:</B><DD><CODE>bit</CODE> - The index of the bit in set.<DT><B>Precondition:</B><DD>bit >= 0<DT><B>Postcondition:</B><DD>returns bit position of bit in word<DT><B>Returns:</B><DD>The index of the bit desired, within the word.</DL></DD></DL><HR><A NAME="extend(int)"><!-- --></A><H3>extend</H3><PRE>protected void <B>extend</B>(int bit)</PRE><DL><DD>Ensures that bit "bit" is within capacity of set.<DD><DL><DT><B>Precondition:</B><DD>bit >= 0<DT><B>Postcondition:</B><DD>ensures set is large enough to contain bit</DL></DD></DL><HR><A NAME="probe(int)"><!-- --></A><H3>probe</H3><PRE>protected boolean <B>probe</B>(int bit)</PRE><DL><DD>Determines if bit is within capacity of set.<DD><DL><DT><B>Parameters:</B><DD><CODE>bit</CODE> - The index of desired bit.<DT><B>Precondition:</B><DD>bit >= 0<DT><B>Postcondition:</B><DD>Returns rue if set is large enough to contain bit<DT><B>Returns:</B><DD>True if index of bit is within array.</DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Constructs string representing set.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Postcondition:</B><DD>returns string representation of set<DT><B>Returns:</B><DD>String representing bitset.</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="#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><a href=../copyright.html target=_top>© 1998-2002 McGraw-Hill</a></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../structure/BinaryTree.html"><B>PREV CLASS</B></A> <A HREF="../structure/BTInorderIterator.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="BitSet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <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 + -