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

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedNode
      extended by uk.co.agena.minerva.model.extendedbn.LabelledEN
All Implemented Interfaces:
java.lang.Comparable, java.util.EventListener, ExtendedNodeListener, ExtendedStateListener, Identifiable, Nameable, Writable
Direct Known Subclasses:
BooleanEN

public class LabelledEN
extends ExtendedNode

A LabelledEN is an ExtendedNode whose states are not numerical or in any order but simply have labels e.g.{Java, C++, C, Ada}.


Field Summary
protected static java.lang.String[][] defaultStateNames
           
 
Fields inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
actOnMarginalsChangedEvent, answerable, connBn, connectableInputNode, connectableOutputNode, connNodeId, CONTINUOUS_INTERVAL_E_N, CURRENT_FUNCTION_STRING, currentNodeFunction, currentParentModelNodeAltId, currentPartitionedModelNodeFunctions, currentPartitionedParentModelNodeAltIds, currentPartitionedParentModelNodes, DEFAULT_FUNCTION_STRING, defaultNodeFunction, defaultParentModelNodeAltId, defaultPartitionedModelNodeFunctions, defaultPartitionedParentModelNodeAltIds, defaultPartitionedParentModelNodes, DELTA, DISCRETE_REAL_E_N, EDITABLE_NODE_FUNCTION, EDITABLE_NPT, EDITABLE_PARENT_STATE_FUNCTIONS, extendedStates, functionMode, id, inputNodeReceivedMarginals, LABELLED_E_N, name, nptReCalcRequired, nptSynchronisedWithFormula, NUMERICAL_E_N, PROBS_NOT_EDITABLE, reportable, supportedFunctionTypes, targetValue, targetValuePresent, version, visible
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
LabelledEN()
          Default constructor.
