DESY ACOP Beans Home

com.cosylab.util
Class BitSetUtilities

java.lang.Object
  extended by com.cosylab.util.BitSetUtilities

public final class BitSetUtilities
extends java.lang.Object

BitSetUtilities containes usefull clases to manipulate with BitSet.

Since:
Dec 22, 2003.
Version:
$Id: BitSetUtilities.java,v 1.4 2008-04-22 12:26:29 jbobnar Exp $
Author:
Igor Kriznar

Method Summary
static java.util.BitSet forLong(long value)
          Converts long value to BitSet.
static long getMaskedValue(long bits, long mask)
          Returns bit pattern by ignoring all zeros in the mask.
static long toLong(java.util.BitSet value)
          Converts BitSet to long value if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forLong

public static java.util.BitSet forLong(long value)
Converts long value to BitSet.

Parameters:
value - the long value
Returns:
the BitSet corresponding to the value

toLong

public static long toLong(java.util.BitSet value)
Converts BitSet to long value if possible.

Parameters:
value - the BitSet object
Returns:
long representatnion of the bit set
Throws:
java.lang.NullPointerException - DOCUMENT ME!

getMaskedValue

public static long getMaskedValue(long bits,
                                  long mask)
Returns bit pattern by ignoring all zeros in the mask. If mask is less than 0, return value is equal to bits parameter.

Example:
mask = XX10101 bits = XX10010 getCompactValue() = XXXXX100

Parameters:
bits - bit pattern as long value
mask - mask which tells, which bits in pattern are visible, if less than 0, maks is ignored
Returns:
long maksed representation of the bit pattern.


Copyright © 2010. All Rights Reserved.