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

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedBN
All Implemented Interfaces:
java.util.EventListener, ExtendedNodeListener, Connectable, FamilyMember, Identifiable, Nameable, NamedFamilyMember, Progressable, Writable

public class ExtendedBN
extends java.lang.Object
implements ExtendedNodeListener, Nameable, Writable, Connectable, NamedFamilyMember, Progressable

An ExtendedBN is an encapsulation of a Bayesian Network. It contains a reference to a single BN. Any client wishing to use a BN does so via the ExtendedBN.

An ExtendedBN only has reference to a list of ExtendedNodes; it currently has no reference to any edges. Those methods that involve manipulating or querying the BN are delegated to the ExtendedBN's internal BN object.


Field Summary
protected  int lengthOfProgressableTask
          Represnts the current progress of any operation which is currently being monitored in this class.
protected  int progress
          Represnts the length of the operation which is currently being monitored in this class.
static int PROGRESSABLE_PASTE
          To indicate we are monitoring the Paste operation.
protected  boolean progressableTaskDone
          When set to true the current task being monitored will have been completed.
protected  boolean terminateProgressableTask
          When set to true the current operation can be cancelled / terminated.
static double version
           
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ExtendedBN()
          Default constructor.
 
Method Summary
 BooleanEN addBooleanNode(java.lang.String id, java.lang.String name)
          Creates a new Boolean node with the specified name and with the default states "False" and "True".
 ContinuousIntervalEN addContinuousIntervalNode(java.lang.String id, java.lang.String name)
          Creates a new Continuous Interval node with the specified name and with default states 0.0 - 10.0, 10.0 - 20.0, 20.0 - 30.0, 30.0 - 40.0 and 40.0 - 50.0.
 DiscreteRealEN addDiscreteRealNode(java.lang.String id, java.lang.String name)
          Creates a new Discrete Real node with the specified name and with default states 1.0, 2.0, 3.0, 4.0 and 5.0.
 Variable addExpressionVariable(ExtendedNode exn, java.lang.String name, double defaultValue)
          Adds a new Variable with the specified name and default value to the VariableList for the specified ExtendedNode.
 void addExtendedBNListener(ExtendedBNListener ebnl)
          Adds an object interested in ExtendedBNEvents to the List of ExtendedBNListeners (actually held by an internal ExtendedBNEventGenerator).
 void addExtendedNode(ExtendedNode extendedNode)
          Adds the supplied node the Extended BN.
 void addExtendedNode(ExtendedNode extendedNode, boolean autoAssignId)
          Adds the specified ExtendedNode to the ExtendedBN's List.
 IntegerIntervalEN addIntegerIntervalNode(java.lang.String id, java.lang.String name)
          Creates a new Integer Interval node with the specified name and with default states 0 - 10, 10 - 20, 20 - 30, 30 - 40 and 40 - 50.
 LabelledEN addLabelledNode(java.lang.String id, java.lang.String name)
          Creates a new Labelled node with the specified name and with the default states "State_1", "State_2" and "State_3".
 ModificationLog.ModificationLogItem addModificationLogItem(NameDescription description)
          Convience method adds a new modification log top the extended BN
 RankedEN addRankedNode(java.lang.String id, java.lang.String name)
          Creates a new Ranked node with the specified name and with default states Very Low, Low, Medium, High and Very High.
 boolean allParentsPresent(ExtendedNode exn, ExtendedBN fromBN, java.util.Collection allNodes)
          Returns true if all the parents of the specified node in the specified ExtendedBN are present in the Collection or in this ExtendedBN.
 boolean allParentsPresent(java.lang.String altId, ExtendedBN fromBN, java.util.Collection allNodes)
          Returns true if all the parents of the node with the connected CoreBNNode AltID in the specified ExtendedBN are present in the Collection or in this ExtendedBN.
 void changeNodeStates(ExtendedNode en, DataSet data)
          Takes the supplied node and removes its current States replacing them with the ones represented in the specified DataSet.
 ExtendedNode changeNodeType(ExtendedNode en, java.lang.Class type)
          Takes the supplied node, creates a new instance of the supplied type and then copies the data from the old node into the new one.
 ExtendedNode changeNodeType(ExtendedNode en, java.lang.Class type, DataSet data)
          Takes the supplied node, creates a new instance of the supplied type and then copies the data from the old node into the new one.
 void clearUnpropagatedEvidence()
          This method should be called if anything fails after some evidence has been entered.
 void cloneNodeFunctions(java.util.Map oldToNewNodes, ExtendedBN fromBN)
          Given a Map of the Original ExtendedNodes to their Cloned versions this method clones all the Function information from the original ExtendedNode to the Clone.
 void cloneNodeNPTs(java.util.Map oldToNewNodes, ExtendedBN fromBN)
          Given a Map of the Original ExtendedNodes to their Cloned versions this method clones all the CoreNPT data from the original Node to its Clone.
 void compile()
          Compiles the underlying BN.
 void createClonedNodes(java.util.List nodes, ExtendedBN sourceBN, java.util.Map clonedNodes)
          Creates a clone of each of the ExtendedNodes if the specified List.
static ExtendedBN createEmptyExtendedBN()
           
static ExtendedBN createExtendedBN()
          Creates and returns a new extended BN, a new core is also created and connected to the newly created BN
static ExtendedBN createExtendedBNFromCoreBN(uk.co.agena.minerva.model.corebn.CoreBN connBN)
          Creates an ExtendedBN from the supplied CoreBN.
