Java Doc for FormatableBitSet.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » services » io » 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 » Database DBMS » db derby 10.2 » org.apache.derby.iapi.services.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.iapi.services.io.FormatableBitSet

FormatableBitSet
final public class FormatableBitSet implements Formatable,Cloneable(Code)
FormatableBitSet is implemented as a packed array of bytes.
author:
   Jamie -- originally coded by Jeff



Constructor Summary
public  FormatableBitSet()
    
public  FormatableBitSet(int numBits)
    
public  FormatableBitSet(byte[] newValue)
     Constructs a Bit from an array of bytes.
public  FormatableBitSet(byte[] newValue, int numBits)
     Constructs a Bit from an array of bytes.
public  FormatableBitSet(FormatableBitSet original)
    

Method Summary
public  voidand(FormatableBitSet otherBit)
     Bitwise AND this Bit with another Bit.
public  intanySetBit()
     If any bit is set, return the bit number of a bit that is set.
public  intanySetBit(int beyondBit)
     Like anySetBit(), but return any set bit whose number is bigger than beyondBit.
public  voidclear(int position)
    
public  voidclear()
    
public  Objectclone()
    
public  intcompare(FormatableBitSet other)
     Bit comparison.
public  FormatableBitSetconcatenate(FormatableBitSet other)
     Bit concatenation.
public  booleanequals(FormatableBitSet other)
     Bit equivalence.
final public  booleanget(int position)
    
public  byte[]getByteArray()
    
public  intgetLength()
     Get the length in bits The length in bits for this valueNOTE: could possibly be changed to a long.
public  intgetLengthInBytes()
    
public  intgetNumBitsSet()
     Get a count of the number of bits that are set.
public  intgetTypeFormatId()
     Get the formatID which corresponds to this class.
public  voidgrow(int n)
     Grow (widen) a FormatableBitSet to N bis
Parameters:
  n - The number of bits you want.
public  inthashCode()
     Produce a hash code by putting the value bytes into an int, exclusive OR'ing if there are more than 4 bytes.
public  booleanisNull()
    
final public  booleanisSet(int position)
    
public static  intmaxBitsForSpace(int numBytes)
     Statically calculates how many bits can fit into the number of bytes if this Bit object is externalized.
protected static  intnumBytesFromBits(int bits)
     Figure out how many bytes are needed to store the input number of bits.
public  voidor(FormatableBitSet otherBit)
     Bitwise OR this Bit with another Bit.
public  voidreadExternal(ObjectInput in)
     Note: gracefully handles zero length bits -- will create a zero length array with no bits being used.
public  voidreadExternalFromArray(ArrayInputStream in)
    
public  voidset(int position)
    
public  FormatableBitSetshrink(int n)
     Shrink (narrow) a FormatableBitSet to N bits
Parameters:
  n - The number of bits the caller wants.
public  intsize()
    
public  StringtoString()
     Format the string into BitSet format: {0, 2, 4, 8} if bits 0, 2, 4, 8 are set.
public  voidwriteExternal(ObjectOutput out)
    
public  voidxor(FormatableBitSet set)
     Logically XORs this FormatableBitSet with the specified FormatableBitSet.


Constructor Detail
FormatableBitSet
public FormatableBitSet()(Code)
Niladic Constructor



FormatableBitSet
public FormatableBitSet(int numBits)(Code)
Constructs a Bit with the initial number of bits



FormatableBitSet
public FormatableBitSet(byte[] newValue)(Code)
Constructs a Bit from an array of bytes. Assume bytes are all being used.
Parameters:
  newValue - The array of bytes to make up the new Bit



FormatableBitSet
public FormatableBitSet(byte[] newValue, int numBits)(Code)
Constructs a Bit from an array of bytes.
Parameters:
  newValue - The array of bytes to make up the new Bit
Parameters:
  numBits - The number of bits



FormatableBitSet
public FormatableBitSet(FormatableBitSet original)(Code)
Copy constructor
Parameters:
  original - the FormatableBitSet to make a copy from




Method Detail
and
public void and(FormatableBitSet otherBit)(Code)
Bitwise AND this Bit with another Bit.
Parameters:
  otherBit - the other Bit



anySetBit
public int anySetBit()(Code)
If any bit is set, return the bit number of a bit that is set. If no bit is set, return -1; the bit number of a bit that is set, or -1 if no bit is set



anySetBit
public int anySetBit(int beyondBit)(Code)
Like anySetBit(), but return any set bit whose number is bigger than beyondBit. If no bit is set after beyondBit, -1 is returned. By using anySetBit() and anySetBit(beyondBit), one can quickly go thru the entire bit array to return all set bit.
Parameters:
  beyondBit - only look at bit that is greater than this bit number the bit number of a bit that is set, or -1 if no bit afterbeyondBit is set



