uk.co.agena.minerva.model.scenario
Class ScenarioList

java.lang.Object
  extended by uk.co.agena.minerva.model.scenario.ScenarioList
All Implemented Interfaces:
Writable

public class ScenarioList
extends java.lang.Object
implements Writable

This class holds a list of Scenarios.


Field Summary
static double version
           
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ScenarioList()
          Creates an empty ScenarioList.
ScenarioList(java.util.List scenarios)
          Creates a new ScenarioList with the supplied List of Scenarios.
 
Method Summary
 void addScenario(Scenario scenario)
          Adds the supplied Scenario to this ScenarioList.
 java.util.List getAllObservations()
          Returns a List of all Observations in all stored Scenarios.
 java.util.List getObservationsConnectedToExtendedNode(int exnID)
          Returns a List of all Obsevations that are connected to the ExtendedNode with the given ID.
 Scenario getScenario(int id)
          Returns the Scenario with the supplied ID.
 Scenario getScenarioAtIndex(int index)
           
 java.util.List getScenarios()
          Return the complete List of Scenarios.
 java.util.List getScenariosConnectedToExtendedBN(int exBNID)
          Returns a List of Scenarios that have one or more Observations within them connected to the specified Extended BN.
 Scenario getScenarioWithName(java.lang.String name)
           
 double getVersion()
          Returns the version of the class.
 int read(java.util.List strings, int currentLineNumber)
           
 void removeAllScenarios()
          Removes all the Scenarios in this ScenarioList.
 void removeNonNumericObservationsForNode(int connExtendedBNID, int connExtendedNodeID)
          Removes all Non-numeric Observations from any Scenarios that are related to the supplied ExtendedBN and ExtendedNode IDs.
 void removeObservationsForExtendedBN(ExtendedBN exBN)
          This method will remove all observations that are connected to the specified extended BN from the scenarios contained within the list.
 void removeObservationsForNode(int connExtendedBNID, int connExtendedNodeID)
          Removes all Observations from any Scenarios that are related to the supplied ExtendedBN and ExtendedNode IDs.
 void removeObservationsForNodeWithParameter(int connExtendedBNID, int connExtendedNodeID, java.lang.String parameterName)
          This method will remove all observations that are connected to the specified node and have the specified expression name from the scebario list
 Scenario removeScenario(int id)
          Removes the Scenario with the supplied ID if it is found.
 Scenario removeScenario(Scenario scenario)
          Removes the specified scenario from the model
 void resetAllScenarios()
          Removes all Observations from all Scenarios.
 void setScenarios(java.util.List scenarios)
          Set the list of Scenarios that this holds.
 void setVersion(double version)
          Sets the version number of the class.
 void updateParameterExpressionName(int extendedBNID, int extendedNodeID, java.lang.String oldName, java.lang.String newName)
          This method will update all observations that are connected to the specified parameter in the specified node with the latest name of the parameter
 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
Constructor Detail

ScenarioList

public ScenarioList()
Creates an empty ScenarioList.


ScenarioList

public ScenarioList(java.util.List scenarios)
Creates a new ScenarioList with the supplied List of Scenarios.

Parameters:
scenarios - the List of Scenarios used to create the ScenarioList
Method Detail

addScenario

public void addScenario(Scenario scenario)
Adds the supplied Scenario to this ScenarioList.

Parameters:
scenario - the Scenario to be added

removeScenario

public Scenario removeScenario(int id)
                        throws ScenarioNotFoundException
Removes the Scenario with the supplied ID if it is found.

Parameters:
id - the ID of the Scenario that is to be removed
Returns:
the Scenario that was removed
Throws:
ScenarioNotFoundException - if the Scenario does not exist in the ScenarioList

removeScenario

public Scenario removeScenario(Scenario scenario)
                        throws ScenarioNotFoundException
Removes the specified scenario from the model

Parameters:
scenario -
Returns:
Throws:
ScenarioNotFoundException

removeObservationsForNode

public void removeObservationsForNode(int connExtendedBNID,
                                      int connExtendedNodeID)
Removes all Observations from any Scenarios that are related to the supplied ExtendedBN and ExtendedNode IDs.

Parameters:
connExtendedBNID - the ID of the ExtendedBN associated with the Observation
connExtendedNodeID - the ID of the ExtendedNode associated with the Observation

removeObservationsForExtendedBN

public void removeObservationsForExtendedBN(ExtendedBN exBN)
This method will remove all observations that are connected to the specified extended BN from the scenarios contained within the list.

Parameters:
exBN -

removeNonNumericObservationsForNode

public void removeNonNumericObservationsForNode(int connExtendedBNID,
                                                int connExtendedNodeID)
Removes all Non-numeric Observations from any Scenarios that are related to the supplied ExtendedBN and ExtendedNode IDs.

Parameters:
connExtendedBNID - the ID of the ExtendedBN associated with the Observation
connExtendedNodeID - the ID of the ExtendedNode associated with the Observation

removeObservationsForNodeWithParameter

public void removeObservationsForNodeWithParameter(int connExtendedBNID,
                                                   int connExtendedNodeID,
                                                   java.lang.String parameterName)
This method will remove all observations that are connected to the specified node and have the specified expression name from the scebario list

Parameters:
connExtendedBNID -
connExtendedNodeID -
parameterName -

removeAllScenarios

public void removeAllScenarios()
Removes all the Scenarios in this ScenarioList.


updateParameterExpressionName

public void updateParameterExpressionName(int extendedBNID,
                                          int extendedNodeID,
                                          java.lang.String oldName,
                                          java.lang.String newName)
This method will update all observations that are connected to the specified parameter in the specified node with the latest name of the parameter

Parameters:
extendedBNID -
extendedNodeID -
oldName -
newName -

getScenario

public Scenario getScenario(int id)
                     throws ScenarioNotFoundException
Returns the Scenario with the supplied ID.

Parameters:
id - the ID of the required Scenario
Returns:
the required Scenario
Throws:
ScenarioNotFoundException - if the Scenario is not found in the list

getScenarioAtIndex

public Scenario getScenarioAtIndex(int index)

getScenarioWithName

public Scenario getScenarioWithName(java.lang.String name)

getScenarios

public java.util.List getScenarios()
Return the complete List of Scenarios.

Returns:
the complete List of Scenarios

setScenarios

public void setScenarios(java.util.List scenarios)
Set the list of Scenarios that this holds.

Parameters:
scenarios - the new List of Scenarios for this ScenarioList

resetAllScenarios

public void resetAllScenarios()
Removes all Observations from all Scenarios.


getScenariosConnectedToExtendedBN

public java.util.List getScenariosConnectedToExtendedBN(int exBNID)
Returns a List of Scenarios that have one or more Observations within them connected to the specified Extended BN. The supplied ID is matched against the connectedExtendedBNID of each Observation in each Scenario. A single match is enough for the Scenario to be included in the List that is returned.

Parameters:
exBNID - the ExtendedBN ID that the Scenarios may or may not be connected to
Returns:
A list of the Scenarios that are connected to the specified ExtendedBN

getObservationsConnectedToExtendedNode

public java.util.List getObservationsConnectedToExtendedNode(int exnID)
Returns a List of all Obsevations that are connected to the ExtendedNode with the given ID.

Parameters:
exnID - The id of the ExtendedNode we want to find the Observations for.
Returns:
A List of Observations connected to the ExtendedNode with the given id.

getAllObservations

public java.util.List getAllObservations()
Returns a List of all Observations in all stored Scenarios.

Returns:
A List of all Observations for all Scenarios.

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

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


Copyright © 2006 Agena Ltd. All Rights Reserved.