Package com.bayesserver
Class State
- java.lang.Object
-
- com.bayesserver.State
-
-
Constructor Summary
Constructors Constructor Description State()Initializes a new instance of theStateclass.State(String name)Initializes a new instance of theStateclass with the specified [name].State(String name, Object value)Initializes a new instance of theStateclass with the specified [name] and [value].
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Statecopy()Copies this instance.CustomPropertyCollectiongetCustomProperties()Gets custom properties associated with this instance.StringgetDescription()Gets an optional description for the state.intgetIndex()Gets the index of the state in a variable'sVariable.getStates()collection.StringgetName()Gets the name of the state.StateCollectiongetStates()Gets theStateCollectionthe state belongs to, if any.ObjectgetValue()Gets an optional value for a state, such as an interval for discretized variables.VariablegetVariable()Gets theVariablethe state belongs to, if any.voidsetDescription(String value)Sets an optional description for the state.voidsetName(String value)Sets the name of the state.voidsetValue(Object value)Sets an optional value for a state, such as an interval for discretized variables.StringtoString()Returns the name of the state, or an empty string if the name is null.
-
-
-
Constructor Detail
-
State
public State()
Initializes a new instance of theStateclass.
-
State
public State(String name)
Initializes a new instance of theStateclass with the specified [name].- Parameters:
name- The name for the state. Can be null.
-
State
public State(String name, Object value)
Initializes a new instance of theStateclass with the specified [name] and [value].- Parameters:
name- The name for the state. Can be null.value- Optional value for the state. When the state is added to a variable, this value must be compatible with theStateValueTypeset on the variable.
-
-
Method Detail
-
getCustomProperties
public CustomPropertyCollection getCustomProperties()
Gets custom properties associated with this instance. Custom properties allow storage of custom information, which will be saved with the network.
-
getDescription
public String getDescription()
Gets an optional description for the state.
-
setDescription
public void setDescription(String value)
Sets an optional description for the state.
-
getIndex
public int getIndex()
Gets the index of the state in a variable'sVariable.getStates()collection. Equals -1 if theStatedoes not belong to a variable.
-
getName
public String getName()
Gets the name of the state.
-
setName
public void setName(String value)
Sets the name of the state.
-
getStates
public StateCollection getStates()
Gets theStateCollectionthe state belongs to, if any.- Returns:
- The
StateCollectionthat this instance belongs to. Can be null.
-
getValue
public Object getValue()
Gets an optional value for a state, such as an interval for discretized variables. When aStateis added to aVariablethis value must be compatible with theStateValueTypeset on the variable.
-
setValue
public void setValue(Object value)
Sets an optional value for a state, such as an interval for discretized variables. When aStateis added to aVariablethis value must be compatible with theStateValueTypeset on the variable.
-
getVariable
public Variable getVariable()
Gets theVariablethe state belongs to, if any. If this instance is a child of another state, the state hierarchy is traversed to reach the variable of the root state, if any.- Returns:
- The
Variablethat this instance belongs to. Can be null.
-
-