Java Doc for BitSet.java in  » Apache-Harmony-Java-SE » java-package » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.BitSet

BitSet
public class BitSet implements Serializable,Cloneable(Code)
The BitSet class implements a bit field. Each element in a BitSet can be on(1) or off(0). A BitSet is created with a given size and grows when this size is exceeded. Growth is always rounded to a 64 bit boundary.



Constructor Summary
public  BitSet()
    
public  BitSet(int nbits)
     Create a new BitSet with size equal to nbits.

Method Summary
public  voidand(BitSet bs)
     Performs the logical AND of this BitSet with another BitSet.
public  voidandNot(BitSet bs)
     Clears all bits in the receiver which are also set in the parameter BitSet.
public  intcardinality()
     Answers the number of bits that are true in this bitset.
public  voidclear()
     Clears all the bits in this bitset.
public  voidclear(int pos)
     Clears the bit at index pos.
public  voidclear(int pos1, int pos2)
     Clears the bits starting from pos1 to pos2.
public  Objectclone()
    
public  booleanequals(Object obj)
     Compares the argument to this BitSet and answer if they are equal.
public  voidflip(int pos)
     Flips the bit at index pos.
public  voidflip(int pos1, int pos2)
     Flips the bits starting from pos1 to pos2.
public  booleanget(int pos)
     Retrieve the bit at index pos.
public  BitSetget(int pos1, int pos2)
     Retrieves the bits starting from pos1 to pos2 and answers back a new bitset made of these bits.
public  inthashCode()
     Computes the hash code for this BitSet.
public  booleanintersects(BitSet bs)
     Checks if these two bitsets have at least one bit set to true in the same position.
public  booleanisEmpty()
     Answers true if all the bits in this bitset are set to false.
public  intlength()
     Returns the number of bits up to and including the highest bit set.
public  intnextClearBit(int pos)
    
public  intnextSetBit(int pos)
    
public  voidor(BitSet bs)
     Performs the logical OR of this BitSet with another BitSet.
public  voidset(int pos)
     Sets the bit at index pos to 1.
public  voidset(int pos, boolean val)
     Sets the bit at index pos to the value.
public  voidset(int pos1, int pos2)
     Sets the bits starting from pos1 to pos2.
public  voidset(int pos1, int pos2, boolean val)
     Sets the bits starting from pos1 to pos2 to the given boolean value.
public  intsize()
     Answers the number of bits this bitset has.
public  StringtoString()
     Answers a string containing a concise, human-readable description of the receiver.
public  voidxor(BitSet bs)
     Performs the logical XOR of this BitSet with another BitSet.


Constructor Detail
BitSet
public BitSet()(Code)
Create a new BitSet with size equal to 64 bits
See Also:   BitSet.clear(int)
See Also:   BitSet.set(int)
See Also:   BitSet.clear()
See Also:   BitSet.clear(int,int)
See Also:   BitSet.set(int,boolean)
See Also:   BitSet.set(int,int)
See Also:   BitSet.set(int,int,boolean)



BitSet
public BitSet(int nbits)(Code)
Create a new BitSet with size equal to nbits. If nbits is not a multiple of 64, then create a BitSet with size nbits rounded to the next closest multiple of 64.
Parameters:
  nbits - the size of the bit set
throws:
  NegativeArraySizeException - if nbits < 0.
See Also:   BitSet.clear(int)
See Also:   BitSet.set(int)
See Also:   BitSet.clear()
See Also:   BitSet.clear(int,int)
See Also:   BitSet.set(int,boolean)
See Also:   BitSet.set(int,int)
See Also:   BitSet.set(int,int,boolean)




Method Detail
and
public void and(BitSet bs)(Code)
Performs the logical AND of this BitSet with another BitSet.
Parameters:
  bs - BitSet to AND with
See Also:   BitSet.or
See Also:   BitSet.xor



andNot
public void andNot(BitSet bs)(Code)
Clears all bits in the receiver which are also set in the parameter BitSet.
Parameters:
  bs - BitSet to ANDNOT with



cardinality
public int cardinality()(Code)
Answers the number of bits that are true in this bitset. the number of true bits in the set



clear
public void clear()(Code)
Clears all the bits in this bitset.
See Also:   BitSet.clear(int)
See Also:   BitSet.clear(int,int)



clear
public void clear(int pos)(Code)
Clears the bit at index pos. Grows the BitSet if pos > size.
Parameters:
  pos - the index of the bit to clear
throws:
  IndexOutOfBoundsException - when pos < 0
See Also:   BitSet.clear(int,int)



clear
public void clear(int pos1, int pos2)(Code)
Clears the bits starting from pos1 to pos2. Grows the BitSet if pos2 > size.
Parameters:
  pos1 - beginning position
Parameters:
  pos2 - ending position
throws:
  IndexOutOfBoundsException - when pos1 or pos2 is negative, or when pos2 is not smallerthan pos1
See Also:   BitSet.clear(int)



clone
public Object clone()(Code)
Create a copy of this BitSet A copy of this BitSet.



