ch.panter.li.bi.util
Class FlagTool

java.lang.Object
  extended by ch.panter.li.bi.util.FlagTool

public final class FlagTool
extends Object

Simplifies bit operations and makes them more readable. TODO: rewrite to own class

Since:
0.0.112
Version:
0.5.250
Author:
Leon Poyyayil

Constructor Summary
FlagTool()
           
 
Method Summary
static byte clear(byte pnFlagList, byte pnFlagToClear)
          Sets some specified bits in a flag list to '0'.
static char clear(char pnFlagList, char pnFlagToClear)
          Sets some specified bits in a flag list to '0'.
static int clear(int pnFlagList, int pnFlagToClear)
          Sets some specified bits in a flag list to '0'.
static long clear(long pnFlagList, long pnFlagToClear)
          Sets some specified bits in a flag list to '0'.
static short clear(short pnFlagList, short pnFlagToClear)
          Sets some specified bits in a flag list to '0'.
static boolean isSet(byte pnFlagList, byte pnFlagToTest)
          Tests whether some bits in a flag list are set to '1'.
static boolean isSet(char pnFlagList, char pnFlagToTest)
          Tests whether some bits in a flag list are set to '1'.
static boolean isSet(int pnFlagList, int pnFlagToTest)
          Tests whether some bits in a flag list are set to '1'.
static boolean isSet(long pnFlagList, long pnFlagToTest)
          Tests whether some bits in a flag list are set to '1'.
static boolean isSet(short pnFlagList, short pnFlagToTest)
          Tests whether some bits in a flag list are set to '1'.
static byte set(byte pnFlagList, byte pnFlagToSet)
          Sets some specified bits in a flag list to '1'.
static byte set(byte pnFlagList, byte pnFlagToSet, boolean pbSet)
          Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.
static char set(char pnFlagList, char pnFlagToSet)
          Sets some specified bits in a flag list to '1'.
static char set(char pnFlagList, char pnFlagToSet, boolean pbSet)
          Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.
static int set(int pnFlagList, int pnFlagToSet)
          Sets some specified bits in a flag list to '1'.
static int set(int pnFlagList, int pnFlagToSet, boolean pbSet)
          Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.
static long set(long pnFlagList, long pnFlagToSet)
          Sets some specified bits in a flag list to '1'.
static long set(long pnFlagList, long pnFlagToSet, boolean pbSet)
          Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.
static short set(short pnFlagList, short pnFlagToSet)
          Sets some specified bits in a flag list to '1'.
static short set(short pnFlagList, short pnFlagToSet, boolean pbSet)
          Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlagTool

public FlagTool()
Method Detail

set

public static byte set(byte pnFlagList,
                       byte pnFlagToSet)
Sets some specified bits in a flag list to '1'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to '1'
Returns:
the 'modified' flag list with the desired bits set to '1'
Since:
0.0.112

set

public static byte set(byte pnFlagList,
                       byte pnFlagToSet,
                       boolean pbSet)
Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to the desired state
pbSet - the state to set the flags to: true means '1', false means '0'
Returns:
the 'modified' flag list with the desired bits set according to pbSet
Since:
0.0.112

clear

public static byte clear(byte pnFlagList,
                         byte pnFlagToClear)
Sets some specified bits in a flag list to '0'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToClear - the flags to set to '0'
Returns:
the 'modified' flag list with the desired bits set to '0'
Since:
0.0.112

isSet

public static boolean isSet(byte pnFlagList,
                            byte pnFlagToTest)
Tests whether some bits in a flag list are set to '1'.

Parameters:
pnFlagList - the list of flags to test
pnFlagToTest - the flags to check for state '1'
Returns:
true if all non-zero bits of pnFlagToTest are set to '1' in pnFlagList, false otherwise
Since:
0.0.112

set

public static short set(short pnFlagList,
                        short pnFlagToSet)
Sets some specified bits in a flag list to '1'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to '1'
Returns:
the 'modified' flag list with the desired bits set to '1'
Since:
0.0.112

set

public static short set(short pnFlagList,
                        short pnFlagToSet,
                        boolean pbSet)
Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to the desired state
pbSet - the state to set the flags to: true means '1', false means '0'
Returns:
the 'modified' flag list with the desired bits set according to pbSet
Since:
0.0.112

