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

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedBNList
All Implemented Interfaces:
Progressable, Writable

public class ExtendedBNList
extends java.lang.Object
implements Writable, Progressable

This class encapsulates a List of ExtendedBNs and provides extra utility methods for accessing the ExtendedBNs in the underlying List.


Field Summary
protected  int lengthOfProgressableTask
          Represnts the 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_RECALC_NPTS
          To indicate we are monitoring the ReCalculate all NPT's 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
ExtendedBNList()
          Creates an empty ExtendedBNList.
ExtendedBNList(java.util.List extendedBns)
          Creates an ExtendedBNList containing the supplied List of ExtendedBNs.
 
Method Summary
 int addExtendedBN(ExtendedBN extendedBN, boolean assignUnquieID)
          Adds the supplied ExtendedBN to this ExtendedBNList.
 int[] addExtendedBNs(java.util.List extendedBNs)
          Adds the supplied ExtendedBNs to this ExtendedBNList.
 void clearUnpropagatedEvidence()
          Clears all unpropagated evidence from the extendedbns in the list
 void compileAllExtendedBNs(boolean fireUpExtendedNodeEvents)
          Compiles all the ExtendedBNs in the list.
 boolean contains(ExtendedBN ebn)
          Checks if the argument ExtendedBN is contained in this list of ExtendedBNs
 int[] getAllExtendedBNIds()
          Returns an array of IDs for all the extenededBNs in this list.
 java.util.List getAllExtendedNodes()
          Returns a List of all ExtendedNodes in all stored ExtendedBNs.
 int getCurrentProgress()
           
 ExtendedBN getExtendedBN(int id)
          Retrieves the ExtendedBN with the supplied ID.
 java.util.List getExtendedBN(int[] ids, boolean excludeDuplicates)
          This methos will return a list of extended BNs which have the Id's in the provided list.
 ExtendedBN getExtendedBNAtIndex(int index)
           
 java.util.List getExtendedBNs()
          Returns the List of all ExtendedBNs in this ExtendedBNList.
 java.util.List getExtendedBNsThatShareThisCore(uk.co.agena.minerva.model.corebn.CoreBN coreBN)
          This method id responsible for returning all the ExtendedBns that share the same CoreBN, as that specified in the argument list.
 java.util.List getExtendedBnsWithDDNodes()
          Returns a list of exBns that contain 1 or more DD nodes
 java.util.List getExtendedBnsWithRankedNodes()
          Returns a list of exBns that contain 1 or more Ranked nodes
 java.util.List getExtendedBnsWithStatisticalNodes()
          Returns a list of exBns that contain 1 or more statistical function nodes
 ExtendedBN getExtendedBNThatContainsNode(ExtendedNode exNode)
          This method will return the extended BN that contains the specified node
 ExtendedBN getExtendedBNWithName(java.lang.String name)
           
 ExtendedNode getExtendedNodeFromExtendedBN(int exBNID, int exnID)
          Returns the ExtendedNode with the given id from the ExtendedBN with the specified id.
 ExtendedNode getExtendedNodeWithName(java.lang.String name)
          Returns the ExtendedNode with the given short name if the node exists
 int getHighestAllocatedExtendedBNID()
          Returns the highest ID currently allocated to the ExtendedBNs in this List..
 int getLengthOfProgressableTask()
           
 double getVersion()
          Returns the version of the class.
 boolean isProgressableTaskDone()
           
 void propagateAllExtendedBNs(boolean fireUpExtendedNodeEvents)
          Propagates all the ExtendedBNs in the list.
 int read(java.util.List strings, int currentLineNumber)
           
 void regenerateNPTforEveryExtendedNode(boolean autoAdjustStateRanges)
          Re-generates the NPT for every node in every BN using the formulae defined for that node..
 void reinitiliseAllEvidenceOnAllExtendedBNs(boolean fireUpExtendedNodeEvents)
          Re-initlise all ExtendedBNs, that is, multiply back in all their NPTs to build new cliques and sepsets and message pass to make consistent.
 void removeAllConnBNs()
          Removes the CoreBNs connected to each ExtendedBN in the List from memory.
 ExtendedBN removeExtendedBN(int id)
          Removes the ExtendedBN with the supplied ID if it is found.
 void resetProgressableTask()
          Should be invoked at the end of the task to reset all required attributes used in the monitoring of the task.
 void retractAllEvidenceOnAllExtendedBNs(boolean fireUpExtendedNodeEvents)
          Retracts all evidence from all the ExtendedBNs in the list.
 void setProgressableTaskDone(boolean done)
           
 void setVersion(double version)
          Sets the version number of the class.
 int size()
          Returns the size of the ExtendedBNList.
 void terminateProgressableTask()
          Invoked when the user has requested the task to be terminated.
 void updateCurrentProgress(int inc)
          Increment the currentProgress by the specified value.
 java.util.List write()
          Writes the object in question to a List of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static double version

