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

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

public abstract class ExtendedNode
extends java.lang.Object
implements Identifiable, Nameable, Writable, ExtendedNodeListener, ExtendedStateListener, java.lang.Comparable

An ExtendedNode corresponds to a node in an underlying BN. It contains a List of ExtendedStates and adds extra information to the node such as a more detailed name and description.

Currently, each ExtendedNode has a reference to a CoreBN which it gets from its parent ExtendedBN during construction. The reason for this is that all operations on the underlying BN or its nodes must be called on the core BN. There is no concept of a core Node.

An ExtendedNode must currently be one of three types: an LabelledEN, an AboluteExtendedNode or an ContinuousIntervalEN

Note: this class has a natural ordering that is inconsistent with equals.


Field Summary
protected  int actOnMarginalsChangedEvent
          This is the number of times that this object will act on a Marginals changed event.
protected  boolean answerable
          Whether the ExtendedNode should have a connected Question.
protected  uk.co.agena.minerva.model.corebn.CoreBN connBn
          A reference to an underlying CoreBN.
protected  boolean connectableInputNode
          Defines whether the node is a possible input node for an ExtendedBN.
protected  boolean connectableOutputNode
          Defines whether the node is a possible output node for an ExtendedBN.
protected  java.lang.String connNodeId
          The ID of the connected node in the underlying BN (which will a String rather than an Integer).
static int CONTINUOUS_INTERVAL_E_N
          Constant corresponding to the ContinuousIntervalEN type.
static java.lang.String CURRENT_FUNCTION_STRING
          Used to indicate function data members that are "current".
protected  ExtendedNodeFunction currentNodeFunction
          The current function specified across the entire NPT for this node.
protected  java.lang.String currentParentModelNodeAltId
          Only used during loading and saving, so that current model node information can be stored.
protected  java.util.List currentPartitionedModelNodeFunctions
          The current functions specified for each state combination of the node's parents.
protected  java.lang.String currentPartitionedParentModelNodeAltIds
          Only used during loading and saving, so that current model node information can be stored.
protected  java.util.List currentPartitionedParentModelNodes
          The current model (parent) nodes for the node functions.
static java.lang.String DEFAULT_FUNCTION_STRING
          Used to indicate function data members that are "default".
protected  ExtendedNodeFunction defaultNodeFunction
          The original function specified across the entire NPT for this node.
protected  java.lang.String defaultParentModelNodeAltId
          Only used during loading and saving, so that default model node information can be stored.
protected  java.util.List defaultPartitionedModelNodeFunctions
          The current functions specified for each state combination of the node's parents.
protected  java.lang.String defaultPartitionedParentModelNodeAltIds
          Only used during loading and saving, so that default model node information can be stored.
protected  java.util.List defaultPartitionedParentModelNodes
          The original model (parent) nodes for the node functions.
protected static double DELTA
          This is the delta value we use when comparing equality between probabilities.
static int DISCRETE_REAL_E_N
          Constant corresponding to the DiscreteRealEN type.
static int EDITABLE_NODE_FUNCTION
          If the ExtendedNode's functionMode has this value, it will have null values for parentState function objects.
static int EDITABLE_NPT
          If the ExtendedNode's functionMode has this value, it will have null values for all function objects.
static int EDITABLE_PARENT_STATE_FUNCTIONS
          If the ExtendedNode's functionMode has this value, it will have null values for node function objects.
protected  java.util.List extendedStates
          The ExtendedStates contained in the ExtendedNode.
protected  int functionMode
          Indicates whether this node has any functions specified for it along with the basic NPT.
protected  int id
          The unique integer ID for the ExtendedNode.
protected  boolean inputNodeReceivedMarginals
          Flag to inform us if this node is an Input Node, then has it received its new Marginals via a Message Pass.
static int LABELLED_E_N
          Constant corresponding to the LabelledEN type.
protected  NameDescription name
          The name of the ExtendedNode.
protected  boolean nptReCalcRequired
          This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time.
protected  boolean nptSynchronisedWithFormula
          This is a flag to monitor if the npt is correct with respect to the formula entered.
static int NUMERICAL_E_N
          Constant corresponding to the NumericalEN type.
static int PROBS_NOT_EDITABLE
          If the ExtendedNode's functionMode has this value, its probability values cannot be edited at all.
protected  boolean reportable
          Whether the ExtendedNode should be reported on.
protected static java.lang.String[] supportedFunctionTypes
           
protected  double targetValue
          A threshold value for the node that can be used to represent an upper or lower limit on the node's value about which warning should be given.
protected  boolean targetValuePresent
          This indicates whether a target value is currently valid for a node.
static double version
           
protected  boolean visible
          Whether the ExtendedNode should be displayed in an application.
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ExtendedNode()
          Default constructor.