equals
public boolean equals(Object obj)(Code)
Compares the argument to this BitSet and answer if they are equal. The object must be an instance of BitSet with the same bits set.
Parameters:
  obj - the BitSet object to compare A boolean indicating whether or not this BitSet and obj are equal
See Also:   BitSet.hashCode



flip
public void flip(int pos)(Code)
Flips the bit at index pos. Grows the BitSet if pos > size.
Parameters:
  pos - the index of the bit to flip
throws:
  IndexOutOfBoundsException - when pos < 0
See Also:   BitSet.flip(int,int)



flip
public void flip(int pos1, int pos2)(Code)
Flips the bits starting from pos1 to pos2. Grows the BitSet if pos2 > size.
Parameters:
  pos1 - beginning position
Parameters:
  pos2 - ending position
throws:
  IndexOutOfBoundsException - when pos1 or pos2 is negative, or when pos2 is not smallerthan pos1
See Also:   BitSet.flip(int)



get
public boolean get(int pos)(Code)
Retrieve the bit at index pos. Grows the BitSet if pos > size.
Parameters:
  pos - the index of the bit to be retrieved true if the bit at pos is set,false otherwise
throws:
  IndexOutOfBoundsException - when pos < 0
See Also:   BitSet.clear(int)
See Also:   BitSet.set(int)
See Also:   BitSet.clear()
See Also:   BitSet.clear(int,int)
See Also:   BitSet.set(int,boolean)
See Also:   BitSet.set(int,int)
See Also:   BitSet.set(int,int,boolean)



get
public BitSet get(int pos1, int pos2)(Code)
Retrieves the bits starting from pos1 to pos2 and answers back a new bitset made of these bits. Grows the BitSet if pos2 > size.
Parameters:
  pos1 - beginning position
Parameters:
  pos2 - ending position new bitset
throws:
  IndexOutOfBoundsException - when pos1 or pos2 is negative, or when pos2 is not smallerthan pos1
See Also:   BitSet.get(int)



hashCode
public int hashCode()(Code)
Computes the hash code for this BitSet. The int representing the hash code for this bitset.
See Also:   BitSet.equals
See Also:   java.util.Hashtable



intersects
public boolean intersects(BitSet bs)(Code)
Checks if these two bitsets have at least one bit set to true in the same position.
Parameters:
  bs - BitSet used to calculate intersect true if bs intersects with this BitSet,false otherwise



isEmpty
public boolean isEmpty()(Code)
Answers true if all the bits in this bitset are set to false. true if the BitSet is empty, falseotherwise



length
public int length()(Code)
Returns the number of bits up to and including the highest bit set. the length of the BitSet



nextClearBit
public int nextClearBit(int pos)(Code)
Answers the position of the first bit that is false on or after pos
Parameters:
  pos - the starting position (inclusive) the position of the next bit set to false, even if it is furtherthan this bitset's size.



nextSetBit
public int nextSetBit(int pos)(Code)
Answers the position of the first bit that is true on or after pos
Parameters:
  pos - the starting position (inclusive) -1 if there is no bits that are set to true on or after pos.



or
public void or(BitSet bs)(Code)
Performs the logical OR of this BitSet with another BitSet.
Parameters:
  bs - BitSet to OR with
See Also:   BitSet.xor
See Also:   BitSet.and



set
public void set(int pos)(Code)
Sets the bit at index pos to 1. Grows the BitSet if pos > size.
Parameters:
  pos - the index of the bit to set
throws:
  IndexOutOfBoundsException - when pos < 0
See Also:   BitSet.clear(int)
See Also:   BitSet.clear()
See Also:   BitSet.clear(int,int)



set
public void set(int pos, boolean val)(Code)
Sets the bit at index pos to the value. Grows the BitSet if pos > size.
Parameters:
  pos - the index of the bit to set
Parameters:
  val - value to set the bit
throws:
  IndexOutOfBoundsException - when pos < 0
See Also:   BitSet.set(int)



set
public void set(int pos1, int pos2)(Code)
Sets the bits starting from pos1 to pos2. Grows the BitSet if pos2 > size.
Parameters:
  pos1 - beginning position
Parameters:
  pos2 - ending position
throws:
  IndexOutOfBoundsException - when pos1 or pos2 is negative, or when pos2 is not smallerthan pos1
See Also:   BitSet.set(int)



set
public void set(int pos1, int pos2, boolean val)(Code)
Sets the bits starting from pos1 to pos2 to the given boolean value. Grows the BitSet if pos2 > size.
Parameters:
  pos1 - beginning position
Parameters:
  pos2 - ending position
Parameters:
  val - value to set these bits
throws:
  IndexOutOfBoundsException - when pos1 or pos2 is negative, or when pos2 is not smallerthan pos1
See Also:   BitSet.set(int,int)



size
public int size()(Code)
Answers the number of bits this bitset has. The number of bits contained in this BitSet.
See Also:   BitSet.length



toString
public String toString()(Code)
Answers a string containing a concise, human-readable description of the receiver. A comma delimited list of the indices of all bits that are set.



xor
public void xor(BitSet bs)(Code)
Performs the logical XOR of this BitSet with another BitSet.
Parameters:
  bs - BitSet to XOR with
See Also:   BitSet.or
See Also:   BitSet.and



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.