static ExtendedBN createExtendedBNFromNetFile(java.lang.String netFile, java.util.List aestheticProperties)
          Creates an ExtendedBN from the supplied .net file.
 ExtendedNode createNewExtendedNode(java.lang.String type, NameDescription name)
          Creates a new ExtendedNode of the supplied type, adds it to this ExtendedBN and returns it.
 void deleteExtendedNode(ExtendedNode enode)
          Deletes the supplied ExtendedNode from this BN.
 void destroy()
          Removes itself as a listener from all of its ExtendedNodes.
 void extendedNodeAttributeChanged(ExtendedNodeEvent ene, int attribute)
          Event caught by the extend BN from a node it was listening to.
 void extendedNodeConnBNNotFound(ExtendedNodeEvent ene)
          Called by an ExtendedNode when it cannot find the connected CoreBN in memory.
 void extendedNodeConnNodeIdChanged(ExtendedNodeEvent ene)
          When the connNodeId of a node is changed then we need to ensure that all the children of this node are told that the name has changed to that they can change their functions (if they have any) to reflect this change.
 void extendedNodeInconsistentEvidenceEntered(ExtendedNodeEvent ene)
          Called when an ExtendedNode has had inconsistent evidence entered on it.
 void extendedNodeMarginalsChanged(ExtendedNodeEvent ene, boolean useMarginalDataSetForStateReplication)
          Not implemented - the ExtendedBN is not interested when this happens.
 void extendedNodeNameDescriptionChanged(ExtendedNodeEvent ene)
          Not implemented - the ExtendedBN is not interested when this happens.
 void extendedNodeRemoved(ExtendedNode exNode)
          Informs all listeners (via the event generator) that this ExtendedBN has had a NodeRemoved.
 void extendedNodeStateNameChanged(ExtendedNodeEvent ene, ExtendedState es)
          Invoked when an ExtendedState name is changed.
 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)
          ExtendedNode visible attribute has been changed.
 void extendedStateAdded(ExtendedNodeEvent ene)
          New ExtendedState created and added to this node and added all the way to the core.
 void extendedStateRemoved(ExtendedNodeEvent ene, int indexOfStateRemoved)
          ExtendedNode removed from this node and all the way to the core.
 void fireExtendedBNAboutToBePropagated(ExtendedBN ebn)
          Informs all listeners (via the event generator) that this ExtendedBN is about to be propagated.
 void fireExtendedBNConnBNNotFound(boolean compile)
          Informs all listeners (via the event generator) that the CoreBN for this ExtendedBN is is not in memory.
 void forceCoreNPTsSizeUpdates(boolean autoselectNodes)
          This should be called if the states on nodes have been update, but the core NPT sizes havent been updated.
 java.util.List getChildNodes(ExtendedNode enode)
          Returns the child ExtendedNodes of the supplied ExtendedNode.
 java.util.List getChildren()
          Returns the children of this FamilyMember.
 uk.co.agena.minerva.model.corebn.CoreBN getConnBN()
          Returns the BN to which the ExtendedBN is connected.
 java.lang.String getConnCoreFileName()
          Returns the name of the file in which the connected CoreBN is stored.
 java.util.List getConnections()
          Returns a list of the connections that this BN has with other connectable objects (which) will be other exBNs
 java.util.List getConnNodeIds(java.util.List nodes)
           
 int getCurrentProgress()
           
 ExtendedNode getExtendedNode(int id)
          Returns an ExtendedNode with the specified ID.
 ExtendedNode getExtendedNode(java.lang.String altId)
           
 java.util.List getExtendedNodes()
          Returns a List of all the ExtendedNodes contained in the ExtendedBN.
 java.util.List getExtendedNodes(java.lang.String name)
          Retruns a list of ExtendedNodes that have a short name equal to that specified.
 ExtendedNode getExtendedNodeWithName(java.lang.String name)
          Returns the first ExtendedNode that has a short name equal to that specified.
 ExtendedNode getExtendedNodeWithUniqueIdentifier(java.lang.String uniqueIdentifier)
          Returns the ExtendedNode that has a unique string identifier the same as that specified.
 int getId()
          Returns the unique ID of the ExtendedBN.
 java.util.List getInputNodes()
          Returns a List of all ExtendedNodes that can be input nodes for message passing.
 int getLengthOfProgressableTask()
           
 ModificationLog getModificationLog()
          The modification log holds information about what has made this exBN inconsistent with the last known good propagation.
 NameDescription getName()
          Returns the name of the ExtendedBN.
 int getNumberOfCellsForNPT(ExtendedNode node)
          Used to know how many calculations it will take to fill the NPT from this node.
 java.util.List getOutputNodes()
          Returns a List of all ExtendedNodes that can be output nodes for message passing.
 java.util.List getParentConnectedNodeIds(ExtendedNode child)
          Returns a List of the connected IDs for the supplied child node.
 int getParentId()
          Returns the ID of this FamilyMember's parent.
 java.util.List getParentNodes(ExtendedNode enode)
          Returns the parent ExtendedNodes of the supplied ExtendedNode.
 java.util.List getParentNodes(java.lang.String connNodeID)
          Returns the parent ExtendedNodes of the ExtendedNode with the supplied connected CoreBNNode AltID.
 java.util.List getPasteErrorLog()
          When a paste operation is performed if any errors occur they will be stored as Strings in this List.
 java.lang.String[] getPropagationCallSigns()
          Returns the array containing the propagation call signs.
 java.lang.String getType()
          Returns the type of the ExtendedBN.
 java.util.List getUnmarkedTemporaryNodeOrderFlagNodes()
          Gets all the ExtendedNodes that are not flagged to have been visted by ordering algorithm.
 double getVersion()
          Returns the version of the class.
 boolean hasDDNodes()
          Returns a boolean value that determines whether the exBN has DD nodes
 boolean hasRankedNodes()
          Returns a boolean value that determines whether the exBN has Ranked nodes
 boolean hasStatisticalNodes()
          Returns a boolean value that determines whether the exBN has statistical nodes
 boolean isAllParentExtendedNodesMarkedForOrdering(ExtendedNode enode)
           
 boolean isCompiled()
          Checks whether the underlying BN has been compiled or not.
 boolean isMessagepassingMarkedFlag()
           
 boolean isPasteErrorCritical()
          If an error occured in the paste operation and it was of critical nature this flag will be set.
 boolean isProgressableTaskDone()
           
 void nodeChanged(ExtendedNodeEvent ene)
          Called whenever a node changes (for selected events)
 void paste(java.util.List exNodes, java.util.List connections, ExtendedBN copiedFromBN, java.lang.String type, java.util.Map clonedNodes)
          Based on the specified List of ExtendedNodes and List of connections between these nodes this method creates clones of the ExtendedNodes and adds them to the ExtendedBN with the required connections between the cloned nodes.
 void printJunctionTreeReport()
           
 void propagate(boolean fireUpExtendedNodeEvents)
          Propagates the underlying BN.
 int read(java.util.List strings, int currentLineNumber)
           
 void regenerateNPT(ExtendedNode enode)
          Regenerates the NPT for the supplied node if it has an expression or partitioned expressions defined on it.
 void regenerateNPT(ExtendedNode node, boolean autoExtendStateRanges, boolean autoRestrictStateRanges, boolean imitateNewEvidence)
          This method will take the function properties of this node (i.e.
 void reinitialise(boolean fireUpExtendedNodeEvents)
          They will multiply back in all NPTs to build new cliques and sepsets and then message pass to make the BN consistent.
 void removeAllExtendedNodes()
          Removes all ExtendedNodes from the ExtendedBN's List.
 void removeExpressionVariable(ExtendedNode exn, Variable v)
          Removes the specified Variable from the VariableList of the specified ExtendedNode if it is actually a member that ExtendedNodes VariableList.
 void removeExtendedBNListener(ExtendedBNListener ebnl)
          Removes an object no longer interested in ExtendedBNEvents from the List of ExtendedBNListeners (actually held by an internal ExtendedBNEventGenerator).
 void removeExtendedNode(ExtendedNode enode)
          Removes the ExtendedNode from the this ExtendedBN.
 void removeRelationship(ExtendedNode parentNode, ExtendedNode childNode)
          Removes the CoreBN relationship between the two specified nodes.
 void resetModificationLog()
          Clears the modification log on the exBN.
 void resetProgressableTask()
          Should be invoked at the end of the task to reset all required attributes used in the monitoring of the task.
 void restartSavedPriors()
           
 void retractAllEvidence(boolean fireUpExtendedNodeEvent)
          Retracts all evidence from the underlying BN.
 int revertToSavedPriors(int priorIndex)
          Makes all the relevant nodes revert their priors back to the saved priors at the given index.
 void rollBackCores()
          This will roll back the cores to their original states and not inform anybosy about it.
 void setChildren(java.util.List children)
          Sets the children of this FamilyMember to those in the supplied list of FamilyMembers.
 void setConnBN(uk.co.agena.minerva.model.corebn.CoreBN connBN)
          Sets the connected BN of the ExtendedBN to that specified.
 void setConnCoreFileName(java.lang.String connCoreFileName)
          Sets the name of file in which the connected CoreBN is stored.
 void setExtendedNodes(java.util.List extendedNodes, boolean autoAssignIds)
          Reinitialises the ExtendedBN's List of ExtendedNodes with those in the supplied List.
 void setId(int id)
          Sets the unique ID of the ExtendedBN to the ID specified.
 void setMessagepassingMarkedFlag(boolean messagepassingMarkedFlag)
           
 void setName(NameDescription name)
          Sets the name of the ExtendedBN to the name specified.
 void setParentId(int parentId)
          Sets the ID of this FamilyMember's parent.
 void setPropagationCallSigns(java.lang.String[] propagationCallSigns)
          Sets the array containing the propagation call signs.
 void setType(java.lang.String type)
          Sets the type of the ExtendedBN to the value specified.
 void setVersion(double version)
          Sets the version number of the class.
 void terminateProgressableTask()
          Invoked when the user has requested the task to be terminated.
 java.lang.String toString()
          Returns a String representation of the ExtendedNode.
 void updateConnNodeId(ExtendedNode exn, java.lang.String newConnNodeId)
          Updates the ID of the underlying Core Node for the specified ExtendedNode.
 void updateCurrentProgress(int inc)
          Increment the currentProgress by the specified value.
 void updateExpressionVariable(ExtendedNode exn, Variable v, java.lang.String newName, double newDefaultValue)
          For the ExtendedNodes VariableList the specified Variable is updated to have the new Name and Default Value.
 void updateExtendedNodesDuringPasteFollowingCut(java.util.List exNodes, ExtendedBN copiedFromBN, java.util.List connections)
          When ExtendedNodes which have been 'Cut' from another ExtendedBN are being pasted we must remove any references to the ExtendedNodes in the source ExtendedBN and CoreBN.
 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

version

public static double version

PROGRESSABLE_PASTE

public static final int PROGRESSABLE_PASTE
To indicate we are monitoring the Paste operation.

See Also:
Constant Field Values

lengthOfProgressableTask

protected int lengthOfProgressableTask
Represnts the current progress of any operation which is currently being monitored in this class.


progress

protected int progress
Represnts the length of the operation which is currently being monitored in this class.


progressableTaskDone

protected boolean progressableTaskDone
When set to true the current task being monitored will have been completed.


terminateProgressableTask

protected boolean terminateProgressableTask
When set to true the current operation can be cancelled / terminated.

Constructor Detail

ExtendedBN

public ExtendedBN()
Default constructor.

Method Detail

createEmptyExtendedBN

public static ExtendedBN createEmptyExtendedBN()
                                        throws ExtendedBNException
Returns:
Throws:
ExtendedBNException

createExtendedBNFromCoreBN

public static ExtendedBN createExtendedBNFromCoreBN(uk.co.agena.minerva.model.corebn.CoreBN connBN)
                                             throws ExtendedBNException
Creates an ExtendedBN from the supplied CoreBN.

Parameters:
connBN - the CoreBN used to create the ExtendedBN
Returns:
the newly-created ExtendedBN
Throws:
ExtendedBNException - if there is a problem creating the ExtendedBN

createExtendedBN

public static ExtendedBN createExtendedBN()
                                   throws ExtendedBNException
Creates and returns a new extended BN, a new core is also created and connected to the newly created BN

Returns:
Throws:
ExtendedBNException

createExtendedBNFromNetFile

public static ExtendedBN createExtendedBNFromNetFile(java.lang.String netFile,
                                                     java.util.List aestheticProperties)
                                              throws ExtendedBNException
Creates an ExtendedBN from the supplied .net file.

Parameters:
netFile - the .net file used to create the ExtendedBN
Returns:
the newly-created ExtendedBN
Throws:
ExtendedBNException - if there is a problem creating the ExtendedBN

getId

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

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

setId

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

Parameters:
id - the new ID for the ExtendedBN

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

getExtendedNodes

public java.util.List getExtendedNodes()
Returns a List of all the ExtendedNodes contained in the ExtendedBN.

Returns:
a List of ExtendedNodes

getExtendedNodeWithName

public ExtendedNode getExtendedNodeWithName(java.lang.String name)
Returns the first ExtendedNode that has a short name equal to that specified. Null will be returned if there are no matches.

Parameters:
name - the name to be matched
Returns:
the ExtendedNode with the matching short name

getExtendedNodeWithUniqueIdentifier

public ExtendedNode getExtendedNodeWithUniqueIdentifier(java.lang.String uniqueIdentifier)
Returns the ExtendedNode that has a unique string identifier the same as that specified. Null will be returned if there are no matches.

Parameters:
uniqueIdentifier - the unique identifier to be matched
Returns:
the ExtendedNode with the matching unique identifier

getExtendedNodes

public java.util.List getExtendedNodes(java.lang.String name)
Retruns a list of ExtendedNodes that have a short name equal to that specified. An empty list will be returned if there are no matches.

Parameters:
name - the name to be matched
Returns:
the ExtendedNodes with the matching short name

getExtendedNode

public ExtendedNode getExtendedNode(int id)
                             throws ExtendedNodeNotFoundException
Returns an ExtendedNode with the specified ID.

Parameters:
id - The ID to be matched
Returns:
the ExtendedNode with the specified ID
Throws:
ExtendedNodeNotFoundException - if an ExtendedNode with the supplied ID was not found

getConnBN

public uk.co.agena.minerva.model.corebn.CoreBN getConnBN()
Returns the BN to which the ExtendedBN is connected.

Returns:
the connected BN

getConnNodeIds

public java.util.List getConnNodeIds(java.util.List nodes)

setConnBN

public void setConnBN(uk.co.agena.minerva.model.corebn.CoreBN connBN)
Sets the connected BN of the ExtendedBN to that specified.

Parameters:
connBN - the new connected BN for the ExtendedBN

getName

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

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

setName

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

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

getType

public java.lang.String getType()
Returns the type of the ExtendedBN.

Returns:
the type of the ExtendedBN

setType

public void setType(java.lang.String type)
Sets the type of the ExtendedBN to the value specified.

Parameters:
type - the new type of the ExtendedBN

isMessagepassingMarkedFlag

public boolean isMessagepassingMarkedFlag()

setMessagepassingMarkedFlag

public void setMessagepassingMarkedFlag(boolean messagepassingMarkedFlag)

hasDDNodes

public boolean hasDDNodes()
Returns a boolean value that determines whether the exBN has DD nodes

Returns:

hasRankedNodes

public boolean hasRankedNodes()
Returns a boolean value that determines whether the exBN has Ranked nodes

Returns:

hasStatisticalNodes

public boolean hasStatisticalNodes()
Returns a boolean value that determines whether the exBN has statistical nodes

Returns:

retractAllEvidence

public void retractAllEvidence(boolean fireUpExtendedNodeEvent)
                        throws ExtendedBNException,
                               InconsistentEvidenceException
Retracts all evidence from the underlying BN.

Throws:
ExtendedBNException - if there is a problem with the retraction
InconsistentEvidenceException

propagate

public void propagate(boolean fireUpExtendedNodeEvents)
               throws ExtendedBNException
Propagates the underlying BN.

Throws:
ExtendedBNException - if there is a problem with the propagation

printJunctionTreeReport

public void printJunctionTreeReport()

compile

public void compile()
             throws ExtendedBNException,
                    InconsistentEvidenceException
Compiles the underlying BN.

Throws:
ExtendedBNException - if there is a problem during compilation
InconsistentEvidenceException

reinitialise

public void reinitialise(boolean fireUpExtendedNodeEvents)
                  throws ExtendedBNException,
                         InconsistentEvidenceException
They will multiply back in all NPTs to build new cliques and sepsets and then message pass to make the BN consistent. This should be called if any nodes have had their NPTs modified or touchTabled.

Throws:
ExtendedBNException - if there is any problem reinitialising
InconsistentEvidenceException

revertToSavedPriors

public int revertToSavedPriors(int priorIndex)
                        throws ExtendedBNException,
                               InconsistentEvidenceException
Makes all the relevant nodes revert their priors back to the saved priors at the given index. If there is inconsistency about the last saved priors amoung nodes then it will go back to a state where they all have stored priors (for the nodes which have any). It will then make the BN consistent using reinitialisation. In this case we do want to fire the reinitialised event.

Parameters:
priorIndex - the index of saved priors that the nodes will revert to
Returns:
the maximum index
Throws:
ExtendedBNException
InconsistentEvidenceException

restartSavedPriors

public void restartSavedPriors()
                        throws ExtendedBNException
Throws:
ExtendedBNException

addExtendedNode

public void addExtendedNode(ExtendedNode extendedNode,
                            boolean autoAssignId)
Adds the specified ExtendedNode to the ExtendedBN's List. The ID of the ExtendedNode will be changed to fit in with the numbering scheme used by the ExtendedBN if the boolean autoAssignId is true.

Parameters:
extendedNode - the ExtendedNode to be added
autoAssignId - whether to modify the ExtendedNode's ID before adding

addExtendedNode

public void addExtendedNode(ExtendedNode extendedNode)
Adds the supplied node the Extended BN.

Parameters:
extendedNode - the node to be added

createNewExtendedNode

public ExtendedNode createNewExtendedNode(java.lang.String type,
                                          NameDescription name)
                                   throws ExtendedNodeCreationException
Creates a new ExtendedNode of the supplied type, adds it to this ExtendedBN and returns it.

Parameters:
type - the fully qualified class name of the node that is to be created
name - the name of the newly created node
Returns:
the newly created node
Throws:
ExtendedNodeCreationException

addLabelledNode

public LabelledEN addLabelledNode(java.lang.String id,
                                  java.lang.String name)
                           throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                  ExtendedBNException
Creates a new Labelled node with the specified name and with the default states "State_1", "State_2" and "State_3".

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

addBooleanNode

public BooleanEN addBooleanNode(java.lang.String id,
                                java.lang.String name)
                         throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                ExtendedBNException
Creates a new Boolean node with the specified name and with the default states "False" and "True".

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

addContinuousIntervalNode

public ContinuousIntervalEN addContinuousIntervalNode(java.lang.String id,
                                                      java.lang.String name)
                                               throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                                      ExtendedBNException
Creates a new Continuous Interval node with the specified name and with default states 0.0 - 10.0, 10.0 - 20.0, 20.0 - 30.0, 30.0 - 40.0 and 40.0 - 50.0.

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

addIntegerIntervalNode

public IntegerIntervalEN addIntegerIntervalNode(java.lang.String id,
                                                java.lang.String name)
                                         throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                                ExtendedBNException
Creates a new Integer Interval node with the specified name and with default states 0 - 10, 10 - 20, 20 - 30, 30 - 40 and 40 - 50.

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

addDiscreteRealNode

public DiscreteRealEN addDiscreteRealNode(java.lang.String id,
                                          java.lang.String name)
                                   throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                                          ExtendedBNException
Creates a new Discrete Real node with the specified name and with default states 1.0, 2.0, 3.0, 4.0 and 5.0.

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

addRankedNode

public RankedEN addRankedNode(java.lang.String id,
                              java.lang.String name)
                       throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                              ExtendedBNException
Creates a new Ranked node with the specified name and with default states Very Low, Low, Medium, High and Very High.

Parameters:
id - The unique identifier of the node
name - The name of the node
Returns:
the newly created node
Throws:
ExtendedBNException - if there is a problem creating the node
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException

deleteExtendedNode

public void deleteExtendedNode(ExtendedNode enode)
                        throws ExtendedBNException
Deletes the supplied ExtendedNode from this BN.

Parameters:
enode - the node to be deleted
Throws:
ExtendedBNException - if there is a problem with the deletion

removeExtendedNode

public void removeExtendedNode(ExtendedNode enode)
                        throws ExtendedBNException
Removes the ExtendedNode from the this ExtendedBN. It also re-initialises the npt of the children of this node through the core.

Parameters:
enode -
Throws:
ExtendedBNException

removeRelationship

public void removeRelationship(ExtendedNode parentNode,
                               ExtendedNode childNode)
                        throws ExtendedBNException
Removes the CoreBN relationship between the two specified nodes.

Parameters:
parentNode - The parent ExtendedNode of the relationship.
childNode - The child ExtendedNode of the relationship.
Throws:
ExtendedBNException - If the Connected CoreBN or the CoreNodes can't be found.

setExtendedNodes

public void setExtendedNodes(java.util.List extendedNodes,
                             boolean autoAssignIds)
Reinitialises the ExtendedBN's List of ExtendedNodes with those in the supplied List. The ID of each ExtendedNode is changed to fit in with the ExtendedBN's internal numbering scheme if the autoAssignIds boolean is true

Parameters:
extendedNodes - the new List of ExtendedNodes
autoAssignIds - whether to modify the ExtendedNodes' IDs before adding them

removeAllExtendedNodes

public void removeAllExtendedNodes()
Removes all ExtendedNodes from the ExtendedBN's List.


addExpressionVariable

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

Parameters:
exn - The ExtenededNode we are adding the new Variable too.
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(ExtendedNode exn,
                                     Variable v)
                              throws ExtendedBNException
Removes the specified Variable from the VariableList of the specified ExtendedNode if it is actually a member that ExtendedNodes VariableList.

Parameters:
exn - The ExtendedNode whos VariableList we are removing the Variable from.
v - The Variable to be removed
Throws:
ExtendedBNException

updateExpressionVariable

public void updateExpressionVariable(ExtendedNode exn,
                                     Variable v,
                                     java.lang.String newName,
                                     double newDefaultValue)
                              throws ExtendedBNException
For the ExtendedNodes VariableList the specified Variable is updated to have the new Name and Default Value. The specified Variable must exist in that ExtendedNodes VariableList for any action to be taken. For the update to be sucessful the new Variable name must not be used by any other Variables in the specified ExtendedNodes VariableList and must not be used as the ConnNodeID for any ExtendedNode in this ExtendedBN.

Parameters:
exn - The ExtendedNode to which the Variable which needs updating belongs.
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

isCompiled

public boolean isCompiled()
                   throws ExtendedBNException
Checks whether the underlying BN has been compiled or not.

Returns:
true if the BN is compiled, false otherwise
Throws:
ExtendedBNException - if there is a problem checking whether the BN is compiled

getNumberOfCellsForNPT

public int getNumberOfCellsForNPT(ExtendedNode node)
                           throws InconsistentEvidenceException,
                                  ExtendedBNException
Used to know how many calculations it will take to fill the NPT from this node.

Parameters:
node -
Returns:
Throws:
InconsistentEvidenceException
ExtendedBNException

getModificationLog

public ModificationLog getModificationLog()
The modification log holds information about what has made this exBN inconsistent with the last known good propagation.


addModificationLogItem

public ModificationLog.ModificationLogItem addModificationLogItem(NameDescription description)
Convience method adds a new modification log top the extended BN

Parameters:
description -

resetModificationLog

public void resetModificationLog()
Clears the modification log on the exBN.


getParentNodes

public java.util.List getParentNodes(ExtendedNode enode)
                              throws ExtendedBNException
Returns the parent ExtendedNodes of the supplied ExtendedNode.

Parameters:
enode - the ExtendedNode whose parents are being sought
Returns:
a List of the parent ExtendedNodes
Throws:
ExtendedBNException - if there is a problem accessing the parent ExtendedNodes

getParentNodes

public java.util.List getParentNodes(java.lang.String connNodeID)
                              throws ExtendedBNException
Returns the parent ExtendedNodes of the ExtendedNode with the supplied connected CoreBNNode AltID.

Parameters:
coreNodeID - the connected CoreBNNode AltID of the ExtendedNode whose parents are being sought
Returns:
a List of the parent ExtendedNodes
Throws:
ExtendedBNException - if there is a problem accessing the parent ExtendedNodes

getParentConnectedNodeIds

public java.util.List getParentConnectedNodeIds(ExtendedNode child)
Returns a List of the connected IDs for the supplied child node.

Parameters:
child - the node whose parents will be queried
Returns:
a List of Strings; this will be empty if the node has no parents

getChildNodes

public java.util.List getChildNodes(ExtendedNode enode)
                             throws ExtendedBNException
Returns the child ExtendedNodes of the supplied ExtendedNode.

Parameters:
enode - the ExtendedNode whose children are being sought
Returns:
a List of the children ExtendedNodes
Throws:
ExtendedBNException - if there is a problem accessing the children ExtendedNodes

getConnCoreFileName

public java.lang.String getConnCoreFileName()
Returns the name of the file in which the connected CoreBN is stored.

Returns:
the name of the file for the connected CoreBN

setConnCoreFileName

public void setConnCoreFileName(java.lang.String connCoreFileName)
Sets the name of file in which the connected CoreBN is stored.

Parameters:
connCoreFileName - the new file name for the connected CoreBN

getPropagationCallSigns

public java.lang.String[] getPropagationCallSigns()
Returns the array containing the propagation call signs.

Returns:
the array of propagation call signs

setPropagationCallSigns

public void setPropagationCallSigns(java.lang.String[] propagationCallSigns)
Sets the array containing the propagation call signs.

Parameters:
propagationCallSigns - the new array of propagation call signs

addExtendedBNListener

public void addExtendedBNListener(ExtendedBNListener ebnl)
Adds an object interested in ExtendedBNEvents to the List of ExtendedBNListeners (actually held by an internal ExtendedBNEventGenerator).

Parameters:
ebnl - the intereseted ExtendedBNListener

removeExtendedBNListener

public void removeExtendedBNListener(ExtendedBNListener ebnl)
Removes an object no longer interested in ExtendedBNEvents from the List of ExtendedBNListeners (actually held by an internal ExtendedBNEventGenerator).

Parameters:
ebnl - the ExtendedBNListener no longer interested

destroy

public void destroy()
Removes itself as a listener from all of its ExtendedNodes.


extendedNodeInconsistentEvidenceEntered

public void extendedNodeInconsistentEvidenceEntered(ExtendedNodeEvent ene)
Called when an ExtendedNode has had inconsistent evidence entered on it.

Specified by:
extendedNodeInconsistentEvidenceEntered in interface ExtendedNodeListener
Parameters:
ene - the event signalling the inconsistent evidence

extendedNodeNameDescriptionChanged

public void extendedNodeNameDescriptionChanged(ExtendedNodeEvent ene)
Not implemented - the ExtendedBN is not interested when this happens.

Parameters:
ene - the name change event

extendedNodeMarginalsChanged

public void extendedNodeMarginalsChanged(ExtendedNodeEvent ene,
                                         boolean useMarginalDataSetForStateReplication)
Not implemented - the ExtendedBN is not interested when this happens.

Specified by:
extendedNodeMarginalsChanged in interface ExtendedNodeListener
Parameters:
ene - the marginal change event
useMarginalDataSetForStateReplication - TODO

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

extendedNodeConnNodeIdChanged

public void extendedNodeConnNodeIdChanged(ExtendedNodeEvent ene)
When the connNodeId of a node is changed then we need to ensure that all the children of this node are told that the name has changed to that they can change their functions (if they have any) to reflect this change.

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

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)
Description copied from interface: ExtendedNodeListener
Invoked when an ExtendedState name is changed.

