uk.co.agena.minerva.model.extendedbn
Class ExtendedState

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedState
All Implemented Interfaces:
Identifiable, Nameable, Writable

public class ExtendedState
extends java.lang.Object
implements Identifiable, Nameable, Writable

An ExtendedState corresponds to a state on a node in an underlying BN. It adds extra information to the state such as extended name information.


Field Summary
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ExtendedState()
          Default constructor.
ExtendedState(int connStateIndex, NameDescription name, boolean visible)
          Creates an ExtendedState with the supplied connected state index, name, and visibility.
ExtendedState(int connStateIndex, NameDescription name, double numericalValue, Range range, boolean visible)
          Creates an ExtendedState with the supplied connected state index, name, numerical value, Range and visibility.
 
Method Summary
 void addExtendedStateListener(ExtendedStateListener enl)
          Adds an object interested in ExtendedStateEvents to the List of ExtendedStateListeners (actually held by an internal ExtendedStateEventGenerator).
static ExtendedState createContinuousIntervalState(double lower, double upper)
          Creates a new continuous interval state with the supplied lower and upper bounds.
static ExtendedState createDiscreteRealState(double numericalValue)
          Creates a new discrete real state with the supplied name and description.
static ExtendedState createIntegerIntervalState(int lower, int upper)
          Creates a new integer interval state with the supplied lower and upper bounds.
static ExtendedState createLabelledState(java.lang.String name, java.lang.String description)
          Creates a new labelled state with the supplied name and description.
 int getConnStateIndex()
          Returns the index of the underlying state to which this ExtendedState is connected.
 int getId()
          Returns the unique ID of the ExtendedState.
 NameDescription getName()
          Returns the name of the ExtendedState.
 double getNumericalValue()
          Returns the point value with which this ExtendedState is associated.
 Range getRange()
          Returns the Range with which this ExtendedState is associated.
 double getVersion()
          Returns the version of the class.
 boolean getVisible()
          Returns whether the ExtendedState is visible.
 int read(java.util.List strings, int currentLineNumber)
           
 void removeExtendedStateListener(ExtendedStateListener enl)
          Removes an object no longer interested in ExtendedStateEvents from the List of ExtendedStateListeners (actually held by an internal ExtendedStateEventGenerator).
 void setConnStateIndex(int connStateIndex)
          Sets the index of the underlying state to which this ExtendedState is connected.
 void setId(int id)
          Sets the unique ID of the ExtendedState to the ID specified.
 void setName(NameDescription name)
          Sets the name of the ExtendedState to the name specified.
 void setNumericalValue(double numericalValue)
          Sets the point value with which this ExtendedState is associated.
 void setRange(Range range)
          Sets the Range with which this ExtendedState is associated.
 void setVersion(double version)
          Sets the version number of the class.
 void setVisible(boolean visible)
          Sets whether the ExtendedState is visible.
 java.util.List write()
          Writes the object in question to a List of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedState

public ExtendedState()
Default constructor.


ExtendedState

public ExtendedState(int connStateIndex,
                     NameDescription name,
                     double numericalValue,
                     Range range,
                     boolean visible)
Creates an ExtendedState with the supplied connected state index, name, numerical value, Range and visibility.

Parameters:
connStateIndex - the index of the corresponding state in the underlying BN
name - the name of the ExtendedState
numericalValue - the point value to which the ExtendedState corresponds
range - the Range to which the ExtendedState corresponds
visible - whether the ExtendedState is visible

ExtendedState

public ExtendedState(int connStateIndex,
                     NameDescription name,
                     boolean visible)
Creates an ExtendedState with the supplied connected state index, name, and visibility.

Parameters:
connStateIndex - the index of the corresponding state in the underlying BN
name - the name of the ExtendedState
visible - whether the ExtendedState is visible
Method Detail

createContinuousIntervalState

public static ExtendedState createContinuousIntervalState(double lower,
                                                          double upper)
                                                   throws MinervaRangeException
Creates a new continuous interval state with the supplied lower and upper bounds.

Parameters:
lower - the lower bound of the state
upper - the upper bound of the state
Returns:
the newly created state
Throws:
MinervaRangeException - if upper < lower

