uk.co.agena.minerva.model
Class MarginalDataStore

java.lang.Object
  extended by uk.co.agena.minerva.model.MarginalDataStore
All Implemented Interfaces:
java.util.EventListener, ModelListener, Writable

public class MarginalDataStore
extends java.lang.Object
implements ModelListener, Writable

Stores a map of each ExtendedNode to a MarginalDataItemList object.


Field Summary
static double version
           
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Method Summary
 void destroy()
           
 MarginalDataItemList getMarginalDataItemListForNode(ExtendedBN exBN, ExtendedNode exNode)
          This method will return the first MarginaldataItemList that references the specified node in the specified BN.
 Model getModel()
           
 java.util.Map getNodeMarginalListMap()
           
 double getVersion()
          Returns the version of the class.
 void linkUp()
          Links the Marginal Data Item Lists to the correct BNs and nodes and then uses the temporary list of MDILs to build the node-list map.
 void merge(MarginalDataStore toMerge)
          Merges the entries of the specified MarginalDataStore nodeMarginalListMap in to this nodeMarginalListMap.
 void modelChanged(ModelEvent ebne)
          Called whenever a Model changes.
 void modelInconsistentEvidencePropagated(ModelEvent ebne)
          Called whenever inconsistent evidence is propagated in one of the ExtendedBNs in a Model.
 void modelPropagationFinished(ModelEvent me, boolean completionSuccessful)
          Called whenever the propagation has finished.
 void modelPropagationStarting(ModelEvent me)
          Called whenever the propagation is about to start.
 int read(java.util.List strings, int currentLineNumber)
           
 void removeAllDataForNode(ExtendedBN exBN, ExtendedNode exNode)
          Removes all items in the MDS related to the supplied node.
 void setModel(Model model)
           
 void setVersion(double version)
          Sets the version number of the class.
 java.util.List startDataCollection(boolean onlyModifiedBns, java.util.List specifiedExtendedBNs)
          This method will restart the data collections store.
 void validateMarginalDataStoreAgainstModel()
          This method will validate the marginal data store against the connected model.
 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
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

getModel

public Model getModel()

setModel

public void setModel(Model model)

getNodeMarginalListMap

public java.util.Map getNodeMarginalListMap()

modelInconsistentEvidencePropagated

public void modelInconsistentEvidencePropagated(ModelEvent ebne)
Description copied from interface: ModelListener
Called whenever inconsistent evidence is propagated in one of the ExtendedBNs in a Model.

Specified by:
modelInconsistentEvidencePropagated in interface ModelListener
Parameters:
ebne - the event encapsulating the inconsistent evidence propagation

modelChanged

public void modelChanged(ModelEvent ebne)
Description copied from interface: ModelListener
Called whenever a Model changes.

Specified by:
modelChanged in interface ModelListener
Parameters:
ebne - the event encapsulating the change

validateMarginalDataStoreAgainstModel

public void validateMarginalDataStoreAgainstModel()
This method will validate the marginal data store against the connected model. All Marginal data item lists that are connected to nodes that are NOT in the model are removed, all nodes in the model that do not have a Marginal data item in the Marginal data store have one added


startDataCollection

public java.util.List startDataCollection(boolean onlyModifiedBns,
                                          java.util.List specifiedExtendedBNs)
This method will restart the data collections store. If the onlyModifiedBns is true then only those ExtendedBNs that have been modified will have their data collection store reset. If the specifiedExtendedBNs list is specified the only BNs in the list specified are considered. If this list is null then all extendedBNs will be considered.

Parameters:
onlyModifiedBns -
specifiedExtendedBNs -

getMarginalDataItemListForNode

public MarginalDataItemList getMarginalDataItemListForNode(ExtendedBN exBN,
                                                           ExtendedNode exNode)
This method will return the first MarginaldataItemList that references the specified node in the specified BN. If none are found then null is retruned.

Parameters:
exBN - The extended BN that the node resides in
exNode - The extendedNode for which the marginalDataItem is required
Returns:

removeAllDataForNode

public void removeAllDataForNode(ExtendedBN exBN,
                                 ExtendedNode exNode)
Removes all items in the MDS related to the supplied node.


modelPropagationStarting

public void modelPropagationStarting(ModelEvent me)
Description copied from interface: ModelListener
Called whenever the propagation is about to start.

Specified by:
modelPropagationStarting in interface ModelListener

modelPropagationFinished

public void modelPropagationFinished(ModelEvent me,
                                     boolean completionSuccessful)
Description copied from interface: ModelListener
Called whenever the propagation has finished.

Specified by:
modelPropagationFinished in interface ModelListener
completionSuccessful - TODO

destroy

public void destroy()

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

linkUp

public void linkUp()
            throws ExtendedBNNotFoundException,
                   ExtendedNodeNotFoundException
Links the Marginal Data Item Lists to the correct BNs and nodes and then uses the temporary list of MDILs to build the node-list map.

Throws:
ExtendedBNNotFoundException
ExtendedNodeNotFoundException

merge

public void merge(MarginalDataStore toMerge)
Merges the entries of the specified MarginalDataStore nodeMarginalListMap in to this nodeMarginalListMap. Updating the EXBN ID of each MarginalDataItemList.

Parameters:
toMerge - The MarginalDataStore whose nodeMarginalListMap we want to merge.


Copyright © 2006 Agena Ltd. All Rights Reserved.