Specified by:
extendedNodeStateNameChanged in interface ExtendedNodeListener

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.

extendedNodeRemoved

public void extendedNodeRemoved(ExtendedNode exNode)
Informs all listeners (via the event generator) that this ExtendedBN has had a NodeRemoved.

Parameters:
extendedNodeID - The id of the ExtendedNode which has been removed.

extendedNodeVisibleAttributeChanged

public void extendedNodeVisibleAttributeChanged(ExtendedNodeEvent ene,
                                                boolean visible)
ExtendedNode visible attribute has been changed.

Specified by:
extendedNodeVisibleAttributeChanged in interface ExtendedNodeListener
Parameters:
ene -
visible - The visibility of the node in question

fireExtendedBNAboutToBePropagated

public void fireExtendedBNAboutToBePropagated(ExtendedBN ebn)
Informs all listeners (via the event generator) that this ExtendedBN is about to be propagated.

Parameters:
ebn - the ExtendedBN that is about to be propagated i.e. this one

fireExtendedBNConnBNNotFound

public void fireExtendedBNConnBNNotFound(boolean compile)
                                  throws ExtendedBNException
Informs all listeners (via the event generator) that the CoreBN for this ExtendedBN is is not in memory.

Parameters:
compile - whether listeners should compiled the CoreBN when loading it
Throws:
ExtendedBNException