clear

public static short clear(short pnFlagList,
                          short pnFlagToClear)
Sets some specified bits in a flag list to '0'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToClear - the flags to set to '0'
Returns:
the 'modified' flag list with the desired bits set to '0'
Since:
0.0.112

isSet

public static boolean isSet(short pnFlagList,
                            short pnFlagToTest)
Tests whether some bits in a flag list are set to '1'.

Parameters:
pnFlagList - the list of flags to test
pnFlagToTest - the flags to check for state '1'
Returns:
true if all non-zero bits of pnFlagToTest are set to '1' in pnFlagList, false otherwise
Since:
0.0.112

set

public static char set(char pnFlagList,
                       char pnFlagToSet)
Sets some specified bits in a flag list to '1'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to '1'
Returns:
the 'modified' flag list with the desired bits set to '1'
Since:
0.0.112

set

public static char set(char pnFlagList,
                       char pnFlagToSet,
                       boolean pbSet)
Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to the desired state
pbSet - the state to set the flags to: true means '1', false means '0'
Returns:
the 'modified' flag list with the desired bits set according to pbSet
Since:
0.0.112

clear

public static char clear(char pnFlagList,
                         char pnFlagToClear)
Sets some specified bits in a flag list to '0'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToClear - the flags to set to '0'
Returns:
the 'modified' flag list with the desired bits set to '0'
Since:
0.0.112

isSet

public static boolean isSet(char pnFlagList,
                            char pnFlagToTest)
Tests whether some bits in a flag list are set to '1'.

Parameters:
pnFlagList - the list of flags to test
pnFlagToTest - the flags to check for state '1'
Returns:
true if all non-zero bits of pnFlagToTest are set to '1' in pnFlagList, false otherwise
Since:
0.0.112

set

public static int set(int pnFlagList,
                      int pnFlagToSet)
Sets some specified bits in a flag list to '1'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to '1'
Returns:
the 'modified' flag list with the desired bits set to '1'
Since:
0.0.112

set

public static int set(int pnFlagList,
                      int pnFlagToSet,
                      boolean pbSet)
Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to the desired state
pbSet - the state to set the flags to: true means '1', false means '0'
Returns:
the 'modified' flag list with the desired bits set according to pbSet
Since:
0.0.112

clear

public static int clear(int pnFlagList,
                        int pnFlagToClear)
Sets some specified bits in a flag list to '0'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToClear - the flags to set to '0'
Returns:
the 'modified' flag list with the desired bits set to '0'
Since:
0.0.112

isSet

public static boolean isSet(int pnFlagList,
                            int pnFlagToTest)
Tests whether some bits in a flag list are set to '1'.

Parameters:
pnFlagList - the list of flags to test
pnFlagToTest - the flags to check for state '1'
Returns:
true if all non-zero bits of pnFlagToTest are set to '1' in pnFlagList, false otherwise
Since:
0.0.112

set

public static long set(long pnFlagList,
                       long pnFlagToSet)
Sets some specified bits in a flag list to '1'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to '1'
Returns:
the 'modified' flag list with the desired bits set to '1'
Since:
0.0.112

set

public static long set(long pnFlagList,
                       long pnFlagToSet,
                       boolean pbSet)
Sets some specified bits in a flag list to '1' or '0' depending on the given boolean parameter.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToSet - the flags to set to the desired state
pbSet - the state to set the flags to: true means '1', false means '0'
Returns:
the 'modified' flag list with the desired bits set according to pbSet
Since:
0.0.112

clear

public static long clear(long pnFlagList,
                         long pnFlagToClear)
Sets some specified bits in a flag list to '0'.

Parameters:
pnFlagList - the list of flags to 'modify'
pnFlagToClear - the flags to set to '0'
Returns:
the 'modified' flag list with the desired bits set to '0'
Since:
0.0.112

isSet

public static boolean isSet(long pnFlagList,
                            long pnFlagToTest)
Tests whether some bits in a flag list are set to '1'.

Parameters:
pnFlagList - the list of flags to test
pnFlagToTest - the flags to check for state '1'
Returns:
true if all non-zero bits of pnFlagToTest are set to '1' in pnFlagList, false otherwise
Since:
0.0.112


Copyright 2007-2007 SourceForge. All Rights Reserved.