norsys.netica
Class State

java.lang.Object
  |
  +--norsys.netica.General
        |
        +--norsys.netica.State
All Implemented Interfaces:
NeticaListener

public class State
extends General

A state of a discrete Node, or a state of a discretized continuous Node.

There is no public constructor for State; obtain states by calling Node.state.

States inherit from General, but currently the only facilities available are the name, title, and comment.

Since:
2.20
Version:
5.04 - January 21, 2012

Field Summary
static int EVERY_STATE

A "wildcard" state that matches all states of a node.

static int IMPOSS_STATE

Indicates that the state value is irrelevant, because it is for a condition that will never occur.

static int UNDEF_STATE

Indicates that the state value is unknown or nonexistent.

 
Fields inherited from class norsys.netica.General
NAME_MAX
 
Method Summary
 void delete()

Removes this state from its node, so that the node has one fewer state.

 int getIndex()

Returns the index number of this state.

 Node getNode()

Returns the Node that this state belongs to.

 double getNumeric()

Returns the real value that has been previously associated with this discrete state (by calling setNumeric or Node.setLevels).

 void setNumeric(double value)

Sets the real value to be associated with this discrete state.

 
Methods inherited from class norsys.netica.General
addListener, eventOccurred, getComment, getEnviron, getLabel, getLabel, getName, getTitle, removeListener, setComment, setName, setTitle, toString, user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

public static final  int EVERY_STATE 
A "wildcard" state that matches all states of a node.


public static final  int IMPOSS_STATE 
Indicates that the state value is irrelevant, because it is for a condition that will never occur.


public static final  int UNDEF_STATE 
Indicates that the state value is unknown or nonexistent.

Method Detail
public void delete ( ) throws NeticaException
Removes this state from its node, so that the node has one fewer state.

This method is for discrete nodes only. It is not for continuous nodes, even if they have been discretized (use setLevels instead).

The CPTable will be renormalized to account for the missing state. If the probability for the missing state was 1.0 anywhere in the table, an error will be generated.

WARNING: You may want to remove any finding for this state's node before calling this method, since if this node has a finding, and it is for the state being removed, an exception will be thrown. If it is for another state, then that state's index will be properly modified so that after the removal operation it will correspond to the same state as it did before.

Version:

Since version 3.
In the C Version of the API, this function is named RemoveNodeState_bn.
See Also:
addStates    Add one or more states instead
reorderStates    Assign a new order to the states
getIndex    Retrieve the new indexes of the states
getNumStates    stateIndex must be between 0 and one less than this, inclusive
setLevels    For continuous nodes
Node.finding().clear()    May want to call this first


public int getIndex ( )
Returns the index number of this state. It will be between 0 and one less than the number of states of the node.

Version:
In version 2.14 and later.

public Node getNode ( )
Returns the Node that this state belongs to.

Version:
In version 2.14 and later.

public double getNumeric ( ) throws NeticaException
Returns the real value that has been previously associated with this discrete state (by calling setNumeric or Node.setLevels).

Throws an exception if a real value has not been associated with this state.

Version:

In version 2.14 and later.
See Also:
setNumeric    Sets it
Node.setLevels    Sets real value of all states, including this one
Node.getLevels    Retrieves the real values of all states


public void setNumeric (
 double  value 
) throws NeticaException
Sets the real value to be associated with this discrete state.

The number can be integer or real, negative or positive.

This is for discrete nodes only. An exception will be thrown if it is attempted on a continuous node, even one that has been discretized (use Node.setLevels instead).

Parameters:
double    value    value to be associated with this discrete state

Version:

In version 2.14 and later.
See Also:
getNumeric    Retrieves value
Node.setLevels    Sets real value for all states, including this one