extendedNodeConnBNNotFound

public void extendedNodeConnBNNotFound(ExtendedNodeEvent ene)
                                throws ExtendedBNException
Called by an ExtendedNode when it cannot find the connected CoreBN in memory. It is now the responsibility of the ExtendedBN to tell anyone listening that the CoreBN is not loaded.

Specified by:
extendedNodeConnBNNotFound in interface ExtendedNodeListener
Parameters:
ene - the event indicating that the CoreBN has not been found
Throws:
ExtendedBNException

regenerateNPT

public void regenerateNPT(ExtendedNode enode)
                   throws InconsistentEvidenceException,
                          ExtendedBNException,
                          MinervaRangeException,
                          NPTGeneratorInsufficientStateRangeException,
                          NPTGeneratorException
Regenerates the NPT for the supplied node if it has an expression or partitioned expressions defined on it.

Parameters:
enode - the node for which the NPT is to be regenerated.
Throws:
InconsistentEvidenceException
ExtendedBNException
MinervaRangeException
NPTGeneratorInsufficientStateRangeException
NPTGeneratorException

regenerateNPT

public void regenerateNPT(ExtendedNode node,
                          boolean autoExtendStateRanges,
                          boolean autoRestrictStateRanges,
                          boolean imitateNewEvidence)
                   throws ExtendedBNException,
                          MinervaRangeException,
                          InconsistentEvidenceException,
                          NPTGeneratorInsufficientStateRangeException,
                          NPTGeneratorException