ExtendedNode(NameDescription name, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs an ExtendedNode with the specified name and connected BN.
ExtendedNode(NameDescription name, java.lang.String connNodeId, uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Constructs an ExtendedNode with the specified name, connected node ID and connected BN.
 
Method Summary
 boolean addChild(ExtendedNode childNode)
          Call this to add a child to an ExtendedNode, this connects the core nodes, then updated the parent list in this object and the function type.
 Variable addExpressionVariable(java.lang.String name, double defaultValue)
          Adds a new Variable to the VariableList with the specified name and default value.
 void addExtendedNodeListener(ExtendedNodeListener enl)
          Adds an object interested in ExtendedNodeEvents to the List of ExtendedNodeListeners (actually held by an internal ExtendedNodeEventGenerator).
 void addExtendedState(ExtendedState extendedState, boolean autoAssignId)
          Adds an ExtendedState to this ExtendedNode's List of ExtendedStates.
 void addExtendedState(ExtendedState extendedState, boolean autoAssignId, int position)
          Adds an ExtendedState to this ExtendedNode's List of ExtendedStates.
 void addExtendedStates(java.util.List states, int index, boolean autoAssignId)
          Adds the supplied states at the specified index in the list.
 void addParent(ExtendedNode parentNode)
          Call this to add a parent to an ExtendedNode, this connects the core nodes, then updated tha parent list in this object and the function type.
 void cloneTypeSpecific(ExtendedNode oldEXN)
          Empty method which can be overridden by subclass ExtendedNodes so data specific to that type can be cloned.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
abstract  void configureDefaultExtendedStates()
          Configures a default set of ExtendedStates for a node.
protected  java.lang.String constructExtraFieldString()
          This should be overridden by any subclass of ExtendedNode that has additional fields that need to be written out.
 boolean containsFunctionOfType(java.lang.String functionDisplayName)
           
 boolean containsOnlyStatisticalFunctions()
          Looks at the node's function or functions and returns true if there are only statistical (i.e.
 ExtendedNode copy(java.lang.Class type)
          Creates a shallow copy of this ExtendedNode by copying references to all of its data into a new instance of the supplied node type.
protected  DataPoint createDataPointFromExtendedState(ExtendedState es, double value)
          Creates a DataPoint using information in the supplied ExtendedState.
abstract  DataSet createDataSetForExtendedStates()
          Create a DatsSet from the Extended States of this node.
abstract  java.util.List createExtendedStates(DataSet ds)
          Takes the supplied DataSet and uses it to generate a List of ExtendedStates which are then returned.
abstract  ExtendedState createNewExtendedState(int index)
          Creates a new ExtendedState, all the way to the core.
 void cropFunctions()
          In the case where there are partitioned expressions, this method makes sure that the number of current and default functions is the same size as the number expected based up on the number of state combinations of the model parent nodes.
 void enterDistributionOfEvidence(DataSet distribution, boolean propagate)
          Enters evidence on this ExtendedNode in the form of a distribution of likelihoods across all ExtendedStates.
 void enterDistributionOfEvidence(DataSet distribution, boolean propagate, DataSet datasetToShow)
          Enters evidence on this ExtendedNode in the form of a distribution of likelihoods across all ExtendedStates.
 void enterHardEvidence(int stateId, boolean propagate)
          Enters evidence on this node to indicate that the ExtendedState specified has been selected.
 void enterHardEvidence(int stateId, boolean propagate, boolean useClosestMedian)
          Enters evidence on this node to indicate that the ExtendedState specified has been selected.
 void extendedNodeAttributeChanged(ExtendedNodeEvent ene, int attribute)
          Called when selected attributes of the node are changed.
 void extendedNodeConnBNNotFound(ExtendedNodeEvent ene)
          This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.
 void extendedNodeConnNodeIdChanged(ExtendedNodeEvent ene)
          No action needed when the ConnNodeId of an ExtendedNode is changed.
 void extendedNodeInconsistentEvidenceEntered(ExtendedNodeEvent ene)
          This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.
 void extendedNodeMarginalsChanged(ExtendedNodeEvent ene, boolean useMarginalDataSetForStateReplication)
          Called whenever the marginals for a particular node have changed.
 void extendedNodeNameDescriptionChanged(ExtendedNodeEvent ene)
          This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.
 void extendedNodeStateNameChanged(ExtendedNodeEvent ene, ExtendedState es)
          Dont need to do anything if one of its states have changed their names.
 void extendedNodeStatesReplaced(ExtendedNodeEvent ene)
          Called when the node's states are replaced.
 void extendedNodeVariableAdded(ExtendedNodeEvent ene, Variable addedVarible)
          Invoked when a Variable is added to the ExtendedNodes VariableList.
 void extendedNodeVariableRemoved(ExtendedNodeEvent ene, Variable removedVarible)
          Invoked when a Variable is removed from the ExtendedNodes VariableList.
 void extendedNodeVisibleAttributeChanged(ExtendedNodeEvent ene, boolean visible)
          Invoked when an ExtendedNode visible attribute is changed.
 void extendedStateAdded(ExtendedNodeEvent ene)
          New ExtendedState created and added to this node and added all the way to the core.
 void extendedStateNameDescriptionChanged(ExtendedStateEvent ene)
          Listens to the extendedstate to see if they fire an event that their name has changed.
 void extendedStateRemoved(ExtendedNodeEvent ene, int indexOfStateRemoved)
          ExtendedNode removed from this node and all the way to the core.
protected  void fireMarginalsChangedEvent()
          Called by an ExtendedBN when either propagation or retraction is called, because this node's marginals may have changed.
 int getActOnMarginalsChangedEvent()
           
 boolean getAnswerable()
          Returns whether the ExtendedNode is answerable.
static java.lang.String getConcreteNodeName(java.lang.Class type)
          Given the class of a node type, the user-friendly name of the node type is returned.
static java.lang.Class getConcreteNodeType(java.lang.String name)
          Given the user-friendly name of a node type, the actual class of the node type is returned.
static java.lang.String[] getConcreteNodeTypeNames()
          Returns the user-friendly names of all node types that are concrete i.e.
 uk.co.agena.minerva.model.corebn.CoreBN getConnBn()
          Gets the underlying BN to which this ExtendedNode is connected.
 java.lang.String getConnNodeId()
          Returns the ID of the underlying connected node.
protected  uk.co.agena.minerva.model.corebn.CoreBNNodeList getCoreBNNodeEquivalents(java.util.List extendedNodes)
           
 ExtendedNodeFunction getCurrentNodeFunction()
          Gets the current node function for this ExtendedNode.
 java.lang.String getCurrentParentModelNodeAltId()
           
 java.util.List getCurrentPartitionedModelNodeFunctions()
           
 java.lang.String getCurrentPartitionedParentModelNodeAltIds()
           
 java.util.List getCurrentPartitionedParentModelNodes()
           
 ExtendedNodeFunction getDefaultNodeFunction()
          Gets the default node function for this ExtendedNode.
 java.lang.String getDefaultParentModelNodeAltId()
           
 java.util.List getDefaultPartitionedModelNodeFunctions()
           
 java.lang.String getDefaultPartitionedParentModelNodeAltIds()
           
 java.util.List getDefaultPartitionedParentModelNodes()
           
 ExtendedNodeFunction getExpression()
          Gets the name of the expression for this node.
 VariableList getExpressionVariables()
           
 ExtendedState getExtendedState(int id)
          Returns the ExtendedState with the specified ID.
 ExtendedState getExtendedStateAtIndex(int index)
          Returns the state at the supplied index in the list.
 java.util.List getExtendedStates()
          Returns a list of all the ExtendedStates contained in this ExtendedNode.
 java.lang.String[] getExtendedStateShortNames()
          Returns an array of the short names of all ExtendedStates.
 ExtendedState getExtendedStateWithName(java.lang.String name)
          Returns the state with the supplied name.
 ExtendedState getExtendedStateWithShortDesc(java.lang.String shortDesc)
          Returns the ExtendedState with the specified Short NameDescription.
 int getFunctionMode()
          Returns the function mode for this ExtendedNode.
 ExtendedState getHardEvidence()
          This method will return an ExtendedState in which there is hard evidence.
 int getId()
          Returns the unique ID of the ExtendedNode.
 DataSet getInputNodeRecivedMarginalsAsEvidenceDS()
           
 int getLastSavedPriorIndex()
          Returns the index of the last saved priors
 DataSet getMarginals()
          Returns the marginal probabilities for the node in the form of a DataSet.
 NameDescription getName()
          Returns the name of the ExtendedNode.
protected  int getNextExtendedStateId()
          Finds the next available ID to assign to an ExtendeNode based on the IDs of those currently in the ExtendedBN's List.
 int getNodeType()
          Returns the type of this ExtendedNode.
 Notes getNotes()
          Returns the note object for the node
 float[][] getNPT()
          Returns the NPT of this node as a 2D array of floats.
 java.util.List getNPTPopulationMethodAsString()
          returns a list of strings that represent the NPT editing mode (and function list if suitable)
 int getNPTSize(java.util.List parentNodes)
          This method calculates the expected size of its NPT using its parents' state sizes.
 int getNumberOfStateCombsForModelNodes(int type)
          Returns the number of state combinations for the parent model nodes of this node.
 java.util.List getPartitionedExpressionModelNodes()
          Returns the partitioned expression model nodes currently defined on this node.
 java.util.List getPartitionedExpressions()
          Returns the partitioned expressions currently defined on this node.
 boolean getReportable()
          Returns whether the ExtendedNode can be reported on.
 float[] getRowMajorNPT()
          Returns the NPT of the underlying node in the CoreBN as a row major array of probabilities.
abstract  java.lang.Object getSamplesForState(int index, boolean boundsOnly)
          Returns a set of values that are sampled from the state at the supplied index.
 DataSetGrouping getSavedPriors()
           
 double getScaledTargetValue()
          Normalises the ExtendedStates so that the first one has the value 0, the next has value 1 and so on.
 java.util.List getSuitableMessagePassingNodes(java.util.List targetNodes)
          Searches through the supplied List and returns a List of ExtendedNodes that have the same number of ExtendedStates.
 java.lang.String[] getSupportedFunctionTypes()
          Returns a list of the function classes supported by this node type.
 double getTargetValue()
          Returns the target value for this ExtendedNode.
 java.lang.String getTargetValueAsString()
          Returns the target value as a String.
 Range getTargetValueRange(boolean scaleInfinities)
          Gets the Range in which the target value can lie.
 java.lang.String getTargetValueRangeAsString()
          Returns the target value range as a String for displaying to a system user.
protected  int getTotalNumberOfExtendedFunctions()
          Calculates the total number of functions in use.
 double getVersion()
          Returns the version of the class.
 boolean getVisible()
          Returns whether the ExtendedNode is visible.
 boolean hasParents()
          Indicates whether this ExtendedNode has any parents.
 boolean isChangeStatesOnInputNodeIfRequired()
           
 boolean isConnectableInputNode()
          Returns whether this ExtendedNode is a potential input node.
 boolean isConnectableOutputNode()
          Returns whether this ExtendedNode is a potential output node.
 boolean isInputNodeReceivedMarginals()
           
 boolean isInputNodeRecivedMarginalsAsEvidence()
           
 boolean isNptReCalcRequired()
          This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time.
 boolean isNptSynchronisedWithFormula()
           
 boolean isTargetValuePresent()
          Indicates whether a target value is present for this ExtendedNode.
 boolean isTemporaryNodeOrderFlag()
           
 java.util.List mode()
          Calculates the mode of the marginals for this ExtendedNode.
 void nodeChanged(ExtendedNodeEvent ene)
          Called whenever a node changes (for selected events)
protected  void processExtraFields(java.util.StringTokenizer extraFields, double localVersion)
          This should be overridden by any subclass of ExtendedNode that has additional fields that need to be read in.
 int read(java.util.List strings, int currentLineNumber)
           
 void recalculateConnStateIndices()
           
 void removeAllFurtherSavedPriors(int removeAllFromThisIndex)
          Reomves the priors stored at the given index and all subsequent priors too.
 void removeExpressionVariable(Variable v)
          Removes the specified Variable from the VariableList if it is a Member of this ExtendedNodes VariableList.
 void removeExtendedNodeListener(ExtendedNodeListener enl)
          Removes an object no longer interested in ExtendedNodeEvents from the List of ExtendedNodeListeners (actually held by an internal ExtendedNodeEventGenerator).
 int removeExtendedState(int extendedStateId)
          Removes the ExtendedState with the specified ID from the ExtendedNode's List.
abstract  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.
 void replicateNodeStates(ExtendedNode states2copyNode)
          This method will take the states from the argument extended node and copy them to this node.
 int revert2savedPrior(int savedIndex)
          Sets the NPT for the node to the savedPrior at the given index if it exists.
 void savePrior()
          Add the current marginals of this node as saved priors (before touchTable or setNPT is called).
 void setActOnMarginalsChangedEvent(int actOnMarginalsChangedEvent)
           
 void setAnswerable(boolean answerable)
          Sets whether the ExtendedNode is answerable.
 void setChangeStatesOnInputNodeIfRequired(boolean changeStatesOnInputNodeIfRequired)
           
 void setConnBn(uk.co.agena.minerva.model.corebn.CoreBN connBn)
          Sets the underlying BN to which this ExtendedNode is connected.
 void setConnectableInputNode(boolean connectableInputNode)
          Sets whether this ExtendedNode is a potential input node.
 void setConnectableOutputNode(boolean connectableOutputNode)
          Sets whether this ExtendedNode is a potential output node.
 void setConnNodeId(java.lang.String connNodeId)
           
 void setCurrentNodeFunction(ExtendedNodeFunction currentNodeFunction)
          Sets the current node function for this ExtendedNode.
 void setCurrentParentModelNodeAltId(java.lang.String currentParentModelNodeAltId)
           
 void setCurrentPartitionedModelNodeFunctions(java.util.List currentPartitionedModelNodeFunctions)
           
 void setCurrentPartitionedParentModelNodeAltIds(java.lang.String currentPartitionedParentModelNodeAltIds)
           
 void setCurrentPartitionedParentModelNodes(java.util.List currentPartitionedParentModelNodes)
           
 void setDefaultNodeFunction(ExtendedNodeFunction defaultNodeFunction)
          Sets the default node function for this ExtendedNode.
 void setDefaultParentModelNodeAltId(java.lang.String defaultParentModelNodeAltId)
           
 void setDefaultPartitionedModelNodeFunctions(java.util.List defaultPartitionedModelNodeFunctions)
           
 void setDefaultPartitionedParentModelNodeAltIds(java.lang.String defaultPartitionedParentModelNodeAltIds)
           
 void setDefaultPartitionedParentModelNodes(java.util.List defaultPartitionedParentModelNodes)
           
 void setExpression(ExtendedNodeFunction expression)
          Sets the expression on this node.
 void setExpressionVariables(VariableList expressionVariables)
           
 void setExtendedStates(java.util.List extendedStates)
           
 void setExtendedStates(java.util.List extendedStates, boolean autoAssignIds)
          Reinitialises the ExtendedNode's List of ExtendedStates with those in the supplied List.
 void setFunctionMode(int functionMode)
          Sets the function mode of this ExtendedNode.
 void setId(int id)
          Sets the unique ID of the ExtendedNode to the ID specified.
 void setInputNodeReceivedMarginals(boolean inputNodeReceivedMarginals)
           
 void setInputNodeRecivedMarginalsAsEvidence(boolean inputNodeRecivedMarginalsAsEvidence)
           
 void setInputNodeRecivedMarginalsAsEvidenceDS(DataSet inputNodeRecivedMarginalsAsEvidenceDS)
           
 void setName(NameDescription name)
          Sets the name of the ExtendedNode to the name specified.
 void setNotes(Notes notes)
          Sets the note object of the node
 void setNPT(double[] npt)
          Sets the NPT of a node with no parents.
 void setNPT(double[][] npt, java.util.List orderedParents)
          Sets the NPT of a node with parents.
 void setNPT(double[][] npt, java.util.List orderOfParents, boolean imitateNewEvidence)
          Sets the NPT of the underyling nod ein the CoreBN using the supplied two-dimensional array of probabilities.
 void setNPTForSingleModelParentNode(double[][] partialNPT, ExtendedNode modelParentNode, boolean imitateNewEvidence)
          This is used to set a NPT on this node if the NPT has only been generated for a single parent node as a model node.
 void setNptReCalcRequired(boolean nptReCalcRequired)
          This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time.
 void setNptSynchronisedWithFormula(boolean nptSynchronisedWithFormulea)
           
 void setPartitionedExpressionModelNodes(java.util.List modelNodes)
          Sets the partitioned expression model nodes on this node.
 void setPartitionedExpressions(java.util.List expressions)
          Sets the partitioned expressions on this node.
 void setReportable(boolean reportable)
          Sets whether the ExtendedNode can be reported on or not.
 void setSavedPriors(DataSetGrouping savedPriors)
           
 void setTargetValue(double targetValue)
          Sets the target value for this ExtendedNode.
 void setTargetValueFromString(java.lang.String text)
          Sets the target value using the supplied String.
 void setTargetValuePresent(boolean targetValuePresent)
          Sets whether the target value is present or not.
 void setTemporaryNodeOrderFlag(boolean temporaryNodeOrderFlag)
           
 void setupActionForMarginalsChangedEvent(int noOfPassesAllowed, boolean forceSetOfNPT, boolean savePrior, boolean changeStatesOnInputNodeIfRequired)
          This configures the ExtendedNode so that it reacts correctly when it receives a MarginalsChangedEvent.
 void setVersion(double version)
          Sets the version number of the class.
 void setVisible(boolean visible)
          Sets whether the ExtendedNode is visible.
protected  void storeFunctionsCorrectly(java.util.List temporaryFunctions, double version)
          Stores the supplied List of functions in their correct fields within the ExtendedNode object.
 java.lang.String toString()
           
protected  void updateConnNodeId(java.lang.String newConnNodeId)
          Updates the ID of the underlying connected node.
 void updateExpressionVariable(Variable v, java.lang.String newName, double newDefaultValue)
          Updates the specified Variable to have the new Name and Default Value.
 void updateFunctionsParentConnNodeId(java.lang.String oldConnNodeId, java.lang.String newConnNodeId)
          Need to update the Functions in the ExtendedNodeFunction of this node.
protected  void updateFunctionType(uk.co.agena.minerva.model.corebn.CoreBN connBn, java.lang.String connNodeId)
          Updated the tyope of function that can be added to this node dependant on the parent configurstion.
 boolean usedInCurrentExpression(java.lang.String s)
          Check the parameters of the current Expression(s) for the occurance of the String s, which must be as a whole word/variable.
 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, wait, wait, wait
 

Field Detail

supportedFunctionTypes

protected static java.lang.String[] supportedFunctionTypes

version

public static double version

connBn

protected uk.co.agena.minerva.model.corebn.CoreBN connBn
A reference to an underlying CoreBN.


id

protected int id
The unique integer ID for the ExtendedNode.


name

protected NameDescription name
The name of the ExtendedNode.


connNodeId

protected java.lang.String connNodeId
The ID of the connected node in the underlying BN (which will a String rather than an Integer).


visible

protected boolean visible
Whether the ExtendedNode should be displayed in an application.


answerable

protected boolean answerable
Whether the ExtendedNode should have a connected Question. This variable is used when generating Questionnaires from an ExtendedBN.


reportable

protected boolean reportable
Whether the ExtendedNode should be reported on.


extendedStates

protected java.util.List extendedStates
The ExtendedStates contained in the ExtendedNode.


actOnMarginalsChangedEvent

protected int actOnMarginalsChangedEvent
This is the number of times that this object will act on a Marginals changed event. By Default it is set to 0 (ACTION_MARGINALS_CHANGED_EVENT_NEVER = it will never react). If it is -1 = ACTION_MARGINALS_CHANGED_EVENT_ALWAYS then it will always react. If it is any other positive number then after it has reacted, this number should be decremented by 1.


DELTA

protected static final double DELTA
This is the delta value we use when comparing equality between probabilities.

See Also:
Constant Field Values

DISCRETE_REAL_E_N

public static final int DISCRETE_REAL_E_N
Constant corresponding to the DiscreteRealEN type.

See Also:
Constant Field Values

CONTINUOUS_INTERVAL_E_N

public static final int CONTINUOUS_INTERVAL_E_N
Constant corresponding to the ContinuousIntervalEN type.

See Also:
Constant Field Values

NUMERICAL_E_N

public static final int NUMERICAL_E_N
Constant corresponding to the NumericalEN type.

See Also:
Constant Field Values

LABELLED_E_N

public static final int LABELLED_E_N
Constant corresponding to the LabelledEN type.

See Also:
Constant Field Values

PROBS_NOT_EDITABLE

public static final int PROBS_NOT_EDITABLE
If the ExtendedNode's functionMode has this value, its probability values cannot be edited at all.

See Also:
Constant Field Values

EDITABLE_NPT

public static final int EDITABLE_NPT
If the ExtendedNode's functionMode has this value, it will have null values for all function objects.

See Also:
Constant Field Values

EDITABLE_NODE_FUNCTION

public static final int EDITABLE_NODE_FUNCTION
If the ExtendedNode's functionMode has this value, it will have null values for parentState function objects.

See Also:
Constant Field Values

EDITABLE_PARENT_STATE_FUNCTIONS

public static final int EDITABLE_PARENT_STATE_FUNCTIONS
If the ExtendedNode's functionMode has this value, it will have null values for node function objects.

See Also:
Constant Field Values

CURRENT_FUNCTION_STRING

public static final java.lang.String CURRENT_FUNCTION_STRING
Used to indicate function data members that are "current".

See Also:
Constant Field Values

DEFAULT_FUNCTION_STRING

public static final java.lang.String DEFAULT_FUNCTION_STRING
Used to indicate function data members that are "default".

See Also:
Constant Field Values

connectableInputNode

protected boolean connectableInputNode
Defines whether the node is a possible input node for an ExtendedBN.


inputNodeReceivedMarginals

protected boolean inputNodeReceivedMarginals
Flag to inform us if this node is an Input Node, then has it received its new Marginals via a Message Pass.


connectableOutputNode

protected boolean connectableOutputNode
Defines whether the node is a possible output node for an ExtendedBN.


targetValue

protected double targetValue
A threshold value for the node that can be used to represent an upper or lower limit on the node's value about which warning should be given.


targetValuePresent

protected boolean targetValuePresent
This indicates whether a target value is currently valid for a node.


functionMode

protected int functionMode
Indicates whether this node has any functions specified for it along with the basic NPT. By default it has no functions.


nptSynchronisedWithFormula

protected boolean nptSynchronisedWithFormula
This is a flag to monitor if the npt is correct with respect to the formula entered. If the NPT is manually modified then this is set to false. When the npt if generated from a formula this flag is set to true.


nptReCalcRequired

protected boolean nptReCalcRequired
This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time. If an expression represents the NPT for the node and something causes the NPT to be invalidated with respect to the expression (e.g. The nodes states change or it parents change), this flag will be set to indicate the NPT needs to be Re-Calculated in order to be valid.


defaultNodeFunction

protected ExtendedNodeFunction defaultNodeFunction
The original function specified across the entire NPT for this node.


currentNodeFunction

protected ExtendedNodeFunction currentNodeFunction
The current function specified across the entire NPT for this node. When this is first specified, the defaultNodeFunction will be the same as this.


currentParentModelNodeAltId

protected java.lang.String currentParentModelNodeAltId
Only used during loading and saving, so that current model node information can be stored.


defaultParentModelNodeAltId

protected java.lang.String defaultParentModelNodeAltId
Only used during loading and saving, so that default model node information can be stored.


currentPartitionedParentModelNodes

protected java.util.List currentPartitionedParentModelNodes
The current model (parent) nodes for the node functions. This is assuming that the node has the EDITABLE_PARENT_STATE_FUNCTIONS type.


defaultPartitionedParentModelNodes

protected java.util.List defaultPartitionedParentModelNodes
The original model (parent) nodes for the node functions. This is assuming that the node has the EDITABLE_PARENT_STATE_FUNCTIONS type.


currentPartitionedParentModelNodeAltIds

protected java.lang.String currentPartitionedParentModelNodeAltIds
Only used during loading and saving, so that current model node information can be stored.


defaultPartitionedParentModelNodeAltIds

protected java.lang.String defaultPartitionedParentModelNodeAltIds
Only used during loading and saving, so that default model node information can be stored.


currentPartitionedModelNodeFunctions

protected java.util.List currentPartitionedModelNodeFunctions
The current functions specified for each state combination of the node's parents.


defaultPartitionedModelNodeFunctions

protected java.util.List defaultPartitionedModelNodeFunctions
The current functions specified for each state combination of the node's parents.

Constructor Detail

ExtendedNode

public ExtendedNode()
Default constructor.


ExtendedNode

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

Parameters:
name - the name of the ExtendedNode
connBn - a reference to the underlying BN
Throws:
ExtendedBNException

ExtendedNode

public ExtendedNode(NameDescription name,
                    java.lang.String connNodeId,
                    uk.co.agena.minerva.model.corebn.CoreBN connBn)
             throws ExtendedBNException
Constructs an ExtendedNode with the specified name, connected node ID and connected BN. It also creates a List of ExtendedStates for the ExtendedNode and, using the supplied BN, it gives each ExtendedState the same name as its underlying state.

Parameters:
name - the name of the ExtendedNode
connNodeId - the ID of the connected node in the underlying BN.
connBn - a reference to the underlying BN
Throws:
ExtendedBNException
Method Detail

getConcreteNodeTypeNames

public static java.lang.String[] getConcreteNodeTypeNames()
Returns the user-friendly names of all node types that are concrete i.e. that can be instantiated.

Returns:
an array of names

getConcreteNodeType

public static java.lang.Class getConcreteNodeType(java.lang.String name)
Given the user-friendly name of a node type, the actual class of the node type is returned.

Parameters:
name - the name of the node type
Returns:
the class of the node type

getConcreteNodeName

public static java.lang.String getConcreteNodeName(java.lang.Class type)
Given the class of a node type, the user-friendly name of the node type is returned.

Parameters:
type - the class of the node type
Returns:
the name of the node type, or null if one isn't found

updateFunctionType

protected void updateFunctionType(uk.co.agena.minerva.model.corebn.CoreBN connBn,
                                  java.lang.String connNodeId)
                           throws ExtendedBNException
Updated the tyope of function that can be added to this node dependant on the parent configurstion. Should be called after a parent is added or removed.

Parameters:
connBn -
connNodeId -
Throws:
ExtendedBNException

addParent

public void addParent(ExtendedNode parentNode)
               throws ExtendedBNException
Call this to add a parent to an ExtendedNode, this connects the core nodes, then updated tha parent list in this object and the function type.

Parameters:
parentNode -
Throws:
ExtendedBNException

addChild

public boolean addChild(ExtendedNode childNode)
                 throws ExtendedBNException
Call this to add a child to an ExtendedNode, this connects the core nodes, then updated the parent list in this object and the function type. The connection is only made if it will not result in an invalid graph.

Parameters:
childNode -
Returns:
If false the added link will cause a loop or non DAG and should be removed otherwise compilation will fail.
Throws:
ExtendedBNException

addExpressionVariable

public Variable addExpressionVariable(java.lang.String name,
                                      double defaultValue)
                               throws ExtendedBNException
Adds a new Variable to the VariableList with the specified name and default value. For the new Variable to be added its name must not be used by any other Variable in the specified ExtendedNodes VariableList

Parameters:
name - The String Name for the new Variable
defaultValue - The double default value for the new Variable
Returns:
The newly created Variable.
Throws:
ExtendedBNException

removeExpressionVariable

public void removeExpressionVariable(Variable v)
                              throws ExtendedBNException
Removes the specified Variable from the VariableList if it is a Member of this ExtendedNodes VariableList.

Parameters:
name - The Variable to be removed
Throws:
ExtendedBNException

updateExpressionVariable

public void updateExpressionVariable(Variable v,
                                     java.lang.String newName,
                                     double newDefaultValue)
                              throws ExtendedBNException
Updates the specified Variable to have the new Name and Default Value. The Variable must exist in this ExtendedNodes VariableList for any action to be taken.

Parameters:
v - The Variable that is to be updated
newName - The New Name for the Variable
newDefaultValue - The New Default Value for the Variable
Throws:
ExtendedBNException

usedInCurrentExpression

public boolean usedInCurrentExpression(java.lang.String s)
Check the parameters of the current Expression(s) for the occurance of the String s, which must be as a whole word/variable. Depending upon Function editing mode this may be a single Expression or Partitioned Expression.

Parameters:
s - The String we are looking for.
Returns:
true if the String occurs as a whole word in the parameters; false otherwise

getId

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

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

setId

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

Parameters:
id - the new ID for the ExtendedNode

getName

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

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

setName

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

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

getConnNodeId

public java.lang.String getConnNodeId()
Returns the ID of the underlying connected node.

Returns:
the ID of the connected node

updateConnNodeId

protected void updateConnNodeId(java.lang.String newConnNodeId)
                         throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                ExtendedBNException
Updates the ID of the underlying connected node.

Parameters:
connNodeId - the ID of the connected node
Throws:
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException
ExtendedBNException

setConnNodeId

public void setConnNodeId(java.lang.String connNodeId)

getVisible

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

Returns:
true if the ExtendedNode is visible, false otherwise

setVisible

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

Parameters:
visible - whether the ExtendedNode is visible

getReportable

public boolean getReportable()
Returns whether the ExtendedNode can be reported on.

Returns:
true if the ExtendedNode is reportable, false otherwise

setReportable

public void setReportable(boolean reportable)
Sets whether the ExtendedNode can be reported on or not.

Parameters:
reportable - whether the ExtendedNode is reportable

getTargetValue

public double getTargetValue()
Returns the target value for this ExtendedNode.

Returns:
the target value for this ExtendedNode

setTargetValue

public void setTargetValue(double targetValue)
Sets the target value for this ExtendedNode.

Parameters:
targetValue - the new target value for this ExtendedNode

getAnswerable

public boolean getAnswerable()
Returns whether the ExtendedNode is answerable.

Returns:
true if the ExtendedNode is answerable, false otherwise

setAnswerable

public void setAnswerable(boolean answerable)
Sets whether the ExtendedNode is answerable.

Parameters:
answerable - whether the ExtendedNode is answerable

isConnectableInputNode

public boolean isConnectableInputNode()
Returns whether this ExtendedNode is a potential input node.

Returns:
true if it is a potential input node, false otherwise

setConnectableInputNode

public void setConnectableInputNode(boolean connectableInputNode)
Sets whether this ExtendedNode is a potential input node.

Parameters:
connectableInputNode - whether this ExtendedNode is a potential input node

isConnectableOutputNode

public boolean isConnectableOutputNode()
Returns whether this ExtendedNode is a potential output node.

Returns:
true if it is a potential output node, false otherwise

setConnectableOutputNode

public void setConnectableOutputNode(boolean connectableOutputNode)
Sets whether this ExtendedNode is a potential output node.

Parameters:
connectableOutputNode - whether this ExtendedNode is a potential output node

hasParents

public boolean hasParents()
                   throws ExtendedBNException
Indicates whether this ExtendedNode has any parents.

Returns:
true if the ExtendedNode has parents, false otherwise
Throws:
ExtendedBNException - if there is a problem accessing the underlying node in the CoreBN

getConnBn

public uk.co.agena.minerva.model.corebn.CoreBN getConnBn()
Gets the underlying BN to which this ExtendedNode is connected.

Returns:
the connected BN implementation

setConnBn

public void setConnBn(uk.co.agena.minerva.model.corebn.CoreBN connBn)
Sets the underlying BN to which this ExtendedNode is connected.

Parameters:
connBn - the connected BN implementation

getDefaultNodeFunction

public ExtendedNodeFunction getDefaultNodeFunction()
Gets the default node function for this ExtendedNode.

Returns:
the default node function for this ExtendedNode

setDefaultNodeFunction

public void setDefaultNodeFunction(ExtendedNodeFunction defaultNodeFunction)
Sets the default node function for this ExtendedNode.

Parameters:
defaultNodeFunction - the default node function for this ExtendedNode

getCurrentNodeFunction

public ExtendedNodeFunction getCurrentNodeFunction()
Gets the current node function for this ExtendedNode.

Returns:
the current node function for this ExtendedNode

setCurrentNodeFunction

public void setCurrentNodeFunction(ExtendedNodeFunction currentNodeFunction)
Sets the current node function for this ExtendedNode.

Parameters:
currentNodeFunction - the current node function for this ExtendedNode

getExpression

public ExtendedNodeFunction getExpression()
Gets the name of the expression for this node.

Returns:
the name of the Expression or null if there is no expression

setExpression

public void setExpression(ExtendedNodeFunction expression)
Sets the expression on this node. Note: You have to regenerate the NPT after setting the expression.

Parameters:
expression - the expression for this node

getPartitionedExpressions

public java.util.List getPartitionedExpressions()
Returns the partitioned expressions currently defined on this node.

Returns:
a List of ExtendedNodeFunction objects

setPartitionedExpressions

public void setPartitionedExpressions(java.util.List expressions)
Sets the partitioned expressions on this node. The list should contain as many expressions as there are state combinations of the model nodes.

Parameters:
name -
parameters -

getPartitionedExpressionModelNodes

public java.util.List getPartitionedExpressionModelNodes()
Returns the partitioned expression model nodes currently defined on this node.

Returns:
a List of ExtendedNodeFunction objects

setPartitionedExpressionModelNodes

public void setPartitionedExpressionModelNodes(java.util.List modelNodes)
Sets the partitioned expression model nodes on this node.

Parameters:
name -
parameters -

getNotes

public Notes getNotes()
Returns the note object for the node

Returns:

setNotes

public void setNotes(Notes notes)
Sets the note object of the node

Parameters:
notes -

getExpressionVariables

public VariableList getExpressionVariables()

setExpressionVariables

public void setExpressionVariables(VariableList expressionVariables)

getFunctionMode

public int getFunctionMode()
Returns the function mode for this ExtendedNode.

Returns:
one of the following: PROBS_NOT_EDITABLE, EDITABLE_NPT, EDITABLE_NODE_FUNCTION or EDITABLE_PARENT_STATE_FUNCTIONS

setFunctionMode

public void setFunctionMode(int functionMode)
Sets the function mode of this ExtendedNode.

Parameters:
functionMode - one of the following: PROBS_NOT_EDITABLE, EDITABLE_NPT, EDITABLE_NODE_FUNCTION or EDITABLE_PARENT_STATE_FUNCTIONS

getNPTPopulationMethodAsString

public java.util.List getNPTPopulationMethodAsString()
returns a list of strings that represent the NPT editing mode (and function list if suitable)


getScaledTargetValue

public double getScaledTargetValue()
                            throws ExtendedBNException
Normalises the ExtendedStates so that the first one has the value 0, the next has value 1 and so on. The target value is then rescaled so that it features at the appropriate point on this new scale. The purpose of this method is to allow the target value to be mapped generically on a graph.

The default implementation of this method does little work since the states are assumed already to have numerical values that begin at 0. However, it is overridden in subclasses.

Returns:
the scaled target value
Throws:
ExtendedBNException - if there is a problem accessing or scaling the target value (only thrown in selected subclasses)

getExtendedStates

public java.util.List getExtendedStates()
Returns a list of all the ExtendedStates contained in this ExtendedNode.

Returns:
a List of ExtendedStates

getExtendedStateShortNames

public java.lang.String[] getExtendedStateShortNames()
Returns an array of the short names of all ExtendedStates.

Returns:
the array of state names

getExtendedStateAtIndex

public ExtendedState getExtendedStateAtIndex(int index)
Returns the state at the supplied index in the list.

Parameters:
index - the index of the required state
Returns:
the state or null if there are no states in the list

getExtendedStateWithName

public ExtendedState getExtendedStateWithName(java.lang.String name)
Returns the state with the supplied name.

Parameters:
name - the name of the required state
Returns:
the state or null if a state with that name doesn't exist

getExtendedState

public ExtendedState getExtendedState(int id)
                               throws ExtendedStateNotFoundException
Returns the ExtendedState with the specified ID.

Parameters:
id - the ID of the required ExtendedState
Returns:
the required ExtendedState
Throws:
ExtendedStateNotFoundException - if an ExtendedState with the specified ID does not exist in this ExtendedNode

getExtendedStateWithShortDesc

public ExtendedState getExtendedStateWithShortDesc(java.lang.String shortDesc)
                                            throws ExtendedStateNotFoundException
Returns the ExtendedState with the specified Short NameDescription.

Parameters:
shortDesc - the short NameDescription of the required ExtendedState
Returns:
the required ExtendedState
Throws:
ExtendedStateNotFoundException - if an ExtendedState with the specified Short NameDescription does not exist in this ExtendedNode

addExtendedState

public void addExtendedState(ExtendedState extendedState,
                             boolean autoAssignId)
Adds an ExtendedState to this ExtendedNode's List of ExtendedStates. The ID of the ExtendedState will be changed to fit in with the numbering scheme used by the ExtendedNode depending on the value of the autoAssignId boolean.

Parameters:
extendedState - the ExtendedState to be added
autoAssignId - whether the ID should be reassigned or not

addExtendedState

public void addExtendedState(ExtendedState extendedState,
                             boolean autoAssignId,
                             int position)
Adds an ExtendedState to this ExtendedNode's List of ExtendedStates. The ID of the ExtendedState will be changed to fit in with the numbering scheme used by the ExtendedNode depending on the value of the autoAssignId boolean.

Parameters:
extendedState - the ExtendedState to be added
autoAssignId - whether the ID should be reassigned or not

createNewExtendedState

public abstract ExtendedState createNewExtendedState(int index)
                                              throws ExtendedNodeMethodNotSupportedException,
                                                     ExtendedBNException
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.

Parameters:
index -
Returns:
Throws:
ExtendedBNException
MinervaRangeException
ExtendedNodeMethodNotSupportedException

configureDefaultExtendedStates

public abstract void configureDefaultExtendedStates()
                                             throws ExtendedStateException
Configures a default set of ExtendedStates for a node. Each node type has its own set of default states to be used.

Throws:
ExtendedStateException

setExtendedStates

public void setExtendedStates(java.util.List extendedStates,
                              boolean autoAssignIds)
Reinitialises the ExtendedNode's List of ExtendedStates with those in the supplied List. The ID of each ExtendedState is changed to fit in with the ExtendedNode's internal numbering scheme depending on the value of the autoAssignIds boolean.

Parameters:
extendedStates - the new List of ExtendedStates
autoAssignIds - whether the IDs should be reassigned

removeExtendedState

public int removeExtendedState(int extendedStateId)
                        throws ExtendedNodeMethodNotSupportedException,
                               ExtendedBNException
Removes the ExtendedState with the specified ID from the ExtendedNode's List. And from the connected core. Returns the int index of where the element was removed from.

Parameters:
extendedStateId - the ID of the ExtendedState to be removed
Throws:
ExtendedStateNotFoundException - if an ExtendedState with the specified ID does not exist
ExtendedNodeMethodNotSupportedException
ExtendedBNException

enterHardEvidence

public void enterHardEvidence(int stateId,
                              boolean propagate)
                       throws ExtendedBNException
Enters evidence on this node to indicate that the ExtendedState specified has been selected.

Parameters:
stateId - the ID of the ExtendedState that has been selected
propagate - whether the evidence should be propagated immediately or not
Throws:
ExtendedBNException - if there is a problem entering the hard evidence

enterHardEvidence

public void enterHardEvidence(int stateId,
                              boolean propagate,
                              boolean useClosestMedian)
                       throws ExtendedBNException
Enters evidence on this node to indicate that the ExtendedState specified has been selected. Uses the state which has a median value closest to the mid-point of the state where we wanted the evidence.

Parameters:
stateId - the ID of the ExtendedState that has been selected
propagate - whether the evidence should be propagated immediately or not
useClosestMedian - If inconsistent evidence is entered using the hard evidence state, then the closest median state is used.
Throws:
ExtendedBNException - if there is a problem entering the hard evidence

enterDistributionOfEvidence

public void enterDistributionOfEvidence(DataSet distribution,
                                        boolean propagate)
                                 throws ExtendedBNException
Enters evidence on this ExtendedNode in the form of a distribution of likelihoods across all ExtendedStates. This distribution is specified in the form of a DataSet where each DataPoint contains the observed probability for one of the ExtendedStates.

In the event that the values of all DataPoints in the DataSet do not add up to 1, they are normalised by the underlying BN.

Parameters:
distribution - a DataSet containing the distributed evidence
propagate - whether the evidence should be propagated immediately or not
Throws:
ExtendedBNException - if a problem is encountered when entering evidence

enterDistributionOfEvidence

public void enterDistributionOfEvidence(DataSet distribution,
                                        boolean propagate,
                                        DataSet datasetToShow)
                                 throws ExtendedBNException
Enters evidence on this ExtendedNode in the form of a distribution of likelihoods across all ExtendedStates. This distribution is specified in the form of a DataSet where each DataPoint contains the observed probability for one of the ExtendedStates.

In the event that the values of all DataPoints in the DataSet do not add up to 1, they are normalised by the underlying BN.

Parameters:
distribution - a DataSet containing the distributed evidence
propagate - whether the evidence should be propagated immediately or not
datasetToShow - the DataSet that should be shown after propagation (if not the marginals)
Throws:
ExtendedBNException - if a problem is encountered when entering evidence

getMarginals

public DataSet getMarginals()
                     throws ExtendedBNException
Returns the marginal probabilities for the node in the form of a DataSet. Each DataPoint in the DataSet contains an ID of the ExtendedState to which it is connected and the probability value for that ExtendedState.

Returns:
a DataSet containing the marginals
Throws:
ExtendedStateNumberingException - if the ExtendedNode does not have the same number of states as its connected node in the underlying BN
ExtendedBNException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

replicateNodeStates

public void replicateNodeStates(ExtendedNode states2copyNode)
                         throws ExtendedBNException
This method will take the states from the argument extended node and copy them to this node. This is useful in message passing and other areas where you require 2 nodes to have the same state information.

Parameters:
states2copyNode -
Throws:
ExtendedBNException

createDataPointFromExtendedState

protected DataPoint createDataPointFromExtendedState(ExtendedState es,
                                                     double value)
                                              throws ExtendedBNException
Creates a DataPoint using information in the supplied ExtendedState.

Parameters:
es - the ExtendedState used to construct the DataPoint
value - the probability value associated with the ExtendedState for storing in the DataPoint
Returns:
the newly created DataPoint
Throws:
ExtendedBNException - if there is a problem creating the DataPoint (only thrown in selected subclasses)

fireMarginalsChangedEvent

protected void fireMarginalsChangedEvent()
                                  throws ExtendedBNException
Called by an ExtendedBN when either propagation or retraction is called, because this node's marginals may have changed. This then informs all its listeners that its marginals have changed.

Throws:
ExtendedBNException - if there is a problem with getting the marginals when firing the MarginalsChangedEvent

setupActionForMarginalsChangedEvent

public void setupActionForMarginalsChangedEvent(int noOfPassesAllowed,
                                                boolean forceSetOfNPT,
                                                boolean savePrior,
                                                boolean changeStatesOnInputNodeIfRequired)
                                         throws ExtendedBNException
This configures the ExtendedNode so that it reacts correctly when it receives a MarginalsChangedEvent.

Parameters:
noOfPassesAllowed - the number of passes allowed
forceSetOfNPT - whether the NPT should be forced to update
savePrior - if true, the priors will be saved now; if false, they will not
Throws:
ExtendedBNException - if there is a problem encountered when saving the priors

savePrior

public void savePrior()
               throws ExtendedBNException
Add the current marginals of this node as saved priors (before touchTable or setNPT is called).

Throws:
ExtendedBNException - if there is a problem getting the marginals from the underlying node

revert2savedPrior

public int revert2savedPrior(int savedIndex)
                      throws ExtendedBNException
Sets the NPT for the node to the savedPrior at the given index if it exists. If not then the last saved prior is loaded. The index of the set of priors that is eventually loaded is return, or -1 if there were no priors save at all.

Parameters:
savedIndex - the index of the priors that should be used for reverting
Returns:
the index of the priors that were eventually loaded or -1 if there were none
Throws:
ExtendedBNException

getLastSavedPriorIndex

public int getLastSavedPriorIndex()
Returns the index of the last saved priors

Returns:
the index of the last saved priors

removeAllFurtherSavedPriors

public void removeAllFurtherSavedPriors(int removeAllFromThisIndex)
                                 throws ExtendedBNException
Reomves the priors stored at the given index and all subsequent priors too.

Parameters:
removeAllFromThisIndex - the index where priors should be removed from
Throws:
ExtendedBNException

addExtendedNodeListener

public void addExtendedNodeListener(ExtendedNodeListener enl)
Adds an object interested in ExtendedNodeEvents to the List of ExtendedNodeListeners (actually held by an internal ExtendedNodeEventGenerator).

Parameters:
enl - the interested ExtendedNodeListener

removeExtendedNodeListener

public void removeExtendedNodeListener(ExtendedNodeListener enl)
Removes an object no longer interested in ExtendedNodeEvents from the List of ExtendedNodeListeners (actually held by an internal ExtendedNodeEventGenerator).

Parameters:
enl - the interested ExtendedNodeListener

getNextExtendedStateId

protected int getNextExtendedStateId()
Finds the next available ID to assign to an ExtendeNode based on the IDs of those currently in the ExtendedBN's List.

Returns:
the next available ID

extendedNodeNameDescriptionChanged

public void extendedNodeNameDescriptionChanged(ExtendedNodeEvent ene)
This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.

Parameters:
ene -

extendedNodeInconsistentEvidenceEntered

public void extendedNodeInconsistentEvidenceEntered(ExtendedNodeEvent ene)
This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.

Specified by:
extendedNodeInconsistentEvidenceEntered in interface ExtendedNodeListener
Parameters:
ene -

extendedNodeConnBNNotFound

public void extendedNodeConnBNNotFound(ExtendedNodeEvent ene)
This method is not implemented - it is an empty stub to ensure compliance with the ExtendedNodeListener interface.

Specified by:
extendedNodeConnBNNotFound in interface ExtendedNodeListener
Parameters:
ene -

extendedStateAdded

public void extendedStateAdded(ExtendedNodeEvent ene)
New ExtendedState created and added to this node and added all the way to the core.

Specified by:
extendedStateAdded in interface ExtendedNodeListener
Parameters:
ene -

extendedStateRemoved

public void extendedStateRemoved(ExtendedNodeEvent ene,
                                 int indexOfStateRemoved)
ExtendedNode removed from this node and all the way to the core.

Specified by:
extendedStateRemoved in interface ExtendedNodeListener
Parameters:
ene -

extendedNodeStateNameChanged

public void extendedNodeStateNameChanged(ExtendedNodeEvent ene,
                                         ExtendedState es)
Dont need to do anything if one of its states have changed their names.

Specified by:
extendedNodeStateNameChanged in interface ExtendedNodeListener
Parameters:
ene -
es -

extendedNodeAttributeChanged

public void extendedNodeAttributeChanged(ExtendedNodeEvent ene,
                                         int attribute)
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
Parameters:
ene -
attribute -

extendedNodeConnNodeIdChanged

public void extendedNodeConnNodeIdChanged(ExtendedNodeEvent ene)
No action needed when the ConnNodeId of an ExtendedNode is changed.

Specified by:
extendedNodeConnNodeIdChanged in interface ExtendedNodeListener
See Also:
ExtendedNodeListener.extendedNodeConnNodeIdChanged(uk.co.agena.minerva.model.extendedbn.ExtendedNodeEvent)

extendedNodeVisibleAttributeChanged

public void extendedNodeVisibleAttributeChanged(ExtendedNodeEvent ene,
                                                boolean visible)
Description copied from interface: ExtendedNodeListener
Invoked when an ExtendedNode visible attribute is changed.

Specified by:
extendedNodeVisibleAttributeChanged in interface ExtendedNodeListener

extendedNodeStatesReplaced

public void extendedNodeStatesReplaced(ExtendedNodeEvent ene)
Description copied from interface: ExtendedNodeListener
Called when the node's states are replaced.

Specified by:
extendedNodeStatesReplaced in interface ExtendedNodeListener

extendedNodeMarginalsChanged

public void extendedNodeMarginalsChanged(ExtendedNodeEvent ene,
                                         boolean useMarginalDataSetForStateReplication)
Called whenever the marginals for a particular node have changed.

Specified by:
extendedNodeMarginalsChanged in interface ExtendedNodeListener
Parameters:
ene - the event indicating the change
useMarginalDataSetForStateReplication - This should be true if the event has been called manually, because outputnode wont still have the states it had when it finished propagating.

extendedNodeVariableAdded

public void extendedNodeVariableAdded(ExtendedNodeEvent ene,
                                      Variable addedVarible)
Invoked when a Variable is added to the ExtendedNodes VariableList.

Specified by:
extendedNodeVariableAdded in interface ExtendedNodeListener
Parameters:
ene - The ExtendedNode event.
addedVarible - The Variable that was added.

extendedNodeVariableRemoved

public void extendedNodeVariableRemoved(ExtendedNodeEvent ene,
                                        Variable removedVarible)
Invoked when a Variable is removed from the ExtendedNodes VariableList.

Specified by:
extendedNodeVariableRemoved in interface ExtendedNodeListener
Parameters:
ene - The ExtendedNode event.
removedVarible - The Variable that was removed.

nodeChanged

public void nodeChanged(ExtendedNodeEvent ene)
Called whenever a node changes (for selected events)

Specified by:
nodeChanged in interface ExtendedNodeListener
Parameters:
ebne - the event encapsulating the change

mode

public java.util.List mode()
                    throws ExtendedBNException
Calculates the mode of the marginals for this ExtendedNode.

Returns:
a List of ExtendedStates that correspond to the mode
Throws:
ExtendedBNException

getHardEvidence

public ExtendedState getHardEvidence()
                              throws ExtendedBNException
This method will return an ExtendedState in which there is hard evidence. If there is no hard evidence in any of the ExtendedStates in the ExtendeNode then null is returned. Hard evidence is defined as being a state with a probability value of 1. Note that it is possible in a given node for a state to achieve this value even without an observation. This is NOT taken into consideration in this method. This method uses the getDataSetToShow() method. If the result of this is null, the getModifiedMarginals() method is called.

Returns:
An ExtendedState in which there is hard evidence.
Throws:
ExtendedBNException - if there is a problem accessing the underlying marginals

getNodeType

public int getNodeType()
Returns the type of this ExtendedNode.

Returns:
the type of the ExtendedNode: one of DISCRETE_REAL_E_N, CONTINUOUS_INTERVAL_E_N or LABELLED_E_N

getRowMajorNPT

public float[] getRowMajorNPT()
                       throws ExtendedBNException
Returns the NPT of the underlying node in the CoreBN as a row major array of probabilities. This will get the NPT as required for the display. That is that the row major is re-ordered so that the node you are getting the NPT for is at the end of the list. Hence its state range changes the quickest.

Returns:
the NPT of the underlying node in the CoreBN as a row major array of probabilities
Throws:
ExtendedBNException - if there is a problem compiling the underlying CoreBN or retrieving the NPT.

getNPT

public float[][] getNPT()
                 throws ExtendedBNException
Returns the NPT of this node as a 2D array of floats.

Returns:
the NPT of this node
Throws:
ExtendedBNException

getSuitableMessagePassingNodes

public java.util.List getSuitableMessagePassingNodes(java.util.List targetNodes)
Searches through the supplied List and returns a List of ExtendedNodes that have the same number of ExtendedStates.

Parameters:
targetNodes -
Returns:
a List of ExtendedNodes that have the same number of ExtendedStates

setNPT

public void setNPT(double[][] npt,
                   java.util.List orderOfParents,
                   boolean imitateNewEvidence)
            throws ExtendedBNException
Sets the NPT of the underyling nod ein the CoreBN using the supplied two-dimensional array of probabilities.

Parameters:
npt - a two-dimensional array of probabilities
imitateNewEvidence - TODO
Throws:
ExtendedBNException - if there is a problem setting the NPT

setNPT

public void setNPT(double[] npt)
            throws ExtendedBNException
Sets the NPT of a node with no parents.

Parameters:
npt - a one-dimensional array of probabilities
Throws:
ExtendedBNException - if there is a problem setting the NPT

setNPT

public void setNPT(double[][] npt,
                   java.util.List orderedParents)
            throws ExtendedBNException
Sets the NPT of a node with parents.

Parameters:
npt - a two-dimensional array of probabilities
orderedParents - an order list of the node's parents to indicate how the table should be constructed
Throws:
ExtendedBNException - if there is a problem setting the NPT

setNPTForSingleModelParentNode

public void setNPTForSingleModelParentNode(double[][] partialNPT,
                                           ExtendedNode modelParentNode,
                                           boolean imitateNewEvidence)
                                    throws ExtendedBNException
This is used to set a NPT on this node if the NPT has only been generated for a single parent node as a model node. The argument double[][] should be the NPT that is associated with this nodes relationship with the parent node (with parentModelNode). The double[x][y] is where x is the column associated with the parent state and the y is the rows associated with the states of this node.

Parameters:
partialNPT -
modelParentNode -
imitateNewEvidence - TODO
Throws:
ExtendedBNException

getTargetValueRange

public Range getTargetValueRange(boolean scaleInfinities)
                          throws ExtendedBNException
Gets the Range in which the target value can lie. The default case returns a Range representing the start and end values of the ExtendedStates. Subclasses will override this implementation.

Returns:
a Range representing the start and end indices of the ExtendedStates
Throws:
ExtendedBNException - if there is a problem creating the Range.

getTargetValueRangeAsString

public java.lang.String getTargetValueRangeAsString()
                                             throws ExtendedBNException
Returns the target value range as a String for displaying to a system user. Subclasses will override this implementation.

Returns:
the target value range as a String
Throws:
ExtendedBNException - if there is a problem accessing the Range (only thrown in selected

getTargetValueAsString

public java.lang.String getTargetValueAsString()
Returns the target value as a String. If there is no target value, then an empty String will be returned.

Returns:
the target value as a String, or an empty String

setTargetValueFromString

public void setTargetValueFromString(java.lang.String text)
Sets the target value using the supplied String.

Parameters:
text - the String used for setting the target value

isTargetValuePresent

public boolean isTargetValuePresent()
Indicates whether a target value is present for this ExtendedNode.

Returns:
true if a target value is present, false otherwise

setTargetValuePresent

public void setTargetValuePresent(boolean targetValuePresent)
Sets whether the target value is present or not.

Parameters:
targetValuePresent - whether the target value is present or not

extendedStateNameDescriptionChanged

public void extendedStateNameDescriptionChanged(ExtendedStateEvent ene)
Listens to the extendedstate to see if they fire an event that their name has changed. If it does then in turn this fires an event to tell everything that one of its states have changed their names.

Specified by:
extendedStateNameDescriptionChanged in interface ExtendedStateListener
Parameters:
ene -

getCurrentPartitionedModelNodeFunctions

public java.util.List getCurrentPartitionedModelNodeFunctions()
Returns:
Returns the currentPartitionedModelNodeFunctions.

setCurrentPartitionedModelNodeFunctions

public void setCurrentPartitionedModelNodeFunctions(java.util.List currentPartitionedModelNodeFunctions)
Parameters:
currentPartitionedModelNodeFunctions - The currentPartitionedModelNodeFunctions to set.

getCurrentPartitionedParentModelNodes

public java.util.List getCurrentPartitionedParentModelNodes()
Returns:
Returns the currentPartitionedParentModelNodes.

getNumberOfStateCombsForModelNodes

public int getNumberOfStateCombsForModelNodes(int type)
Returns the number of state combinations for the parent model nodes of this node.

Parameters:
type - either ExtendedNodeFunction.CURRENT_TYPE or ExtendedNodeFunction.DEFAULT_TYPE
Returns:
the number of state combinations for the parent model nodes of this node

cropFunctions

public void cropFunctions()
In the case where there are partitioned expressions, this method makes sure that the number of current and default functions is the same size as the number expected based up on the number of state combinations of the model parent nodes.


setCurrentPartitionedParentModelNodes

public void setCurrentPartitionedParentModelNodes(java.util.List currentPartitionedParentModelNodes)
Parameters:
currentPartitionedParentModelNodes - The currentPartitionedParentModelNodes to set.

getDefaultPartitionedModelNodeFunctions

public java.util.List getDefaultPartitionedModelNodeFunctions()
Returns:
Returns the defaultPartitionedModelNodeFunctions.

setDefaultPartitionedModelNodeFunctions

public void setDefaultPartitionedModelNodeFunctions(java.util.List defaultPartitionedModelNodeFunctions)
Parameters:
defaultPartitionedModelNodeFunctions - The defaultPartitionedModelNodeFunctions to set.

getDefaultPartitionedParentModelNodes

public java.util.List getDefaultPartitionedParentModelNodes()
Returns:
Returns the defaultPartitionedParentModelNodes.

setDefaultPartitionedParentModelNodes

public void setDefaultPartitionedParentModelNodes(java.util.List defaultPartitionedParentModelNodes)
Parameters:
defaultPartitionedParentModelNodes - The defaultPartitionedParentModelNodes to set.

containsOnlyStatisticalFunctions

public boolean containsOnlyStatisticalFunctions()
Looks at the node's function or functions and returns true if there are only statistical (i.e. not comparative or arithmetic ones) and false otherwise.

Returns:

containsFunctionOfType

public boolean containsFunctionOfType(java.lang.String functionDisplayName)

getTotalNumberOfExtendedFunctions

protected int getTotalNumberOfExtendedFunctions()
Calculates the total number of functions in use.

Returns:
the total number of functions in use

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

getCoreBNNodeEquivalents

protected uk.co.agena.minerva.model.corebn.CoreBNNodeList getCoreBNNodeEquivalents(java.util.List extendedNodes)
                                                                            throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException
Throws:
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

storeFunctionsCorrectly

protected void storeFunctionsCorrectly(java.util.List temporaryFunctions,
                                       double version)
                                throws ExtendedNodeFunctionException
Stores the supplied List of functions in their correct fields within the ExtendedNode object.

Parameters:
temporaryFunctions - the functions to store
version - the version of the file we're dealing with
Throws:
ExtendedNodeFunctionException

getCurrentParentModelNodeAltId

public java.lang.String getCurrentParentModelNodeAltId()
Returns:
Returns the currentParentModelNodeId.

getDefaultParentModelNodeAltId

public java.lang.String getDefaultParentModelNodeAltId()
Returns:
Returns the defaultParentModelNodeId.

updateFunctionsParentConnNodeId

public void updateFunctionsParentConnNodeId(java.lang.String oldConnNodeId,
                                            java.lang.String newConnNodeId)
Need to update the Functions in the ExtendedNodeFunction of this node. The newConnNodeId string is the new ConnNodeId for one of the this nodes parents.

Parameters:
oldConnNodeId -
newConnNodeId -

isNptSynchronisedWithFormula

public boolean isNptSynchronisedWithFormula()
Returns:
Returns the nptSynchronisedWithFormula.

setNptSynchronisedWithFormula

public void setNptSynchronisedWithFormula(boolean nptSynchronisedWithFormulea)
Parameters:
nptSynchronisedWithFormula - The nptSynchronisedWithFormula to set.

constructExtraFieldString

protected java.lang.String constructExtraFieldString()
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be written out. The default behaviour is to return an empty String. The first character should always be the field separator.

Returns:
a String containing the concatenated fields

processExtraFields

protected void processExtraFields(java.util.StringTokenizer extraFields,
                                  double localVersion)
This should be overridden by any subclass of ExtendedNode that has additional fields that need to be read in. The default behaviour is to do nothing.

Parameters:
a - StringTokenizer pointing to a String that contains concatenated fields

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

cloneTypeSpecific

public void cloneTypeSpecific(ExtendedNode oldEXN)
                       throws ExtendedBNException
Empty method which can be overridden by subclass ExtendedNodes so data specific to that type can be cloned.

Parameters:
oldEXN - The ExtendedNode the specific type data can be cloned from.
Throws:
ExtendedBNException

copy

public ExtendedNode copy(java.lang.Class type)
                  throws ExtendedNodeCreationException,
                         ExtendedBNException
Creates a shallow copy of this ExtendedNode by copying references to all of its data into a new instance of the supplied node type. This should only be used if the original node is to be deleted immediately afterwards.

Parameters:
type - the type of node that will be created
Returns:
the newly created node
Throws:
ExtendedNodeCreationException - if there is a problem during creation
ExtendedBNException

getActOnMarginalsChangedEvent

public int getActOnMarginalsChangedEvent()
Returns:
Returns the actOnMarginalsChangedEvent.

setActOnMarginalsChangedEvent

public void setActOnMarginalsChangedEvent(int actOnMarginalsChangedEvent)
Parameters:
actOnMarginalsChangedEvent - The actOnMarginalsChangedEvent to set.

isChangeStatesOnInputNodeIfRequired

public boolean isChangeStatesOnInputNodeIfRequired()
Returns:
Returns the changeStatesOnInputNodeIfRequired.

setChangeStatesOnInputNodeIfRequired

public void setChangeStatesOnInputNodeIfRequired(boolean changeStatesOnInputNodeIfRequired)
Parameters:
changeStatesOnInputNodeIfRequired - The changeStatesOnInputNodeIfRequired to set.

getSavedPriors

public DataSetGrouping getSavedPriors()
Returns:
Returns the savedPriors.

setSavedPriors

public void setSavedPriors(DataSetGrouping savedPriors)
Parameters:
savedPriors - The savedPriors to set.

setCurrentParentModelNodeAltId

public void setCurrentParentModelNodeAltId(java.lang.String currentParentModelNodeAltId)
Parameters:
currentParentModelNodeAltId - The currentParentModelNodeAltId to set.

setDefaultParentModelNodeAltId

public void setDefaultParentModelNodeAltId(java.lang.String defaultParentModelNodeAltId)
Parameters:
defaultParentModelNodeAltId - The defaultParentModelNodeAltId to set.

setExtendedStates

public void setExtendedStates(java.util.List extendedStates)
Parameters:
extendedStates - The extendedStates to set.

isNptReCalcRequired

public boolean isNptReCalcRequired()
This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time. If an expression represents the NPT for the node and something causes the NPT to be invalidated with respect to the expression (e.g. The nodes states change or it parents change), this flag will be set to indicate the NPT needs to be Re-Calculated in order to be valid.

Returns:
Returns the nptReCalcRequired.

setNptReCalcRequired

public void setNptReCalcRequired(boolean nptReCalcRequired)
This is a flag to monitor if the NPT needs to be Re-Calculated at any point in time. If an expression represents the NPT for the node and something causes the NPT to be invalidated with respect to the expression (e.g. The nodes states change or it parents change), this flag will be set to indicate the NPT needs to be Re-Calculated in order to be valid.

Parameters:
nptReCalcRequired - The nptReCalcRequired to set.

createExtendedStates

public abstract java.util.List createExtendedStates(DataSet ds)
                                             throws ExtendedStateNumberingException,
                                                    ExtendedStateException
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.

Parameters:
ds - the DataSet used for creating the ExtendedStates
Returns:
a List of created ExtendedStates
Throws:
ExtendedStateNumberingException
ExtendedStateException

createDataSetForExtendedStates

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

Returns:
Throws:
ExtendedStateException

addExtendedStates

public void addExtendedStates(java.util.List states,
                              int index,
                              boolean autoAssignId)
Adds the supplied states at the specified index in the list.

Parameters:
states -
index -
b -

recalculateConnStateIndices

public void recalculateConnStateIndices()

replaceState

public abstract 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.

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

getSupportedFunctionTypes

public java.lang.String[] getSupportedFunctionTypes()
Returns a list of the function classes supported by this node type.

Returns:

isInputNodeRecivedMarginalsAsEvidence

public boolean isInputNodeRecivedMarginalsAsEvidence()
Returns:
Returns the inputNodeRecivedMarginalsAsEvidence.

setInputNodeRecivedMarginalsAsEvidence

public void setInputNodeRecivedMarginalsAsEvidence(boolean inputNodeRecivedMarginalsAsEvidence)
Parameters:
inputNodeRecivedMarginalsAsEvidence - The inputNodeRecivedMarginalsAsEvidence to set.

getInputNodeRecivedMarginalsAsEvidenceDS

public DataSet getInputNodeRecivedMarginalsAsEvidenceDS()
Returns:
Returns the inputNodeRecivedMarginalsAsEvidenceDS.

setInputNodeRecivedMarginalsAsEvidenceDS

public void setInputNodeRecivedMarginalsAsEvidenceDS(DataSet inputNodeRecivedMarginalsAsEvidenceDS)
Parameters:
inputNodeRecivedMarginalsAsEvidenceDS - The inputNodeRecivedMarginalsAsEvidenceDS to set.

getCurrentPartitionedParentModelNodeAltIds

public java.lang.String getCurrentPartitionedParentModelNodeAltIds()
Returns:
Returns the currentPartitionedParentModelNodeAltIds.

setCurrentPartitionedParentModelNodeAltIds

public void setCurrentPartitionedParentModelNodeAltIds(java.lang.String currentPartitionedParentModelNodeAltIds)
Parameters:
currentPartitionedParentModelNodeAltIds - The currentPartitionedParentModelNodeAltIds to set.

getDefaultPartitionedParentModelNodeAltIds

public java.lang.String getDefaultPartitionedParentModelNodeAltIds()
Returns:
Returns the defaultPartitionedParentModelNodeAltIds.

setDefaultPartitionedParentModelNodeAltIds

public void setDefaultPartitionedParentModelNodeAltIds(java.lang.String defaultPartitionedParentModelNodeAltIds)
Parameters:
defaultPartitionedParentModelNodeAltIds - The defaultPartitionedParentModelNodeAltIds to set.

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable

getSamplesForState

public abstract java.lang.Object getSamplesForState(int index,
                                                    boolean boundsOnly)
                                             throws ExtendedStateException
Returns a set of values that are sampled from the state at the supplied index. Different subtypes use different sampling algorithms and will return different types (e.g. doubles, Strings).

Parameters:
index - the index of the state that is to be sampled
boundsOnly - TODO
Returns:
an Object encapsulating an array of samples
Throws:
ExtendedStateNotFoundException - if there is no state at the supplied index
ExtendedStateException

isTemporaryNodeOrderFlag

public boolean isTemporaryNodeOrderFlag()

setTemporaryNodeOrderFlag

public void setTemporaryNodeOrderFlag(boolean temporaryNodeOrderFlag)

isInputNodeReceivedMarginals

public boolean isInputNodeReceivedMarginals()
Returns:
Returns the inputNodeReceivedMarginals.

setInputNodeReceivedMarginals

public void setInputNodeReceivedMarginals(boolean inputNodeReceivedMarginals)
Parameters:
inputNodeReceivedMarginals - The inputNodeReceivedMarginals to set.

getNPTSize

public int getNPTSize(java.util.List parentNodes)
This method calculates the expected size of its NPT using its parents' state sizes.

Parameters:
parentNodes -
Returns:
the number of cells in the NPT


Copyright © 2006 Agena Ltd. All Rights Reserved.