1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
|
<!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.4.2_05) on Thu Sep 09 20:36:07 PDT 2004 -->
<TITLE>
BitVector (Colt 1.2.0 - API Specification)
</TITLE>
<META NAME="keywords" CONTENT="cern.colt.bitvector.BitVector class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="BitVector (Colt 1.2.0 - API Specification)";
}
</SCRIPT>
</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=3 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="class-use/BitVector.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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>
<b>Colt 1.2.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../cern/colt/bitvector/BitMatrix.html" title="class in cern.colt.bitvector"><B>PREV CLASS</B></A>
<A HREF="../../../cern/colt/bitvector/QuickBitVector.html" title="class in cern.colt.bitvector"><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="BitVector.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: NESTED | <A HREF="#fields_inherited_from_class_cern.colt.PersistentObject">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: 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">
cern.colt.bitvector</FONT>
<BR>
Class BitVector</H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by"><A HREF="../../../cern/colt/PersistentObject.html" title="class in cern.colt">cern.colt.PersistentObject</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>cern.colt.bitvector.BitVector</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Cloneable.html" title="class or interface in java.lang">Cloneable</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/Serializable.html" title="class or interface in java.io">Serializable</A></DD>
</DL>
<HR>
<DL>
<DT>public class <B>BitVector</B><DT>extends <A HREF="../../../cern/colt/PersistentObject.html" title="class in cern.colt">PersistentObject</A></DL>
<P>
Fixed sized (non resizable) bitvector.
Upon instance construction a bitvector is told to hold a fixed number of bits - it's size.
The size can be any number (need not be a power of 2 or so).
The bits of a <tt>BitVector</tt> are indexed by nonnegative integers.
Any attempt to access a bit at an <tt>index<0 || index>=size()</tt> will throw an <tt>IndexOutOfBoundsException</tt>.
<p>
Individual indexed bits can be examined, set, or cleared.
Subranges can quickly be extracted, copied and replaced.
Quick iteration over subranges is provided by optimized internal iterators (<tt>forEach()</tt> methods).
One <code>BitVector</code> may be used to modify the contents of another
<code>BitVector</code> through logical AND, OR, XOR and other similar operations.
<p>
All operations consider the bits <tt>0..size()-1</tt> and nothing else.
Operations involving two bitvectors (like AND, OR, XOR, etc.) will throw an <tt>IllegalArgumentException</tt> if the secondary bit vector has a size smaller than the receiver.
<p>
A <tt>BitVector</tt> is never automatically resized,
but it can manually be grown or shrinked via <tt>setSize(...)</tt>.
<p>
For use cases that need to store several bits per information entity, quick accessors are provided that interpret subranges as 64 bit <tt>long</tt> integers.
<p>
Why this class? Fist, <tt>boolean[]</tt> take one byte per stored bit. This class takes one bit per stored bit.
Second, many applications find the semantics of <tt>java.util.BitSet</tt> not particularly helpful for their needs.
Third, operations working on all bits of a bitvector are extremely quick.
For example, on NT, Pentium Pro 200 Mhz, SunJDK1.2.2, java -classic, for two bitvectors A,B (both much larger than processor cache), the following results are obtained.
<ul>
<li><tt>A.and(B)</tt> i.e. A = A & B --> runs at about 35 MB/sec
<li><tt>A.cardinality()</tt>, i.e. determining the selectivity, the number of bits in state "true" --> runs at about 80 MB/sec
<li>Similar performance for <tt>or, xor, andNot, not, copy, replace, partFromTo, indexOf, clear</tt> etc.
</ul>
If you need extremely quick access to individual bits: Although getting and setting individual bits with methods <tt>get(...)</tt>, <tt>set(...)</tt> and <tt>put(...)</tt>is quick, it is even quicker (<b>but not safe</b>) to use <tt>getQuick(...)</tt> and <tt>putQuick(...)</tt> or even <tt>QuickBitVector</tt>.
<p>
<b>Note</b> that this implementation is not synchronized.
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>1.01, 11/10/99</DD>
<DT><B>See Also:</B><DD><A HREF="../../../cern/colt/bitvector/QuickBitVector.html" title="class in cern.colt.bitvector"><CODE>QuickBitVector</CODE></A>,
<A HREF="../../../cern/colt/bitvector/BitMatrix.html" title="class in cern.colt.bitvector"><CODE>BitMatrix</CODE></A>,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/BitSet.html" title="class or interface in java.util"><CODE>BitSet</CODE></A>,
<A HREF="../../../serialized-form.html#cern.colt.bitvector.BitVector">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_cern.colt.PersistentObject"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class cern.colt.<A HREF="../../../cern/colt/PersistentObject.html" title="class in cern.colt">PersistentObject</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../cern/colt/PersistentObject.html#serialVersionUID">serialVersionUID</A></CODE></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">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#BitVector(int)">BitVector</A></B>(int size)</CODE>
<BR>
Constructs a bit vector that holds <tt>size</tt> bits.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#BitVector(long[], int)">BitVector</A></B>(long[] bits,
int size)</CODE>
<BR>
You normally need not use this method.</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">
<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="../../../cern/colt/bitvector/BitVector.html#and(cern.colt.bitvector.BitVector)">and</A></B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</CODE>
<BR>
Performs a logical <b>AND</b> of the receiver with another bit vector (A = A & B).</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="../../../cern/colt/bitvector/BitVector.html#andNot(cern.colt.bitvector.BitVector)">andNot</A></B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</CODE>
<BR>
Clears all of the bits in receiver whose corresponding
bit is set in the other bitvector (A = A \ B).</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="../../../cern/colt/bitvector/BitVector.html#cardinality()">cardinality</A></B>()</CODE>
<BR>
Returns the number of bits currently in the <tt>true</tt> state.</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="../../../cern/colt/bitvector/BitVector.html#clear()">clear</A></B>()</CODE>
<BR>
Clears all bits of the receiver.</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="../../../cern/colt/bitvector/BitVector.html#clear(int)">clear</A></B>(int bitIndex)</CODE>
<BR>
Changes the bit with index <tt>bitIndex</tt> to the "clear" (<tt>false</tt>) state.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#clone()">clone</A></B>()</CODE>
<BR>
Cloning this <code>BitVector</code> produces a new <code>BitVector</code>
that is equal to it.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#copy()">copy</A></B>()</CODE>
<BR>
Returns a deep copy of the receiver; calls <code>clone()</code> and casts the result.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> long[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#elements()">elements</A></B>()</CODE>
<BR>
You normally need not use this method.</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="../../../cern/colt/bitvector/BitVector.html#elements(long[], int)">elements</A></B>(long[] bits,
int size)</CODE>
<BR>
You normally need not use this method.</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="../../../cern/colt/bitvector/BitVector.html#equals(java.lang.Object)">equals</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> obj)</CODE>
<BR>
Compares this object against the specified object.</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="../../../cern/colt/bitvector/BitVector.html#forEachIndexFromToInState(int, int, boolean, cern.colt.function.IntProcedure)">forEachIndexFromToInState</A></B>(int from,
int to,
boolean state,
<A HREF="../../../cern/colt/function/IntProcedure.html" title="interface in cern.colt.function">IntProcedure</A> procedure)</CODE>
<BR>
Applies a procedure to each bit index within the specified range that holds a bit in the given state.</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="../../../cern/colt/bitvector/BitVector.html#get(int)">get</A></B>(int bitIndex)</CODE>
<BR>
Returns from the bitvector the value of the bit with the specified index.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#getLongFromTo(int, int)">getLongFromTo</A></B>(int from,
int to)</CODE>
<BR>
Returns a long value representing bits of the receiver from index <tt>from</tt> to index <tt>to</tt>.</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="../../../cern/colt/bitvector/BitVector.html#getQuick(int)">getQuick</A></B>(int bitIndex)</CODE>
<BR>
Returns from the bitvector the value of the bit with the specified index; <b>WARNING:</b> Does not check preconditions.</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="../../../cern/colt/bitvector/BitVector.html#hashCode()">hashCode</A></B>()</CODE>
<BR>
Returns a hash code value for the receiver.</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="../../../cern/colt/bitvector/BitVector.html#indexOfFromTo(int, int, boolean)">indexOfFromTo</A></B>(int from,
int to,
boolean state)</CODE>
<BR>
Returns the index of the first occurrence of the specified
state.</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="../../../cern/colt/bitvector/BitVector.html#not()">not</A></B>()</CODE>
<BR>
Performs a logical <b>NOT</b> on the bits of the receiver (A = ~A).</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="../../../cern/colt/bitvector/BitVector.html#or(cern.colt.bitvector.BitVector)">or</A></B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</CODE>
<BR>
Performs a logical <b>OR</b> of the receiver with another bit vector (A = A | B).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#partFromTo(int, int)">partFromTo</A></B>(int from,
int to)</CODE>
<BR>
Constructs and returns a new bit vector which is a copy of the given range.</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="../../../cern/colt/bitvector/BitVector.html#put(int, boolean)">put</A></B>(int bitIndex,
boolean value)</CODE>
<BR>
Sets the bit with index <tt>bitIndex</tt> to the state specified by <tt>value</tt>.</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="../../../cern/colt/bitvector/BitVector.html#putLongFromTo(long, int, int)">putLongFromTo</A></B>(long value,
int from,
int to)</CODE>
<BR>
Sets bits of the receiver from index <code>from</code> to index <code>to</code> to the bits of <code>value</code>.</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="../../../cern/colt/bitvector/BitVector.html#putQuick(int, boolean)">putQuick</A></B>(int bitIndex,
boolean value)</CODE>
<BR>
Sets the bit with index <tt>bitIndex</tt> to the state specified by <tt>value</tt>; <b>WARNING:</b> Does not check preconditions.</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="../../../cern/colt/bitvector/BitVector.html#replaceFromToWith(int, int, cern.colt.bitvector.BitVector, int)">replaceFromToWith</A></B>(int from,
int to,
<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> source,
int sourceFrom)</CODE>
<BR>
Replaces the bits of the receiver in the given range with the bits of another bit vector.</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="../../../cern/colt/bitvector/BitVector.html#replaceFromToWith(int, int, boolean)">replaceFromToWith</A></B>(int from,
int to,
boolean value)</CODE>
<BR>
Sets the bits in the given range to the state specified by <tt>value</tt>.</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="../../../cern/colt/bitvector/BitVector.html#set(int)">set</A></B>(int bitIndex)</CODE>
<BR>
Changes the bit with index <tt>bitIndex</tt> to the "set" (<tt>true</tt>) state.</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="../../../cern/colt/bitvector/BitVector.html#setSize(int)">setSize</A></B>(int newSize)</CODE>
<BR>
Shrinks or expands the receiver so that it holds <tt>newSize</tt> bits.</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="../../../cern/colt/bitvector/BitVector.html#size()">size</A></B>()</CODE>
<BR>
Returns the size of the receiver.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../cern/colt/bitvector/BitVector.html#toString()">toString</A></B>()</CODE>
<BR>
Returns a string representation of the receiver.</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="../../../cern/colt/bitvector/BitVector.html#xor(cern.colt.bitvector.BitVector)">xor</A></B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</CODE>
<BR>
Performs a logical <b>XOR</b> of the receiver with another bit vector (A = A ^ B).</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">
<TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="BitVector(long[], int)"><!-- --></A><H3>
BitVector</H3>
<PRE>
public <B>BitVector</B>(long[] bits,
int size)</PRE>
<DL>
<DD>You normally need not use this method. Use this method only if performance is critical.
Constructs a bit vector with the given backing bits and size.
<b>WARNING:</b> For efficiency reasons and to keep memory usage low, <b>the array is not copied</b>.
So if subsequently you modify the specified array directly via the [] operator, be sure you know what you're doing.
<p>A bitvector is modelled as a long array, i.e. <tt>long[] bits</tt> holds bits of a bitvector.
Each long value holds 64 bits.
The i-th bit is stored in bits[i/64] at
bit position i % 64 (where bit position 0 refers to the least
significant bit and 63 refers to the most significant bit).
<P>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size < 0 || size > bits.length*64</tt>.</DL>
<HR>
<A NAME="BitVector(int)"><!-- --></A><H3>
BitVector</H3>
<PRE>
public <B>BitVector</B>(int size)</PRE>
<DL>
<DD>Constructs a bit vector that holds <tt>size</tt> bits. All bits are initially <tt>false</tt>.
<P>
<DT><B>Parameters:</B><DD><CODE>size</CODE> - the number of bits the bit vector shall have.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size < 0</tt>.</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="and(cern.colt.bitvector.BitVector)"><!-- --></A><H3>
and</H3>
<PRE>
public void <B>and</B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</PRE>
<DL>
<DD>Performs a logical <b>AND</b> of the receiver with another bit vector (A = A & B).
The receiver is modified so that a bit in it has the
value <code>true</code> if and only if it already had the
value <code>true</code> and the corresponding bit in the other bit vector
argument has the value <code>true</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>other</CODE> - a bit vector.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size() > other.size()</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="andNot(cern.colt.bitvector.BitVector)"><!-- --></A><H3>
andNot</H3>
<PRE>
public void <B>andNot</B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</PRE>
<DL>
<DD>Clears all of the bits in receiver whose corresponding
bit is set in the other bitvector (A = A \ B).
In other words, determines the difference (A=A\B) between two bitvectors.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>other</CODE> - a bitvector with which to mask the receiver.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size() > other.size()</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="cardinality()"><!-- --></A><H3>
cardinality</H3>
<PRE>
public int <B>cardinality</B>()</PRE>
<DL>
<DD>Returns the number of bits currently in the <tt>true</tt> state.
Optimized for speed. Particularly quick if the receiver is either sparse or dense.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="clear()"><!-- --></A><H3>
clear</H3>
<PRE>
public void <B>clear</B>()</PRE>
<DL>
<DD>Clears all bits of the receiver.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="clear(int)"><!-- --></A><H3>
clear</H3>
<PRE>
public void <B>clear</B>(int bitIndex)</PRE>
<DL>
<DD>Changes the bit with index <tt>bitIndex</tt> to the "clear" (<tt>false</tt>) state.
<P>
<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="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>bitIndex<0 || bitIndex>=size()</tt></DL>
</DD>
</DL>
<HR>
<A NAME="clone()"><!-- --></A><H3>
clone</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>clone</B>()</PRE>
<DL>
<DD>Cloning this <code>BitVector</code> produces a new <code>BitVector</code>
that is equal to it.
The clone of the bit vector is another bit vector that has exactly the
same bits set to <code>true</code> as this bit vector and the same
current size, but independent state.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../cern/colt/PersistentObject.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../../cern/colt/PersistentObject.html" title="class in cern.colt">PersistentObject</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a deep copy of this bit vector.</DL>
</DD>
</DL>
<HR>
<A NAME="copy()"><!-- --></A><H3>
copy</H3>
<PRE>
public <A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> <B>copy</B>()</PRE>
<DL>
<DD>Returns a deep copy of the receiver; calls <code>clone()</code> and casts the result.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>a deep copy of the receiver.</DL>
</DD>
</DL>
<HR>
<A NAME="elements()"><!-- --></A><H3>
elements</H3>
<PRE>
public long[] <B>elements</B>()</PRE>
<DL>
<DD>You normally need not use this method. Use this method only if performance is critical.
Returns the bit vector's backing bits.
<b>WARNING:</b> For efficiency reasons and to keep memory usage low, <b>the array is not copied</b>.
So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.
<p>A bitvector is modelled as a long array, i.e. <tt>long[] bits</tt> holds bits of a bitvector.
Each long value holds 64 bits.
The i-th bit is stored in bits[i/64] at
bit position i % 64 (where bit position 0 refers to the least
significant bit and 63 refers to the most significant bit).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="elements(long[], int)"><!-- --></A><H3>
elements</H3>
<PRE>
public void <B>elements</B>(long[] bits,
int size)</PRE>
<DL>
<DD>You normally need not use this method. Use this method only if performance is critical.
Sets the bit vector's backing bits and size.
<b>WARNING:</b> For efficiency reasons and to keep memory usage low, <b>the array is not copied</b>.
So if subsequently you modify the specified array directly via the [] operator, be sure you know what you're doing.
<p>A bitvector is modelled as a long array, i.e. <tt>long[] bits</tt> holds bits of a bitvector.
Each long value holds 64 bits.
The i-th bit is stored in bits[i/64] at
bit position i % 64 (where bit position 0 refers to the least
significant bit and 63 refers to the most significant bit).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bits</CODE> - the backing bits of the bit vector.<DD><CODE>size</CODE> - the number of bits the bit vector shall hold.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size < 0 || size > bits.length*64</tt>.</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.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>BitVector</code> object
that has the same size as the receiver and
the same bits set to <code>true</code> as the receiver.
That is, for every nonnegative <code>int</code> index <code>k</code>,
<pre>((BitVector)obj).get(k) == this.get(k)</pre>
must be true.
<P>
<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.</DL>
</DD>
</DL>
<HR>
<A NAME="forEachIndexFromToInState(int, int, boolean, cern.colt.function.IntProcedure)"><!-- --></A><H3>
forEachIndexFromToInState</H3>
<PRE>
public boolean <B>forEachIndexFromToInState</B>(int from,
int to,
boolean state,
<A HREF="../../../cern/colt/function/IntProcedure.html" title="interface in cern.colt.function">IntProcedure</A> procedure)</PRE>
<DL>
<DD>Applies a procedure to each bit index within the specified range that holds a bit in the given state.
Starts at index <tt>from</tt>, moves rightwards to <tt>to</tt>.
Useful, for example, if you want to copy bits into an image or somewhere else.
<p>
Optimized for speed. Particularly quick if one of the following conditions holds
<ul>
<li><tt>state==true</tt> and the receiver is sparse (<tt>cardinality()</tt> is small compared to <tt>size()</tt>).
<li><tt>state==false</tt> and the receiver is dense (<tt>cardinality()</tt> is large compared to <tt>size()</tt>).
</ul>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the leftmost search position, inclusive.<DD><CODE>to</CODE> - the rightmost search position, inclusive.<DD><CODE>state</CODE> - element to search for.<DD><CODE>procedure</CODE> - a procedure object taking as argument the current bit index. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
<DT><B>Returns:</B><DD><tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).</DL>
</DD>
</DL>
<HR>
<A NAME="get(int)"><!-- --></A><H3>
get</H3>
<PRE>
public boolean <B>get</B>(int bitIndex)</PRE>
<DL>
<DD>Returns from the bitvector the value of the bit with the specified index.
The value is <tt>true</tt> if the bit with the index <tt>bitIndex</tt>
is currently set; otherwise, returns <tt>false</tt>.
<P>
<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="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>bitIndex<0 || bitIndex>=size()</tt></DL>
</DD>
</DL>
<HR>
<A NAME="getLongFromTo(int, int)"><!-- --></A><H3>
getLongFromTo</H3>
<PRE>
public long <B>getLongFromTo</B>(int from,
int to)</PRE>
<DL>
<DD>Returns a long value representing bits of the receiver from index <tt>from</tt> to index <tt>to</tt>.
Bits are returned as a long value with the return value having bit 0 set to bit <code>from</code>, ..., bit <code>to-from</code> set to bit <code>to</code>.
All other bits of the return value are set to 0.
If <tt>to-from+1==0</tt> then returns zero (<tt>0L</tt>).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - index of start bit (inclusive).<DD><CODE>to</CODE> - index of end bit (inclusive).
<DT><B>Returns:</B><DD>the specified bits as long value.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>from<0 || from>=size() || to<0 || to>=size() || to-from+1<0 || to-from+1>64</tt></DL>
</DD>
</DL>
<HR>
<A NAME="getQuick(int)"><!-- --></A><H3>
getQuick</H3>
<PRE>
public boolean <B>getQuick</B>(int bitIndex)</PRE>
<DL>
<DD>Returns from the bitvector the value of the bit with the specified index; <b>WARNING:</b> Does not check preconditions.
The value is <tt>true</tt> if the bit with the index <tt>bitIndex</tt>
is currently set; otherwise, returns <tt>false</tt>.
<p>Provided with invalid parameters this method may return invalid values without throwing any exception.
<b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
Precondition (unchecked): <tt>bitIndex >= 0 && bitIndex < size()</tt>.
<P>
<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.</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 the receiver. The hash code
depends only on which bits have been set within the receiver.
The algorithm used to compute it may
be described as follows.<p>
Suppose the bits in the receiver 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 receiver (for nonnegative values of
<code>k</code>) if and only if the expression
<pre>((k>>6) < bits.length) && ((bits[k>>6] & (1L << (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 int hashCode() {
long h = 1234;
for (int i = bits.length; --i >= 0; ) {
h ^= bits[i] * (i + 1);
}
return (int)((h >> 32) ^ h);
}</pre>
Note that the hash code values change if the set of bits is altered.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>a hash code value for the receiver.</DL>
</DD>
</DL>
<HR>
<A NAME="indexOfFromTo(int, int, boolean)"><!-- --></A><H3>
indexOfFromTo</H3>
<PRE>
public int <B>indexOfFromTo</B>(int from,
int to,
boolean state)</PRE>
<DL>
<DD>Returns the index of the first occurrence of the specified
state. Returns <code>-1</code> if the receiver does not contain this state.
Searches between <code>from</code>, inclusive and <code>to</code>, inclusive.
<p>
Optimized for speed. Preliminary performance (200Mhz Pentium Pro, JDK 1.2, NT): size=10^6, from=0, to=size-1, receiver contains matching state in the very end --> 0.002 seconds elapsed time.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>state</CODE> - state to search for.<DD><CODE>from</CODE> - the leftmost search position, inclusive.<DD><CODE>to</CODE> - the rightmost search position, inclusive.
<DT><B>Returns:</B><DD>the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).</DL>
</DD>
</DL>
<HR>
<A NAME="not()"><!-- --></A><H3>
not</H3>
<PRE>
public void <B>not</B>()</PRE>
<DL>
<DD>Performs a logical <b>NOT</b> on the bits of the receiver (A = ~A).
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="or(cern.colt.bitvector.BitVector)"><!-- --></A><H3>
or</H3>
<PRE>
public void <B>or</B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</PRE>
<DL>
<DD>Performs a logical <b>OR</b> of the receiver with another bit vector (A = A | B).
The receiver 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 other bit vector
argument has the value <code>true</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>other</CODE> - a bit vector.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size() > other.size()</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="partFromTo(int, int)"><!-- --></A><H3>
partFromTo</H3>
<PRE>
public <A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> <B>partFromTo</B>(int from,
int to)</PRE>
<DL>
<DD>Constructs and returns a new bit vector which is a copy of the given range.
The new bitvector has <tt>size()==to-from+1</tt>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the start index within the receiver, inclusive.<DD><CODE>to</CODE> - the end index within the receiver, inclusive.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>size()>0 && (from<0 || from>to || to>=size()))</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="put(int, boolean)"><!-- --></A><H3>
put</H3>
<PRE>
public void <B>put</B>(int bitIndex,
boolean value)</PRE>
<DL>
<DD>Sets the bit with index <tt>bitIndex</tt> to the state specified by <tt>value</tt>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - the index of the bit to be changed.<DD><CODE>value</CODE> - the value to be stored in the bit.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>bitIndex<0 || bitIndex>=size()</tt></DL>
</DD>
</DL>
<HR>
<A NAME="putLongFromTo(long, int, int)"><!-- --></A><H3>
putLongFromTo</H3>
<PRE>
public void <B>putLongFromTo</B>(long value,
int from,
int to)</PRE>
<DL>
<DD>Sets bits of the receiver from index <code>from</code> to index <code>to</code> to the bits of <code>value</code>.
Bit <code>from</code> is set to bit 0 of <code>value</code>, ..., bit <code>to</code> is set to bit <code>to-from</code> of <code>value</code>.
All other bits stay unaffected.
If <tt>to-from+1==0</tt> then does nothing.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to be copied into the receiver.<DD><CODE>from</CODE> - index of start bit (inclusive).<DD><CODE>to</CODE> - index of end bit (inclusive).
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>from<0 || from>=size() || to<0 || to>=size() || to-from+1<0 || to-from+1>64</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="putQuick(int, boolean)"><!-- --></A><H3>
putQuick</H3>
<PRE>
public void <B>putQuick</B>(int bitIndex,
boolean value)</PRE>
<DL>
<DD>Sets the bit with index <tt>bitIndex</tt> to the state specified by <tt>value</tt>; <b>WARNING:</b> Does not check preconditions.
<p>Provided with invalid parameters this method may set invalid values without throwing any exception.
<b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
Precondition (unchecked): <tt>bitIndex >= 0 && bitIndex < size()</tt>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - the index of the bit to be changed.<DD><CODE>value</CODE> - the value to be stored in the bit.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceFromToWith(int, int, cern.colt.bitvector.BitVector, int)"><!-- --></A><H3>
replaceFromToWith</H3>
<PRE>
public void <B>replaceFromToWith</B>(int from,
int to,
<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> source,
int sourceFrom)</PRE>
<DL>
<DD>Replaces the bits of the receiver in the given range with the bits of another bit vector.
Replaces the range <tt>[from,to]</tt> with the contents of the range <tt>[sourceFrom,sourceFrom+to-from]</tt>, all inclusive.
If <tt>source==this</tt> and the source and destination range intersect in an ambiguous way, then replaces as if using an intermediate auxiliary copy of the receiver.
<p>
Optimized for speed. Preliminary performance (200Mhz Pentium Pro, JDK 1.2, NT): replace 10^6 ill aligned bits --> 0.02 seconds elapsed time.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the start index within the receiver, inclusive.<DD><CODE>to</CODE> - the end index within the receiver, inclusive.<DD><CODE>source</CODE> - the source bitvector to copy from.<DD><CODE>sourceFrom</CODE> - the start index within <tt>source</tt>, inclusive.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>size()>0 && (from<0 || from>to || to>=size() || sourceFrom<0 || sourceFrom+to-from+1>source.size()))</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="replaceFromToWith(int, int, boolean)"><!-- --></A><H3>
replaceFromToWith</H3>
<PRE>
public void <B>replaceFromToWith</B>(int from,
int to,
boolean value)</PRE>
<DL>
<DD>Sets the bits in the given range to the state specified by <tt>value</tt>.
<p>
Optimized for speed. Preliminary performance (200Mhz Pentium Pro, JDK 1.2, NT): replace 10^6 ill aligned bits --> 0.002 seconds elapsed time.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the start index, inclusive.<DD><CODE>to</CODE> - the end index, inclusive.<DD><CODE>value</CODE> - the value to be stored in the bits of the range.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>size()>0 && (from<0 || from>to || to>=size())</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="set(int)"><!-- --></A><H3>
set</H3>
<PRE>
public void <B>set</B>(int bitIndex)</PRE>
<DL>
<DD>Changes the bit with index <tt>bitIndex</tt> to the "set" (<tt>true</tt>) state.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bitIndex</CODE> - the index of the bit to be set.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IndexOutOfBoundsException.html" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <tt>bitIndex<0 || bitIndex>=size()</tt></DL>
</DD>
</DL>
<HR>
<A NAME="setSize(int)"><!-- --></A><H3>
setSize</H3>
<PRE>
public void <B>setSize</B>(int newSize)</PRE>
<DL>
<DD>Shrinks or expands the receiver so that it holds <tt>newSize</tt> bits.
If the receiver is expanded, additional <tt>false</tt> bits are added to the end.
If the receiver is shrinked, all bits between the old size and the new size are lost; their memory is subject to garbage collection.
(This method introduces a new backing array of elements. WARNING: if you have more than one BitVector or BitMatrix sharing identical backing elements, be sure you know what you are doing.)
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>newSize</CODE> - the number of bits the bit vector shall have.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size < 0</tt>.</DL>
</DD>
</DL>
<HR>
<A NAME="size()"><!-- --></A><H3>
size</H3>
<PRE>
public int <B>size</B>()</PRE>
<DL>
<DD>Returns the size of the receiver.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE>
<DL>
<DD>Returns a string representation of the receiver. For every index
for which the receiver contains a bit in the "set" (<tt>true</tt>)
state, the decimal representation of that index is included in
the result. Such indeces are listed in order from lowest to
highest, separated by ", " (a comma and a space) and
surrounded by braces.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>a string representation of this bit vector.</DL>
</DD>
</DL>
<HR>
<A NAME="xor(cern.colt.bitvector.BitVector)"><!-- --></A><H3>
xor</H3>
<PRE>
public void <B>xor</B>(<A HREF="../../../cern/colt/bitvector/BitVector.html" title="class in cern.colt.bitvector">BitVector</A> other)</PRE>
<DL>
<DD>Performs a logical <b>XOR</b> of the receiver with another bit vector (A = A ^ B).
The receiver 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>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>other</CODE> - a bit vector.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>size() > other.size()</tt>.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_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="class-use/BitVector.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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>
<b>Colt 1.2.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../cern/colt/bitvector/BitMatrix.html" title="class in cern.colt.bitvector"><B>PREV CLASS</B></A>
<A HREF="../../../cern/colt/bitvector/QuickBitVector.html" title="class in cern.colt.bitvector"><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="BitVector.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: NESTED | <A HREF="#fields_inherited_from_class_cern.colt.PersistentObject">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: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size=-1 >Jump to the <a target=_top href=http://dsd.lbl.gov/~hoschek/colt >Colt Homepage</a>
</BODY>
</HTML>
|