This method will take the function properties of this node (i.e. if the node has a function and if the funtions are completed), and will regenerate the NPT for this node if possible. A boolean is returned. Returns true if the NPT has been generated successfully, false otherwise.

Parameters:
autoRestrictStateRanges - TODO
imitateNewEvidence - TODO
Throws:
ExtendedBNException
MinervaRangeException
InconsistentEvidenceException
NPTGeneratorInsufficientStateRangeException
NPTGeneratorException

getInputNodes

public java.util.List getInputNodes()
Returns a List of all ExtendedNodes that can be input nodes for message passing.

Returns:
a List of all ExtendedNodes that can be input nodes for message passing

getOutputNodes

public java.util.List getOutputNodes()
Returns a List of all ExtendedNodes that can be output nodes for message passing.

Returns:
a List of all ExtendedNodes that can be output nodes for message passing

paste

public void paste(java.util.List exNodes,
                  java.util.List connections,
                  ExtendedBN copiedFromBN,
                  java.lang.String type,
                  java.util.Map clonedNodes)
           throws ExtendedBNException
Based on the specified List of ExtendedNodes and List of connections between these nodes this method creates clones of the ExtendedNodes and adds them to the ExtendedBN with the required connections between the cloned nodes.

Parameters:
connection - A List containing x number of single item 2D arrays where the first dimension is the start ExtendedNode of the connection and the second dimension is the end ExtendedNode
exNodes - A list of the ExtendedNodes to be cloned and added (pasted) to the ExtendedBN.
copiedFromBN - A reference to the ExtendedBN the ExtendedNodes were copied from.
type - String to store the type of operation the paste is being performed for, this is either "cut" or "copy."
clonedNodes - A Mapping of the specified ExtendedNodes to their Clones. When passed in this Map should be empty and populated by the method. This was if an exception is thrown we will still have a handel on the Map.
Throws:
ExtendedBNException

