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

📄 bitset.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<DD>Returns the "logical size" of this <code>BitSet</code>: the index of the highest set bit in the <code>BitSet</code> plus one. Returns zero if the <code>BitSet</code> contains no set bits.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the logical size of this <code>BitSet</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="set(int)"><!-- --></A><H3>set</H3><PRE>public void <B>set</B>(int&nbsp;bitIndex)</PRE><DL><DD>Sets the bit specified by the index to <code>true</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - a bit index.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the specified index is negative.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="clear(int)"><!-- --></A><H3>clear</H3><PRE>public void <B>clear</B>(int&nbsp;bitIndex)</PRE><DL><DD>Sets the bit specified by the index to <code>false</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - the index of the bit to be cleared.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the specified index is negative.<DT><B>Since: </B><DD>JDK1.0</DD></DL></DD></DL><HR><A NAME="andNot(java.util.BitSet)"><!-- --></A><H3>andNot</H3><PRE>public void <B>andNot</B>(<A HREF="../../java/util/BitSet.html">BitSet</A>&nbsp;set)</PRE><DL><DD>Clears all of the bits in this <code>BitSet</code> whose corresponding bit is set in the specified <code>BitSet</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>set</CODE> - the <code>BitSet</code> with which to mask this            <code>BitSet</code>.<DT><B>Since: </B><DD>1.2</DD></DL></DD></DL><HR><A NAME="get(int)"><!-- --></A><H3>get</H3><PRE>public boolean <B>get</B>(int&nbsp;bitIndex)</PRE><DL><DD>Returns the value of the bit with the specified index. The value  is <code>true</code> if the bit with the index <code>bitIndex</code>  is currently set in this <code>BitSet</code>; otherwise, the result  is <code>false</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - the bit index.<DT><B>Returns:</B><DD>the value of the bit with the specified index.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IndexOutOfBoundsException.html">IndexOutOfBoundsException</A></CODE> - if the specified index is negative.</DL></DD></DL><HR><A NAME="and(java.util.BitSet)"><!-- --></A><H3>and</H3><PRE>public void <B>and</B>(<A HREF="../../java/util/BitSet.html">BitSet</A>&nbsp;set)</PRE><DL><DD>Performs a logical <b>AND</b> of this target bit set with the  argument bit set. This bit set is modified so that each bit in it  has the value <code>true</code> if and only if it both initially  had the value <code>true</code> and the corresponding bit in the  bit set argument also had the value <code>true</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>set</CODE> - a bit set.</DL></DD></DL><HR><A NAME="or(java.util.BitSet)"><!-- --></A><H3>or</H3><PRE>public void <B>or</B>(<A HREF="../../java/util/BitSet.html">BitSet</A>&nbsp;set)</PRE><DL><DD>Performs a logical <b>OR</b> of this bit set with the bit set  argument. This bit set is modified so that a bit in it has the  value <code>true</code> if and only if it either already had the  value <code>true</code> or the corresponding bit in the bit set  argument has the value <code>true</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>set</CODE> - a bit set.</DL></DD></DL><HR><A NAME="xor(java.util.BitSet)"><!-- --></A><H3>xor</H3><PRE>public void <B>xor</B>(<A HREF="../../java/util/BitSet.html">BitSet</A>&nbsp;set)</PRE><DL><DD>Performs a logical <b>XOR</b> of this bit set with the bit set  argument. This bit set is modified so that a bit in it has the  value <code>true</code> if and only if one of the following  statements holds:  <ul> <li>The bit initially has the value <code>true</code>, and the      corresponding bit in the argument has the value <code>false</code>. <li>The bit initially has the value <code>false</code>, and the      corresponding bit in the argument has the value <code>true</code>.  </ul><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>set</CODE> - a bit set.</DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Returns a hash code value for this bit set. The has code  depends only on which bits have been set within this  <code>BitSet</code>. The algorithm used to compute it may  be described as follows.<p> Suppose the bits in the <code>BitSet</code> were to be stored  in an array of <code>long</code> integers called, say,  <code>bits</code>, in such a manner that bit <code>k</code> is  set in the <code>BitSet</code> (for nonnegative values of  <code>k</code>) if and only if the expression  <pre>((k&gt;&gt;6) &lt; bits.length) && ((bits[k&gt;&gt;6] & (1L &lt;&lt; (bit & 0x3F))) != 0)</pre> is true. Then the following definition of the <code>hashCode</code>  method would be a correct implementation of the actual algorithm: <pre> public synchronized int hashCode() {      long h = 1234;      for (int i = bits.length; --i &gt;= 0; ) {           h ^= bits[i] * (i + 1);      }      return (int)((h &gt;&gt; 32) ^ h); }</pre> Note that the hash code values change if the set of bits is altered. <p>Overrides the <code>hashCode</code> method of <code>Object</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a hash code value for this bit set.</DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE>public int <B>size</B>()</PRE><DL><DD>Returns the number of bits of space actually in use by this  <code>BitSet</code> to represent bit values.  The maximum element in the set is the size - 1st element.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of bits currently in this bit set.</DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../java/lang/Object.html">Object</A>&nbsp;obj)</PRE><DL><DD>Compares this object against the specified object. The result is <code>true</code> if and only if the argument is  not <code>null</code> and is a <code>Bitset</code> object that has  exactly the same set of bits set to <code>true</code> as this bit  set. That is, for every nonnegative <code>int</code> index <code>k</code>,  <pre>((BitSet)obj).get(k) == this.get(k)</pre> must be true. The current sizes of the two bit sets are not compared.  <p>Overrides the <code>equals</code> method of <code>Object</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to compare with.<DT><B>Returns:</B><DD><code>true</code> if the objects are the same;          <code>false</code> otherwise.<DT><B>See Also: </B><DD><A HREF="../../java/util/BitSet.html#size()"><CODE>size()</CODE></A></DL></DD></DL><HR><A NAME="clone()"><!-- --></A><H3>clone</H3><PRE>public <A HREF="../../java/lang/Object.html">Object</A> <B>clone</B>()</PRE><DL><DD>Cloning this <code>BitSet</code> produces a new <code>BitSet</code>  that is equal to it. The clone of the bit set is another bit set that has exactly the  same bits set to <code>true</code> as this bit set and the same  current size.  <p>Overrides the <code>clone</code> method of <code>Object</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a clone of this bit set.<DT><B>See Also: </B><DD><A HREF="../../java/util/BitSet.html#size()"><CODE>size()</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Returns a string representation of this bit set. For every index  for which this <code>BitSet</code> contains a bit in the set  state, the decimal representation of that index is included in  the result. Such indeces aer listed in order from lowest to  highest, separated by ",$nbsp;" (a comma and a space) and  surrounded by braces, resulting in the usual mathematical  notation for a set of integers.<p> Overrides the <code>toString</code> method of <code>Object</code>. <p>Example: <pre> BitSet drPepper = new BitSet();</pre> Now <code>drPepper.toString()</code> returns "<code>{}</code>".<p> <pre> drPepper.set(2);</pre> Now <code>drPepper.toString()</code> returns "<code>{2}</code>".<p> <pre> drPepper.set(4); drPepper.set(10);</pre> Now <code>drPepper.toString()</code> returns "<code>{2, 4, 10}</code>".<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a string representation of this bit set.</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="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/BitSet.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../java/util/Arrays.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/util/Calendar.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>  &nbsp;&nbsp;<A HREF="BitSet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation  contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font></BODY></HTML>

⌨️ 快捷键说明

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