Package com.bayesserver
Class State
- java.lang.Object
-
- com.bayesserver.State
-
-
Constructor Summary
Constructors Constructor Description State()
Initializes a new instance of theState
class.State(String name)
Initializes a new instance of theState
class with the specified [name].State(String name, Object value)
Initializes a new instance of theState
class with the specified [name] and [value].
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description State
copy()
Copies this instance.CustomPropertyCollection
getCustomProperties()
Gets custom properties associated with this instance.String
getDescription()
Gets an optional description for the state.int
getIndex()
Gets the index of the state in a variable'sVariable.getStates()
collection.String
getName()
Gets the name of the state.StateCollection
getStates()
Gets theStateCollection
the state belongs to, if any.Object
getValue()
Gets an optional value for a state, such as an interval for discretized variables.Variable
getVariable()
Gets theVariable
the state belongs to, if any.void
setDescription(String value)
Sets an optional description for the state.void
setName(String value)
Sets the name of the state.void
setValue(Object value)
Sets an optional value for a state, such as an interval for discretized variables.String
toString()
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 theState
class.
-
State
public State(String name)
Initializes a new instance of theState
class 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 theState
class 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 theStateValueType
set 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 theState
does 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 theStateCollection
the state belongs to, if any.- Returns:
- The
StateCollection
that 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 aState
is added to aVariable
this value must be compatible with theStateValueType
set on the variable.
-
setValue
public void setValue(Object value)
Sets an optional value for a state, such as an interval for discretized variables. When aState
is added to aVariable
this value must be compatible with theStateValueType
set on the variable.
-
getVariable
public Variable getVariable()
Gets theVariable
the 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
Variable
that this instance belongs to. Can be null.
-
-