updateExtendedNodesDuringPasteFollowingCut

public void updateExtendedNodesDuringPasteFollowingCut(java.util.List exNodes,
                                                       ExtendedBN copiedFromBN,
                                                       java.util.List connections)
                                                throws ExtendedBNException
When ExtendedNodes which have been 'Cut' from another ExtendedBN are being pasted we must remove any references to the ExtendedNodes in the source ExtendedBN and CoreBN. New CoreBNNodes must then be created with the appropiate NPT data in the destination CoreBN and references added to the ExtendedNode then the ExtendedNodes need to be added to the ExtendedBN (this). Once this has been done any relationships that exist between the pasted nodes need to be created using the supplied List.

Parameters:
exNodes - A List of the ExtendedNodes that are being pasted.
copiedFromBN - The source ExtendedBN
connection - A List containing x number of single item 2D arrays where the first dimension is the start ExtendedNode of the connection and the second dimension is the end ExtendedNode
Throws:
ExtendedBNException

allParentsPresent

public boolean allParentsPresent(ExtendedNode exn,
                                 ExtendedBN fromBN,
                                 java.util.Collection allNodes)
Returns true if all the parents of the specified node in the specified ExtendedBN are present in the Collection or in this ExtendedBN.

Parameters:
exn - The ExtendedNode to be checked.
fromBN - The ExtendedBN which the ExtendedNode exn resides. It is there the appropiate parent information will be found.
allNodes - The List we are checking to see if all the parents are present.
Returns:
True if all parents present; False otherwise.