clear
public void clear(int position)(Code)
Bit clear
Parameters:
  position - the bit to clear



clear
public void clear()(Code)
Clear all the bits in this FormatableBitSet



clone
public Object clone()(Code)



compare
public int compare(FormatableBitSet other)(Code)
Bit comparison. Compare this with other. Will always do a byte by byte compare. Given 2 similar bits of unequal lengths (x and y), where x.getLength() < y.getLength() but where: x[0..x.getLength()] == y[0..x.getLength()] then x < y.
Parameters:
  other - the other bit to compare to -1 - if other < this0 - if other == this1 - if other > this



concatenate
public FormatableBitSet concatenate(FormatableBitSet other)(Code)
Bit concatenation.
Parameters:
  other - the other bit to append to this Bit -- the newly concatenated bit



equals
public boolean equals(FormatableBitSet other)(Code)
Bit equivalence. Compare this with other. If the length is different, then cannot be equal so short circuit. Otherwise, rely on compare(). Note that two zero length bits are considered equal.
Parameters:
  other - the other bit to compare to TRUE|FALSE



get
final public boolean get(int position)(Code)
Bit get -- alias for isSet()
Parameters:
  position - the bit to check



getByteArray
public byte[] getByteArray()(Code)
Get the value of the byte array The value of the byte array



getLength
public int getLength()(Code)
Get the length in bits The length in bits for this valueNOTE: could possibly be changed to a long. As iswe are restricted to 2^(31-3) -> 256meg insteadof 2^31 (Integer.MAX_VALUE) like other datatypes(or 2 gig). If it is ever changed to a longbe sure to change read/writeExternal which writeout the length in bits.



getLengthInBytes
public int getLengthInBytes()(Code)
Get the length in bytes of a Bit value The length in bytes of this value



getNumBitsSet
public int getNumBitsSet()(Code)
Get a count of the number of bits that are set. The number of bits that are set.



getTypeFormatId
public int getTypeFormatId()(Code)
Get the formatID which corresponds to this class. the formatID of this class



grow
public void grow(int n)(Code)
Grow (widen) a FormatableBitSet to N bis
Parameters:
  n - The number of bits you want. The bits arealways added as 0 and are appended to theleast significant end of the bit array.ASSUMPTIONS: that all extra bits in the last byteare zero.



hashCode
public int hashCode()(Code)
Produce a hash code by putting the value bytes into an int, exclusive OR'ing if there are more than 4 bytes. the hash code



isNull
public boolean isNull()(Code)
Set the value of the byte array The value of the byte array



isSet
final public boolean isSet(int position)(Code)
Bit isSet
Parameters:
  position - the bit to check



maxBitsForSpace
public static int maxBitsForSpace(int numBytes)(Code)
Statically calculates how many bits can fit into the number of bytes if this Bit object is externalized. Only valid for this implementation of Bit.



numBytesFromBits
protected static int numBytesFromBits(int bits)(Code)
Figure out how many bytes are needed to store the input number of bits.
Parameters:
  bits - bits the number of bytes



or
public void or(FormatableBitSet otherBit)(Code)
Bitwise OR this Bit with another Bit.
Parameters:
  otherBit - the other Bit



readExternal
public void readExternal(ObjectInput in) throws IOException(Code)
Note: gracefully handles zero length bits -- will create a zero length array with no bits being used. Fortunately in.read() is ok with a zero length array so no special code.

WARNING: this method cannot be changed w/o changing SQLBit because SQLBit calls this directly w/o calling read/writeObject(), so the format id is not stored in that case.
See Also:   java.io.Externalizable.readExternal




readExternalFromArray
public void readExternalFromArray(ArrayInputStream in) throws IOException(Code)



set
public void set(int position)(Code)
Bit set
Parameters:
  position - the bit to set



shrink
public FormatableBitSet shrink(int n)(Code)
Shrink (narrow) a FormatableBitSet to N bits
Parameters:
  n - The number of bits the caller wants. Thebits are always removed from theleast significant end of the bit array.



size
public int size()(Code)
Get the length in bits -- alias for getLength() The length in bits for this value



toString
public String toString()(Code)
Format the string into BitSet format: {0, 2, 4, 8} if bits 0, 2, 4, 8 are set. A new String containing the formatted Bit value



writeExternal
public void writeExternal(ObjectOutput out) throws IOException(Code)
Format:
  • int length in bits
  • byte[]

See Also:   java.io.Externalizable.writeExternal



xor
public void xor(FormatableBitSet set)(Code)
Logically XORs this FormatableBitSet with the specified FormatableBitSet.
Parameters:
  set - The FormatableBitSet to be XORed with.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) 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.