au.gov.tas.dpiwe.mr.util
Class TriState

java.lang.Object
  extended by au.gov.tas.dpiwe.mr.util.TriState

public class TriState
extends Object

A value which has three states, one positive, one negative and one neutral. e.g. yes, no, don't know; true, false, maybe true.

Since:
Mr Architecture 2.8
Version:
1.0.0.1
Author:
Kade Hansson, Levon Kara

Field Summary
protected  int state
          The state of this tri-state.
static int State_Negative
          The negative state.
static int State_Neutral
          The ambiguous state betwen positive and negative.
static int State_Positive
          The positive state.
 
Constructor Summary
TriState()
          Creates a new instance of TriState.
TriState(int state)
          Creates a new instance of TriState.
TriState(String flg)
          Creates a new instance of TriState.
 
Method Summary
 String getFlg()
          Returns the flag text of this tri-state.
 int getState()
          Returns the state of this tri-state.
 boolean isNegative()
          Returns true for a negative state.
 boolean isNeutral()
          Returns true for a neutral state.
 boolean isPositive()
          Returns true for a positive state.
 void setFlg(String flg)
          Alters the state of this tri-state.
 void setState(int state)
          Alters the state of this tri-state.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

protected int state
The state of this tri-state.


State_Neutral

public static final int State_Neutral
The ambiguous state betwen positive and negative.

See Also:
Constant Field Values

State_Negative

public static final int State_Negative
The negative state.

See Also:
Constant Field Values

State_Positive

public static final int State_Positive
The positive state.

See Also:
Constant Field Values
Constructor Detail

TriState

public TriState()
Creates a new instance of TriState.


TriState

public TriState(int state)
Creates a new instance of TriState.

Parameters:
state - the initial state of this tri-state.

TriState

public TriState(String flg)
Creates a new instance of TriState.

Parameters:
flg - "Y" for positive state, "N" for negative state, null for neutral.
Method Detail

getState

public int getState()
Returns the state of this tri-state.

Returns:
the state of this tri-state.

setState

public void setState(int state)
Alters the state of this tri-state.

Parameters:
state - the state of this tri-state.

getFlg

public String getFlg()
Returns the flag text of this tri-state.

Returns:
"Y" for positive state, "N" for negative state, null for neutral.

setFlg

public void setFlg(String flg)
Alters the state of this tri-state.

Parameters:
flg - "Y" for positive state, "N" for negative state, null for neutral.

isNeutral

public boolean isNeutral()
Returns true for a neutral state.

Returns:
true for a neutral state, false for a positive or negative state.

isNegative

public boolean isNegative()
Returns true for a negative state.

Returns:
true for a negative state, false for a neutral or positive state.

isPositive

public boolean isPositive()
Returns true for a positive state.

Returns:
true for a positive state, false for a neutral or negative state.

toString

public String toString()
Overrides:
toString in class Object