allParentsPresent

public boolean allParentsPresent(java.lang.String altId,
                                 ExtendedBN fromBN,
                                 java.util.Collection allNodes)
Returns true if all the parents of the node with the connected CoreBNNode AltID in the specified ExtendedBN are present in the Collection or in this ExtendedBN.

Parameters:
altId - The connAltID of the node whose parents we want to know are in the collection or EXBN.
fromBN - The ExtendedBN from which the ExtendedNode with the specified connAltID resides. It is there the appropiate parent information will be found.
allNodes - The List we are checking to see if all the parents are present.
Returns:
True if all parents present; False otherwise.

cloneNodeFunctions

public void cloneNodeFunctions(java.util.Map oldToNewNodes,
                               ExtendedBN fromBN)
                        throws ExtendedBNException
Given a Map of the Original ExtendedNodes to their Cloned versions this method clones all the Function information from the original ExtendedNode to the Clone.

Parameters:
oldToNewNodes - A Map obejct of the Original ExtendedNode (key) to the Clone (value)
fromBN - The ExtendedBN the ExtendedNodes were copied from.
Throws:
ExtendedBNException

cloneNodeNPTs

public void cloneNodeNPTs(java.util.Map oldToNewNodes,
                          ExtendedBN fromBN)
                   throws ExtendedBNException
Given a Map of the Original ExtendedNodes to their Cloned versions this method clones all the CoreNPT data from the original Node to its Clone.

Parameters:
oldToNewNodes - A Map obejct of the Original ExtendedNode (key) to the Clone (value)
fromBN - The ExtendedBN the ExtendedNodes were copied from.
Throws:
ExtendedBNException

createClonedNodes

public void createClonedNodes(java.util.List nodes,
                              ExtendedBN sourceBN,
                              java.util.Map clonedNodes)
Creates a clone of each of the ExtendedNodes if the specified List. NOTE: This method should be updated each time a new attribute is added to the ExtendedNode Class which will need to be cloned on copy.

Parameters:
nodes - The nodes to be cloned.
sourceBN - The ExtendedBN the ExtendedNodes were copied from.
clonedNodes - A HashMap which can be populated with a Map of the Original (key) ExtendedNodes to their Clones (value)

updateConnNodeId

public void updateConnNodeId(ExtendedNode exn,
                             java.lang.String newConnNodeId)
                      throws uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException,
                             ExtendedBNException
Updates the ID of the underlying Core Node for the specified ExtendedNode. The Update will only exceed if there are no Variables associated with this ExtendedBN that have the same name or other nodes.