PROGRESSABLE_RECALC_NPTS

public static final int PROGRESSABLE_RECALC_NPTS
To indicate we are monitoring the ReCalculate all NPT's operation.

See Also:
Constant Field Values

lengthOfProgressableTask

protected int lengthOfProgressableTask
Represnts the 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

ExtendedBNList

public ExtendedBNList()
Creates an empty ExtendedBNList.


ExtendedBNList

public ExtendedBNList(java.util.List extendedBns)
Creates an ExtendedBNList containing the supplied List of ExtendedBNs.

Parameters:
extendedBns - the ExtendedBNs that will be in the ExtendedBNList
Method Detail

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

size

public int size()
Returns the size of the ExtendedBNList.

Returns:
the size of the ExtendedBNList (or 0 if the underlying List is null)

addExtendedBN

public int addExtendedBN(ExtendedBN extendedBN,
                         boolean assignUnquieID)
Adds the supplied ExtendedBN to this ExtendedBNList. returns the old id of the argument extendedBN

Parameters:
extendedBN - the ExtendedBN to add to the ExtendedBNList

addExtendedBNs

public int[] addExtendedBNs(java.util.List extendedBNs)
Adds the supplied ExtendedBNs to this ExtendedBNList. IDs will be changed if there is any match between an ID of an ExtendedBN in the supplied List and an ExtendedBN in this ExtendedBNList. Returns an array of ints which are the oldIds of the argument ExtendedBNs

Parameters:
extendedBNs - the ExtendedBNs to add to the ExtendedBNList

removeExtendedBN

public ExtendedBN removeExtendedBN(int id)
                            throws ExtendedBNNotFoundException
Removes the ExtendedBN with the supplied ID if it is found.

Parameters:
id - the ID of the ExtendedBN that will be removed from the ExtendedBNList
Returns:
the removed ExtendedBN
Throws:
ExtendedBNNotFoundException - if the ExtendedBN does not exist in the ExtendedBNList

getExtendedBN

public ExtendedBN getExtendedBN(int id)
                         throws ExtendedBNNotFoundException
Retrieves the ExtendedBN with the supplied ID.

Parameters:
id - the ID of the ExtendedBN to be retrieved from the ExtendedBNList
Returns:
the required ExtendedBN
Throws:
ExtendedBNNotFoundException - if the ExtendedBN does not exist in the ExtendedBNList

getExtendedBNAtIndex

public ExtendedBN getExtendedBNAtIndex(int index)

getExtendedBNWithName

public ExtendedBN getExtendedBNWithName(java.lang.String name)

getExtendedBN

public java.util.List getExtendedBN(int[] ids,
                                    boolean excludeDuplicates)
This methos will return a list of extended BNs which have the Id's in the provided list. If the second arguement is true then no dupliactes will be included in the list

Parameters:
ids -
Returns:

getExtendedBNs

public java.util.List getExtendedBNs()
Returns the List of all ExtendedBNs in this ExtendedBNList.

Returns:
the List of ExtendedBNs

compileAllExtendedBNs

public void compileAllExtendedBNs(boolean fireUpExtendedNodeEvents)
                           throws ExtendedBNException,
                                  InconsistentEvidenceException
Compiles all the ExtendedBNs in the list.

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

propagateAllExtendedBNs

public void propagateAllExtendedBNs(boolean fireUpExtendedNodeEvents)
                             throws ExtendedBNException
Propagates all the ExtendedBNs in the list.

Throws:
ExtendedBNException - if there is a a problem during propagation

retractAllEvidenceOnAllExtendedBNs

public void retractAllEvidenceOnAllExtendedBNs(boolean fireUpExtendedNodeEvents)
                                        throws ExtendedBNException,
                                               InconsistentEvidenceException