LabelledEN(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs a LabelledEN with the specified name and connected BN.
LabelledEN(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs a LabelledEN with the specified name, connected node ID and connected BN.
 
Method Summary
 void configureDefaultExtendedStates()
          Sets up a default list of ExtendedStates for this node based on the default state names for this class.
 DataSet createDataSetForExtendedStates()
          Create a DatsSet from the Extended States of this node.
 java.util.List createExtendedStates(DataSet ds)
          Takes the supplied DataSet and uses it to generate a List of ExtendedStates which are then returned.
 ExtendedState createNewExtendedState(int index)
          Creates a new ExtendedState, all the way to the core.
 void extendedNodeAttributeChanged(ExtendedNodeEvent ene, int attribute)
          Called when selected attributes of the node are changed.
static java.lang.String[][] getDefaultStateNames()
           
 java.lang.Object getSamplesForState(int index, boolean boundsOnly)
          Returns a set of samples from the range of the state in question.
 java.util.List replaceState(int index, int numDivisions)
          Takes the state at the specified index and replaces it with the required number of new states.
 
Methods inherited from class uk.co.agena.minerva.model.extendedbn.ExtendedNode
addChild, addExpressionVariable, addExtendedNodeListener, addExtendedState, addExtendedState, addExtendedStates, addParent, cloneTypeSpecific, compareTo, constructExtraFieldString, containsFunctionOfType, containsOnlyStatisticalFunctions, copy, createDataPointFromExtendedState, cropFunctions, enterDistributionOfEvidence, enterDistributionOfEvidence, enterHardEvidence, enterHardEvidence, extendedNodeConnBNNotFound, extendedNodeConnNodeIdChanged, extendedNodeInconsistentEvidenceEntered, extendedNodeMarginalsChanged, extendedNodeNameDescriptionChanged, extendedNodeStateNameChanged, extendedNodeStatesReplaced, extendedNodeVariableAdded, extendedNodeVariableRemoved, extendedNodeVisibleAttributeChanged, extendedStateAdded, extendedStateNameDescriptionChanged, extendedStateRemoved, fireMarginalsChangedEvent, getActOnMarginalsChangedEvent, getAnswerable, getConcreteNodeName, getConcreteNodeType, getConcreteNodeTypeNames, getConnBn, getConnNodeId, getCoreBNNodeEquivalents, getCurrentNodeFunction, getCurrentParentModelNodeAltId, getCurrentPartitionedModelNodeFunctions, getCurrentPartitionedParentModelNodeAltIds, getCurrentPartitionedParentModelNodes, getDefaultNodeFunction, getDefaultParentModelNodeAltId, getDefaultPartitionedModelNodeFunctions, getDefaultPartitionedParentModelNodeAltIds, getDefaultPartitionedParentModelNodes, getExpression, getExpressionVariables, getExtendedState, getExtendedStateAtIndex, getExtendedStates, getExtendedStateShortNames, getExtendedStateWithName, getExtendedStateWithShortDesc, getFunctionMode, getHardEvidence, getId, getInputNodeRecivedMarginalsAsEvidenceDS, getLastSavedPriorIndex, getMarginals, getName, getNextExtendedStateId, getNodeType, getNotes, getNPT, getNPTPopulationMethodAsString, getNPTSize, getNumberOfStateCombsForModelNodes, getPartitionedExpressionModelNodes, getPartitionedExpressions, getReportable, getRowMajorNPT, getSavedPriors, getScaledTargetValue, getSuitableMessagePassingNodes, getSupportedFunctionTypes, getTargetValue, getTargetValueAsString, getTargetValueRange, getTargetValueRangeAsString, getTotalNumberOfExtendedFunctions, getVersion, getVisible, hasParents, isChangeStatesOnInputNodeIfRequired, isConnectableInputNode, isConnectableOutputNode, isInputNodeReceivedMarginals, isInputNodeRecivedMarginalsAsEvidence, isNptReCalcRequired, isNptSynchronisedWithFormula, isTargetValuePresent, isTemporaryNodeOrderFlag, mode, nodeChanged, processExtraFields, read, recalculateConnStateIndices, removeAllFurtherSavedPriors, removeExpressionVariable, removeExtendedNodeListener, removeExtendedState, replicateNodeStates, revert2savedPrior, savePrior, setActOnMarginalsChangedEvent, setAnswerable, setChangeStatesOnInputNodeIfRequired, setConnBn, setConnectableInputNode, setConnectableOutputNode, setConnNodeId, setCurrentNodeFunction, setCurrentParentModelNodeAltId, setCurrentPartitionedModelNodeFunctions, setCurrentPartitionedParentModelNodeAltIds, setCurrentPartitionedParentModelNodes, setDefaultNodeFunction, setDefaultParentModelNodeAltId, setDefaultPartitionedModelNodeFunctions, setDefaultPartitionedParentModelNodeAltIds, setDefaultPartitionedParentModelNodes, setExpression, setExpressionVariables, setExtendedStates, setExtendedStates, setFunctionMode, setId, setInputNodeReceivedMarginals, setInputNodeRecivedMarginalsAsEvidence, setInputNodeRecivedMarginalsAsEvidenceDS, setName, setNotes, setNPT, setNPT, setNPT, setNPTForSingleModelParentNode, setNptReCalcRequired, setNptSynchronisedWithFormula, setPartitionedExpressionModelNodes, setPartitionedExpressions, setReportable, setSavedPriors, setTargetValue, setTargetValueFromString, setTargetValuePresent, setTemporaryNodeOrderFlag, setupActionForMarginalsChangedEvent, setVersion, setVisible, storeFunctionsCorrectly, toString, updateConnNodeId, updateExpressionVariable, updateFunctionsParentConnNodeId, updateFunctionType, usedInCurrentExpression, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultStateNames

protected static java.lang.String[][] defaultStateNames
Constructor Detail

LabelledEN

public LabelledEN()
Default constructor.


LabelledEN

public LabelledEN(NameDescription name,
                  java.lang.String connNodeId,
                  uk.co.agena.minerva.model.corebn.CoreBN connBn)
           throws ExtendedBNException
Constructs a LabelledEN with the specified name, connected node ID and connected BN. It also initialises the ExtendedStates with numerical values based upon the position of each state within the node's list.

Parameters:
name - the name of the LabelledEN
connNodeId - the ID of the connected node in the underlying BN.
connBn - a reference to the underlying CoreBN
Throws:
ExtendedBNException - if there is a problem creating the node

LabelledEN

public LabelledEN(NameDescription name,
                  uk.co.agena.minerva.model.corebn.CoreBN connBn)
           throws ExtendedBNException
Constructs a LabelledEN with the specified name and connected BN.

Parameters:
name - the name of the LabelledEN
connBn - a reference to the underlying CoreBN
Throws:
ExtendedBNException - if there is a problem creating the node
Method Detail

configureDefaultExtendedStates

public void configureDefaultExtendedStates()
                                    throws ExtendedStateException
Sets up a default list of ExtendedStates for this node based on the default state names for this class.

Specified by:
configureDefaultExtendedStates in class ExtendedNode
Throws:
ExtendedStateException

createNewExtendedState

public ExtendedState createNewExtendedState(int index)
                                     throws ExtendedNodeMethodNotSupportedException,
                                            ExtendedBNException
Description copied from class: ExtendedNode
Creates a new ExtendedState, all the way to the core. It will add the state at the index specified. Give a -1 value if you wish the state to be added to the end of the list of existing states.

Specified by:
createNewExtendedState in class ExtendedNode
Returns:
Throws:
ExtendedBNException
ExtendedNodeMethodNotSupportedException

getDefaultStateNames

public static java.lang.String[][] getDefaultStateNames()

extendedNodeAttributeChanged

public void extendedNodeAttributeChanged(ExtendedNodeEvent ene,
                                         int attribute)
Description copied from class: ExtendedNode
Called when selected attributes of the node are changed. The Int value in the second arguement defines what attribute it was that changed, the constant value for which are available on the ExtendedNodeEvent class

Specified by:
extendedNodeAttributeChanged in interface ExtendedNodeListener
Overrides:
extendedNodeAttributeChanged in class ExtendedNode

createExtendedStates

public java.util.List createExtendedStates(DataSet ds)
                                    throws ExtendedStateException
Description copied from class: ExtendedNode
Takes the supplied DataSet and uses it to generate a List of ExtendedStates which are then returned. Each type of node can potentially use the DataSet to generate states in a different. Implementations are provided lower down in the hierarchy.

Specified by:
createExtendedStates in class ExtendedNode
Parameters:
ds - the DataSet used for creating the ExtendedStates
Returns:
a List of created ExtendedStates
Throws:
ExtendedStateException

createDataSetForExtendedStates

public DataSet createDataSetForExtendedStates()
                                       throws ExtendedStateException
Create a DatsSet from the Extended States of this node.

Specified by:
createDataSetForExtendedStates in class ExtendedNode
Returns:
Throws:
ExtendedStateException

replaceState

public java.util.List replaceState(int index,
                                   int numDivisions)
                            throws ExtendedStateException,
                                   ExtendedNodeMethodNotSupportedException
Takes the state at the specified index and replaces it with the required number of new states.

Specified by:
replaceState in class ExtendedNode
Parameters:
index - the index of the state to split
numDivisions - the number of divisions it should be split into
Returns:
a List of the ExtendedStates that were created as part of the process
Throws:
ExtendedStateException
ExtendedNodeMethodNotSupportedException

getSamplesForState

public java.lang.Object getSamplesForState(int index,
                                           boolean boundsOnly)
                                    throws ExtendedStateException
Returns a set of samples from the range of the state in question. The number of samples to take is a system level property. In this case, the number of samples is ignored and only the String value of the specified state is returned.

Specified by:
getSamplesForState in class ExtendedNode
Parameters:
index - the index of the state to sample
boundsOnly - TODO
Returns:
an array containing just the String value of the state to be sampled
Throws:
ExtendedStateNotFoundException - if there is no state at the supplied index
ExtendedStateException


Copyright © 2006 Agena Ltd. All Rights Reserved.