org.enhydra.apache.xerces.validators.common
Class CMStateSet

java.lang.Object
  |
  +--org.enhydra.apache.xerces.validators.common.CMStateSet

class CMStateSet
extends Object

This class is a very simple bitset class. The DFA content model code needs to support a bit set, but the java BitSet class is way, way overkill. Our bitset never needs to be expanded after creation, hash itself, etc... Since the vast majority of content models will never require more than 64 bits, and since allocation of anything in Java is expensive, this class provides a hybrid implementation that uses two ints for instances that use 64 bits or fewer. It has a byte array reference member which will only be used if more than 64 bits are required. Note that the code that uses this class will never perform operations on sets of different sizes, so that check does not have to be made here.

Version:
 

Field Summary
(package private)  int fBitCount
           
(package private)  int fBits1
           
(package private)  int fBits2
           
(package private)  byte[] fByteArray
           
(package private)  int fByteCount
           
 
Constructor Summary
(package private) CMStateSet(int bitCount)
           
 
Method Summary
 boolean equals(Object o)
           
(package private)  boolean getBit(int bitToGet)
           
 int hashCode()
           
(package private)  void intersection(CMStateSet setToAnd)
           
(package private)  boolean isEmpty()
           
(package private)  boolean isSameSet(CMStateSet setToCompare)
           
(package private)  void setBit(int bitToSet)
           
(package private)  void setTo(CMStateSet srcSet)
           
 String toString()
           
(package private)  void union(CMStateSet setToOr)
           
(package private)  void zeroBits()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

fBitCount

int fBitCount

fByteCount

int fByteCount

fBits1

int fBits1

fBits2

int fBits2

fByteArray

byte[] fByteArray
Constructor Detail

CMStateSet

CMStateSet(int bitCount)
     throws CMException
Method Detail

toString

public String toString()
Overrides:
toString in class Object

intersection

final void intersection(CMStateSet setToAnd)

getBit

final boolean getBit(int bitToGet)
              throws CMException

isEmpty

final boolean isEmpty()

isSameSet

final boolean isSameSet(CMStateSet setToCompare)

union

final void union(CMStateSet setToOr)

setBit

final void setBit(int bitToSet)
           throws CMException

setTo

final void setTo(CMStateSet srcSet)
          throws CMException

zeroBits

final void zeroBits()

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 1999 The Apache Software Foundation. All Rights reserved.