Copyright © Rasmus Sten and contributors, 1997-2004

nu.dll.lyskom
Class Bitstring

java.lang.Object
  |
  +--nu.dll.lyskom.KomToken
        |
        +--nu.dll.lyskom.Bitstring
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ConfType, MembershipType

public class Bitstring
extends KomToken
implements java.io.Serializable

This class represents the LysKOM data type BITSTRING, which is a serie of ones and zeroes making up a vector of boolean "flags". It can thus be seen as an array of boolean values.

See Also:
Serialized Form

Field Summary
static int ITEM_SIZE
           
 
Fields inherited from class nu.dll.lyskom.KomToken
ARRAY, COMPL, HOLLERITH, PRIMITIVE
 
Constructor Summary
Bitstring()
          Creates an empty Bitstring
Bitstring(boolean[] bits)
          Creates a Bitstring out of an boolean[].
Bitstring(nu.dll.lyskom.KomToken bits)
          Creates a Bitstring out of the contents in the supplied KomToken
Bitstring(java.lang.String s)
          Creates a Bitstring out of the contents in the supplied String
 
Method Summary
 boolean getBitAt(int i)
          Returns the status at a specific position in this Bitstring.
 boolean[] getBits()
          Returns a boolean[] equal the bits' representation in this Bitstring.
 void setBitAt(int i, boolean value)
          Sets the value of a bit at a specific position in this Bitstring.
 java.lang.String toString()
           
 
Methods inherited from class nu.dll.lyskom.KomToken
equals, getContents, getType, intValue, isEol, setContents, toInt, toInteger
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ITEM_SIZE

public static int ITEM_SIZE
Constructor Detail

Bitstring

public Bitstring()
Creates an empty Bitstring


Bitstring

public Bitstring(nu.dll.lyskom.KomToken bits)
Creates a Bitstring out of the contents in the supplied KomToken

Parameters:
bits - the KomToken object containing BITSTRING data

Bitstring

public Bitstring(java.lang.String s)
Creates a Bitstring out of the contents in the supplied String

Parameters:
s - the String object containing BITSTRING data

Bitstring

public Bitstring(boolean[] bits)
Creates a Bitstring out of an boolean[].

Parameters:
bits - an array of boolean
Method Detail

getBitAt

public boolean getBitAt(int i)
Returns the status at a specific position in this Bitstring.

Parameters:
i - the position to look at

setBitAt

public void setBitAt(int i,
                     boolean value)
Sets the value of a bit at a specific position in this Bitstring.

Parameters:
i - the position to change
value - the new value

getBits

public boolean[] getBits()
Returns a boolean[] equal the bits' representation in this Bitstring.


toString

public java.lang.String toString()
Overrides:
toString in class KomToken

Copyright © Rasmus Sten and contributors, 1997-2004