com.rubecula.units
Class SystemFlag

java.lang.Object
  extended bycom.rubecula.units.SystemFlag

public class SystemFlag
extends java.lang.Object

The immutable class SystemFlag represents a system of units.

Note that there are no non-private constructors. The values provided are fixed and immutable.

// TODO Improve javadoc for this class.

Version:
$Revision: 1.5 $
Author:
Robin Hillyard

Field Summary
private  int _Flag
          The value of the system flag (as a mask) for this SystemFlag.
static int $_INDEX_ANY
           
static int $_INDEX_CGS
           
static int $_INDEX_CUSTOM
           
static int $_INDEX_IMP
           
static int $_INDEX_MAX
           
static int $_INDEX_NONE
           
static int $_INDEX_SI
           
static int $_INDEX_US
           
static SystemFlag $F_FLAG_ANY
           
static SystemFlag $F_FLAG_CGS
           
static SystemFlag $F_FLAG_IMP
           
static SystemFlag $F_FLAG_NONE
           
static SystemFlag $F_FLAG_SI
           
private static int $I_FLAG_ANY
           
private static int $I_FLAG_CGS
           
private static int $I_FLAG_IMP
           
private static int $I_FLAG_NONE
           
private static int $I_FLAG_SI
           
(package private) static java.lang.String $S_SYSTEM_CGS
           
(package private) static java.lang.String $S_SYSTEM_ENGLISH
           
(package private) static java.lang.String $S_SYSTEM_IMPERIAL
           
(package private) static java.lang.String $S_SYSTEM_SI
           
(package private) static java.lang.String $S_SYSTEM_UD
           
private static int SystemIndex
          Class field (global) to store the current system index.
private static SystemFlag UnitsSystem
           
 
Constructor Summary
private SystemFlag(int flag)
          Private Primary constructor.
 
Method Summary
private static int FlagOf(int sysIndex)
          Factory method to create a SystemFlag for system index defined by sysIndex
(package private)  SystemFlag getAll(SystemFlag other)
           
(package private)  SystemFlag getCommon(SystemFlag other)
           
protected  int getFlag()
          Method to get the integer value of this flag.
 int getIndex()
           
static int GetMatchingSystem(java.lang.String system)
           
static int GetSysIndex()
           
static java.lang.String[] GetSystemNames()
           
static java.lang.String GetUnitSystemName()
           
private  int intersection(SystemFlag other)
           
(package private)  boolean isEqual(SystemFlag other)
           
(package private)  boolean isInSystem(int sysIndex)
           
(package private)  boolean match(SystemFlag other)
           
static void setSysIndex(int system)
           
 java.lang.String toString()
           
private  int union(SystemFlag other)
           
static SystemFlag valueOf(int sysIndex)
          Factory method to create a SystemFlag for system index defined by sysIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

$_INDEX_NONE

public static final int $_INDEX_NONE
See Also:
Constant Field Values

$_INDEX_ANY

public static final int $_INDEX_ANY
See Also:
Constant Field Values

$_INDEX_SI

public static final int $_INDEX_SI
See Also:
Constant Field Values

$_INDEX_CGS

public static final int $_INDEX_CGS
See Also:
Constant Field Values

$_INDEX_IMP

public static final int $_INDEX_IMP
See Also:
Constant Field Values

$_INDEX_US

public static final int $_INDEX_US
See Also:
Constant Field Values

$_INDEX_CUSTOM

public static final int $_INDEX_CUSTOM
See Also:
Constant Field Values

$_INDEX_MAX

public static final int $_INDEX_MAX
See Also:
Constant Field Values

$S_SYSTEM_SI

static final java.lang.String $S_SYSTEM_SI
See Also:
Constant Field Values

$S_SYSTEM_CGS

static final java.lang.String $S_SYSTEM_CGS
See Also:
Constant Field Values

$S_SYSTEM_IMPERIAL

static final java.lang.String $S_SYSTEM_IMPERIAL
See Also:
Constant Field Values

$S_SYSTEM_ENGLISH

static final java.lang.String $S_SYSTEM_ENGLISH
See Also:
Constant Field Values

$S_SYSTEM_UD

static final java.lang.String $S_SYSTEM_UD
See Also:
Constant Field Values

$I_FLAG_SI

private static final int $I_FLAG_SI

$I_FLAG_CGS

private static final int $I_FLAG_CGS

$I_FLAG_IMP

private static final int $I_FLAG_IMP

$I_FLAG_ANY

private static final int $I_FLAG_ANY
See Also:
Constant Field Values

$I_FLAG_NONE

private static final int $I_FLAG_NONE
See Also:
Constant Field Values

$F_FLAG_SI

public static final SystemFlag $F_FLAG_SI

$F_FLAG_CGS

public static final SystemFlag $F_FLAG_CGS

$F_FLAG_IMP

public static final SystemFlag $F_FLAG_IMP

$F_FLAG_ANY

public static final SystemFlag $F_FLAG_ANY

$F_FLAG_NONE

public static final SystemFlag $F_FLAG_NONE

SystemIndex

private static int SystemIndex
Class field (global) to store the current system index.


UnitsSystem

private static SystemFlag UnitsSystem

_Flag

private final int _Flag
The value of the system flag (as a mask) for this SystemFlag.

Constructor Detail

SystemFlag

private SystemFlag(int flag)
Private Primary constructor.

Parameters:
flag - the integer value which this flag will take.
Method Detail

GetSystemNames

public static java.lang.String[] GetSystemNames()

GetUnitSystemName

public static java.lang.String GetUnitSystemName()

valueOf

public static SystemFlag valueOf(int sysIndex)
Factory method to create a SystemFlag for system index defined by sysIndex

Parameters:
sysIndex - a non-negative integer
Returns:
the new SystemFlag

FlagOf

private static int FlagOf(int sysIndex)
Factory method to create a SystemFlag for system index defined by sysIndex

Parameters:
sysIndex - a non-negative integer
Returns:
the new SystemFlag

setSysIndex

public static void setSysIndex(int system)

GetSysIndex

public static int GetSysIndex()

toString

public java.lang.String toString()

match

final boolean match(SystemFlag other)

isEqual

final boolean isEqual(SystemFlag other)

isInSystem

final boolean isInSystem(int sysIndex)

getCommon

final SystemFlag getCommon(SystemFlag other)

getAll

final SystemFlag getAll(SystemFlag other)

getIndex

public final int getIndex()

getFlag

protected final int getFlag()
Method to get the integer value of this flag.

Returns:
the integer value of the system flag.

intersection

private int intersection(SystemFlag other)

union

private int union(SystemFlag other)

GetMatchingSystem

public static int GetMatchingSystem(java.lang.String system)