Parameters:
connNodeId - The ID the Core Node should be changed to.
exn - The ExtendedNode who's CoreNode needs to be updated.
Throws:
uk.co.agena.minerva.model.corebn.CoreBNNodeNotFoundException
ExtendedBNException

toString

public java.lang.String toString()
Returns a String representation of the ExtendedNode. This will contain just the ExtendedNode's short name.

Overrides:
toString in class java.lang.Object
Returns:
the ExtendedNode's short name

rollBackCores

public void rollBackCores()
                   throws ExtendedBNException,
                          InconsistentEvidenceException
This will roll back the cores to their original states and not inform anybosy about it. This should be called after each propagation, otherwise before a model is saved to file.

Throws:
ExtendedBNException
InconsistentEvidenceException

getExtendedNode

public ExtendedNode getExtendedNode(java.lang.String altId)

clearUnpropagatedEvidence

public void clearUnpropagatedEvidence()
                               throws ExtendedBNException
This method should be called if anything fails after some evidence has been entered. This will remove the cache of entered evidence in the core.

Throws:
ExtendedBNException

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

changeNodeStates

public void changeNodeStates(ExtendedNode en,
                             DataSet data)
                      throws ExtendedBNException
Takes the supplied node and removes its current States replacing them with the ones represented in the specified DataSet.

Parameters:
en - The node who's States are being replaced
data - The new set of states
Throws:
ExtendedBNException

changeNodeType

public ExtendedNode changeNodeType(ExtendedNode en,
                                   java.lang.Class type,
                                   DataSet data)
                            throws ExtendedNodeCreationException
Takes the supplied node, creates a new instance of the supplied type and then copies the data from the old node into the new one. The old one is deleted and the new one is added.

Parameters:
en - the old node
type - the type of the new node
data - information for initialising a new set of states
Returns:
the newly created/added node
Throws:
ExtendedNodeCreationException

changeNodeType

public ExtendedNode changeNodeType(ExtendedNode en,
                                   java.lang.Class type)
                            throws ExtendedNodeCreationException
Takes the supplied node, creates a new instance of the supplied type and then copies the data from the old node into the new one. The old one is deleted and the new one is added.

Parameters:
en - the old node
type - the type of the new node
Returns:
the newly created/added node
Throws:
ExtendedNodeCreationException

getPasteErrorLog

public java.util.List getPasteErrorLog()
When a paste operation is performed if any errors occur they will be stored as Strings in this List. Upon completion this List can be checked and dealt with appropiatly. This may simply involve displaying the contents to the user.

Returns:
Returns the pasteErrorLog.

isPasteErrorCritical

public boolean isPasteErrorCritical()
If an error occured in the paste operation and it was of critical nature this flag will be set. Appropiate checks can then be made to make sure the model is valid.

Returns:
Returns the pasteErrorCritical.

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

extendedNodeAttributeChanged

public void extendedNodeAttributeChanged(ExtendedNodeEvent ene,
                                         int attribute)
Event caught by the extend BN from a node it was listening to. The event is then fired up. The constant value for the string is gathered from the ExtendedBNEvent

Specified by:
extendedNodeAttributeChanged in interface ExtendedNodeListener
Parameters:
ene -
attribute -

getUnmarkedTemporaryNodeOrderFlagNodes

public java.util.List getUnmarkedTemporaryNodeOrderFlagNodes()
Gets all the ExtendedNodes that are not flagged to have been visted by ordering algorithm.

Returns:

isAllParentExtendedNodesMarkedForOrdering

public boolean isAllParentExtendedNodesMarkedForOrdering(ExtendedNode enode)
                                                  throws ExtendedBNException
Throws:
ExtendedBNException

getConnections

public java.util.List getConnections()
Returns a list of the connections that this BN has with other connectable objects (which) will be other exBNs

Specified by:
getConnections in interface Connectable

setChildren

public void setChildren(java.util.List children)
Description copied from interface: FamilyMember
Sets the children of this FamilyMember to those in the supplied list of FamilyMembers.

Specified by:
setChildren in interface FamilyMember
Parameters:
children - the new children of the FamilyMember

getChildren

public java.util.List getChildren()
Description copied from interface: FamilyMember
Returns the children of this FamilyMember.

Specified by:
getChildren in interface FamilyMember
Returns:
this FamilyMember's children

getParentId

public int getParentId()
Description copied from interface: FamilyMember
Returns the ID of this FamilyMember's parent.

Specified by:
getParentId in interface FamilyMember
Returns:
the ID of this FamilyMember's parent

setParentId

public void setParentId(int parentId)
Description copied from interface: FamilyMember
Sets the ID of this FamilyMember's parent.

Specified by:
setParentId in interface FamilyMember
Parameters:
parentId - the ID of this FamilyMember's new parent

getCurrentProgress

public int getCurrentProgress()
Specified by:
getCurrentProgress in interface Progressable
Returns:
The current progress value (int)

getLengthOfProgressableTask

public int getLengthOfProgressableTask()
Specified by:
getLengthOfProgressableTask in interface Progressable
Returns:
The length of the task being monitored as an int.

terminateProgressableTask

public void terminateProgressableTask()
Invoked when the user has requested the task to be terminated.

Specified by:
terminateProgressableTask in interface Progressable

isProgressableTaskDone

public boolean isProgressableTaskDone()
Specified by:
isProgressableTaskDone in interface Progressable
Returns:
The status of the done flag which should be set to indicate the task is over whether is has been terminated or finished.

resetProgressableTask

public void resetProgressableTask()
Should be invoked at the end of the task to reset all required attributes used in the monitoring of the task.

Specified by:
resetProgressableTask in interface Progressable

updateCurrentProgress

public void updateCurrentProgress(int inc)
Increment the currentProgress by the specified value.

Parameters:
inc - The amount by which we are updating the Current Progress.

forceCoreNPTsSizeUpdates

public void forceCoreNPTsSizeUpdates(boolean autoselectNodes)
                              throws ExtendedBNException
This should be called if the states on nodes have been update, but the core NPT sizes havent been updated. This is what happens in DD.

Throws:
ExtendedBNException


Copyright © 2006 Agena Ltd. All Rights Reserved.