Retracts all evidence from all the ExtendedBNs in the list.

Throws:
ExtendedBNException - if there is a problem during evidence retraction
InconsistentEvidenceException

reinitiliseAllEvidenceOnAllExtendedBNs

public void reinitiliseAllEvidenceOnAllExtendedBNs(boolean fireUpExtendedNodeEvents)
                                            throws ExtendedBNException,
                                                   InconsistentEvidenceException
Re-initlise all ExtendedBNs, that is, multiply back in all their NPTs to build new cliques and sepsets and message pass to make consistent. This should be called if any nodes have had their NPTs modified or touchTabled.

Throws:
ExtendedBNException - if there is a problem reinitialising
InconsistentEvidenceException

removeAllConnBNs

public void removeAllConnBNs()
Removes the CoreBNs connected to each ExtendedBN in the List from memory.


getExtendedBNThatContainsNode

public ExtendedBN getExtendedBNThatContainsNode(ExtendedNode exNode)
This method will return the extended BN that contains the specified node

Parameters:
exNode -
Returns:

getExtendedNodeFromExtendedBN

public ExtendedNode getExtendedNodeFromExtendedBN(int exBNID,
                                                  int exnID)
                                           throws ExtendedNodeNotFoundException
Returns the ExtendedNode with the given id from the ExtendedBN with the specified id.

Parameters:
exBNID - The id of the ExtendedBN the ExtendedNode belongs to.
exnID - The id of the ExtendedNode
Returns:
The required ExtendedNode.
Throws:
ExtendedNodeNotFoundException

getExtendedNodeWithName

public ExtendedNode getExtendedNodeWithName(java.lang.String name)
Returns the ExtendedNode with the given short name if the node exists

Parameters:
name - The name of the required node
Returns:
The required ExtendedNode or null if one with the matching name isn't found.

getExtendedBnsWithDDNodes

public java.util.List getExtendedBnsWithDDNodes()
Returns a list of exBns that contain 1 or more DD nodes

Returns:

getExtendedBnsWithRankedNodes

public java.util.List getExtendedBnsWithRankedNodes()
Returns a list of exBns that contain 1 or more Ranked nodes

Returns:

getExtendedBnsWithStatisticalNodes

public java.util.List getExtendedBnsWithStatisticalNodes()
Returns a list of exBns that contain 1 or more statistical function nodes

Returns:

getAllExtendedNodes

public java.util.List getAllExtendedNodes()
Returns a List of all ExtendedNodes in all stored ExtendedBNs.

Returns:
A List of all ExtendedNodes for all ExtendedBNs.

regenerateNPTforEveryExtendedNode

public void regenerateNPTforEveryExtendedNode(boolean autoAdjustStateRanges)
                                       throws ExtendedBNException,
                                              MinervaRangeException,
                                              InconsistentEvidenceException,
                                              NPTGeneratorInsufficientStateRangeException,
                                              NPTGeneratorException
Re-generates the NPT for every node in every BN using the formulae defined for that node..

Throws:
ExtendedBNException
MinervaRangeException
InconsistentEvidenceException
NPTGeneratorInsufficientStateRangeException
NPTGeneratorException

contains

public boolean contains(ExtendedBN ebn)
Checks if the argument ExtendedBN is contained in this list of ExtendedBNs

Parameters:
ebn -
Returns:

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

getAllExtendedBNIds

public int[] getAllExtendedBNIds()
Returns an array of IDs for all the extenededBNs in this list.

Returns:

getHighestAllocatedExtendedBNID

public int getHighestAllocatedExtendedBNID()
Returns the highest ID currently allocated to the ExtendedBNs in this List..

Returns:
The highest int id.

clearUnpropagatedEvidence

public void clearUnpropagatedEvidence()
                               throws ExtendedBNException
Clears all unpropagated evidence from the extendedbns in the list

Throws:
ExtendedBNException

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.

setProgressableTaskDone

public void setProgressableTaskDone(boolean done)
Parameters:
done - 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.

getExtendedBNsThatShareThisCore

public java.util.List getExtendedBNsThatShareThisCore(uk.co.agena.minerva.model.corebn.CoreBN coreBN)
This method id responsible for returning all the ExtendedBns that share the same CoreBN, as that specified in the argument list.

Parameters:
coreBN -
Returns:


Copyright © 2006 Agena Ltd. All Rights Reserved.