createIntegerIntervalState

public static ExtendedState createIntegerIntervalState(int lower,
                                                       int upper)
                                                throws MinervaRangeException
Creates a new integer interval state with the supplied lower and upper bounds.

Parameters:
lower - the lower bound of the state
upper - the upper bound of the state
Returns:
the newly created state
Throws:
MinervaRangeException - if upper < lower

createLabelledState

public static ExtendedState createLabelledState(java.lang.String name,
                                                java.lang.String description)
Creates a new labelled state with the supplied name and description.

Parameters:
name - the name of the state
description - the description of the state
Returns:
the newly created state
Throws:
MinervaRangeException - if upper < lower

createDiscreteRealState

public static ExtendedState createDiscreteRealState(double numericalValue)
Creates a new discrete real state with the supplied name and description.

Parameters:
numericalValue - the numerical value of the state
Returns:
the newly created state

getId

public int getId()
Returns the unique ID of the ExtendedState.

Specified by:
getId in interface Identifiable
Returns:
the unique ID of the ExtendedState

setId

public void setId(int id)
Sets the unique ID of the ExtendedState to the ID specified.

Parameters:
id - the new ID for the ExtendedState

getVersion

public double getVersion()
Description copied from interface: Writable
Returns the version of the class. Used to ensure backward compatibility.

Specified by:
getVersion in interface Writable
Returns:
the version number

setVersion

public void setVersion(double version)
Description copied from interface: Writable
Sets the version number of the class. Used to ensure backward compatibility.

Specified by:
setVersion in interface Writable
Parameters:
version - the version number

getConnStateIndex

public int getConnStateIndex()
Returns the index of the underlying state to which this ExtendedState is connected.

Returns:
the index of the state

setConnStateIndex

public void setConnStateIndex(int connStateIndex)
Sets the index of the underlying state to which this ExtendedState is connected.

Parameters:
connStateIndex - the new index

getName

public NameDescription getName()
Returns the name of the ExtendedState.

Specified by:
getName in interface Nameable
Returns:
the name of the ExtendedState

setName

public void setName(NameDescription name)
Sets the name of the ExtendedState to the name specified.

Specified by:
setName in interface Nameable
Parameters:
name - the new name for the ExtendedState

getVisible

public boolean getVisible()
Returns whether the ExtendedState is visible.

Returns:
true if the ExtendedState is visible, false otherwise

setVisible

public void setVisible(boolean visible)
Sets whether the ExtendedState is visible.

Parameters:
visible - whether the ExtendedState is visible

getNumericalValue

public double getNumericalValue()
Returns the point value with which this ExtendedState is associated.

Returns:
the point value

setNumericalValue

public void setNumericalValue(double numericalValue)
Sets the point value with which this ExtendedState is associated.

Parameters:
numericalValue - the point value

getRange

public Range getRange()
Returns the Range with which this ExtendedState is associated.

Returns:
the Range

setRange

public void setRange(Range range)
Sets the Range with which this ExtendedState is associated.

Parameters:
range - the Range

addExtendedStateListener

public void addExtendedStateListener(ExtendedStateListener enl)
Adds an object interested in ExtendedStateEvents to the List of ExtendedStateListeners (actually held by an internal ExtendedStateEventGenerator).

Parameters:
enl - the interested ExtendedStateListener

removeExtendedStateListener

public void removeExtendedStateListener(ExtendedStateListener enl)
Removes an object no longer interested in ExtendedStateEvents from the List of ExtendedStateListeners (actually held by an internal ExtendedStateEventGenerator).

Parameters:
enl - the interested ExtendedStateListener

write

public java.util.List write()
                     throws MinervaReadWriteException
Description copied from interface: Writable
Writes the object in question to a List of Strings.

Specified by:
write in interface Writable
Returns:
the List to which the Strings have been written
Throws:
MinervaReadWriteException - if there

read

public int read(java.util.List strings,
                int currentLineNumber)
         throws MinervaReadWriteException
Specified by:
read in interface Writable
Throws:
MinervaReadWriteException


Copyright © 2006 Agena Ltd. All Rights Reserved.