p3j.pppm
Class ProjectionModel

java.lang.Object
  extended by james.core.base.Entity
      extended by james.core.base.NamedEntity
          extended by james.core.model.Model
              extended by p3j.pppm.ProjectionModel
All Implemented Interfaces:
james.core.base.IEntity, james.core.base.INamedEntity, james.core.model.IModel, james.core.observe.IObservable, Serializable, Comparable<james.core.base.INamedEntity>, IProjectionModel

public class ProjectionModel
extends james.core.model.Model
implements IProjectionModel

Stores a complete configuration for the PPPM, containing Set objects associated with different SetType instances. Such a scenario can be used for forecasting, it comprises all information necessary for basic repeatibility of the Monte-Carlo-simulation. Each scenario holds a list of all ParameterInstance objects that need an assignment. Disjunct subsets of this list will be managed by SetType. TODO: Store RNG seed to ensure exact reproducibility. Created on January 22, 2007

Author:
Christina Bohk, Roland Ewald
See Also:
Serialized Form

Field Summary
 
Fields inherited from class james.core.model.Model
accessRestriction
 
Constructor Summary
ProjectionModel()
          Constructor for bean compatibility (do NOT use manually!).
ProjectionModel(String scenName, String desc, int numOfGenerations, int predYears, int maxAge, int jumpOffYear)
          Default constructor.
 
Method Summary
 boolean assignParameterInstance(ParameterInstance instance, SetType type, boolean migrate)
          Assign a ParameterInstance to a specific SetType.
 SetType createSetType(String stName, String stDesc)
          Defines a new Settype for this scenario.
 List<ParameterInstance> getAllParameterInstances()
          Gets the all parameter instances.
 List<SetType> getAllSetTypes()
          Returns list of all SetType objects, the custom ones and the default one.
 Set getDefaultSet()
          Gets the default set.
 SetType getDefaultSetType()
          Gets the default Settype.
 SetType getDefaultType()
          Gets the default type.
 String getDescription()
          Gets the description.
 int getGenerations()
          Gets the number of projected generations.
 int getID()
          Gets the id.
 Map<ParameterInstance,SetType> getInstanceSetTypes()
          Gets the map parameter instance => Settype.
 int getJumpOffYear()
          Gets the jump off year.
 int getMaximumAge()
          Gets the maximum age.
 String getName()
           
 int getNumberOfAgeClasses()
          Gets the number of age classes.
 int getNumOfSetTypes()
          Gets the number of (user-defined) of Settypes.
 SetType getSetType(int index)
          Retrieves a custom SetType.
 List<ParameterInstance> getUnassignedParameterInstances()
          Get all ParameterInstance objects that still belong to the default SetType.
 List<SetType> getUserDefinedTypes()
          Gets the user defined types.
 int getYears()
          Gets the number of projected years.
 void init()
          Initializes projection.
 boolean removeParameterInstanceAssignment(ParameterInstance instance)
          Removes a ParameterInstance from a certain SetType.
 boolean removeSetType(int index)
          Removes SetType with given index from scenario.
 boolean removeSetType(SetType setType)
          Removes the Settype.
 void setAllParameterInstances(List<ParameterInstance> allParameterInstances)
          Sets the all parameter instances.
 void setDefaultSet(Set defaultSet)
          Sets the default set.
 void setDefaultType(SetType defaultType)
          Sets the default type.
 void setDescription(String description)
          Sets the description.
 void setGenerations(int generations)
          Sets the generations.
 void setID(int uniqueID)
          Sets the id.
 void setInstanceSetTypes(Map<ParameterInstance,SetType> instanceSetTypes)
          Sets the instance Settypes.
 void setJumpOffYear(int jumpOffYear)
          Sets the jump off year.
 void setMaximumAge(int maximumAge)
          Sets the maximum age.
 void setName(String name)
           
 void setUserDefinedTypes(List<SetType> userDefinedTypes)
          Sets the user defined types.
 void setYears(int years)
          Sets the years.
 
Methods inherited from class james.core.model.Model
cleanUp, demandsResource, getParam, getParam, instantiate, setAccessRestriction, setParam
 
Methods inherited from class james.core.base.NamedEntity
compareTo, getCompleteInfoString, toString
 
Methods inherited from class james.core.base.Entity
changed, changed, getMediator, getSimpleId, isObserved, registerObserver, report, report, report, report, report, report, report, report, setMediator, unregister, unregisterObserver, unregisterObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface james.core.model.IModel
cleanUp, setAccessRestriction
 
Methods inherited from interface james.core.base.INamedEntity
compareTo
 
Methods inherited from interface james.core.base.IEntity
getCompleteInfoString, getSimpleId
 
Methods inherited from interface james.core.observe.IObservable
changed, getMediator, registerObserver, setMediator, unregisterObserver, unregisterObservers
 

Constructor Detail

ProjectionModel

public ProjectionModel()
Constructor for bean compatibility (do NOT use manually!).


ProjectionModel

public ProjectionModel(String scenName,
                       String desc,
                       int numOfGenerations,
                       int predYears,
                       int maxAge,
                       int jumpOffYear)
Default constructor.

Parameters:
scenName - name of the scenario
desc - description of the scenario
numOfGenerations - number of generations to be considered
predYears - number of years to be predicted
maxAge - maximum age to be considered
jumpOffYear - the jump off year
Method Detail

init

public void init()
Initializes projection. Needs to be called after allParameterInstances has been initialized.

Specified by:
init in interface james.core.model.IModel
Overrides:
init in class james.core.model.Model

createSetType

public SetType createSetType(String stName,
                             String stDesc)
Defines a new Settype for this scenario.

Parameters:
stName - name of the Settype
stDesc - description of the Settype
Returns:
newly defined Settype for this scenario

getUnassignedParameterInstances

public List<ParameterInstance> getUnassignedParameterInstances()
Get all ParameterInstance objects that still belong to the default SetType. These have not yet been assigned to any custom SetType.

Returns:
list of all parameter instances that are not yet assigned to user defined Settypes

assignParameterInstance

public boolean assignParameterInstance(ParameterInstance instance,
                                       SetType type,
                                       boolean migrate)
Assign a ParameterInstance to a specific SetType.

Parameters:
instance - the parameter instance to be assigned
type - the SetType that shall manage the ParameterInstance from now on
migrate - flag to switch migration of existing assumption to new Settype on/off
Returns:
true, if parameter instance could be assigned (i.e., former set type is default Settype), otherwise false

removeParameterInstanceAssignment

public boolean removeParameterInstanceAssignment(ParameterInstance instance)
Removes a ParameterInstance from a certain SetType.

Parameters:
instance - the instance that should from now on be managed by the default SetType
Returns:
true, if instance could be removed from its Settype (i.e., if set type is not default Settype)

getSetType

public SetType getSetType(int index)
Retrieves a custom SetType.

Parameters:
index - index of the Settype
Returns:
Settype with given index

removeSetType

public boolean removeSetType(int index)
Removes SetType with given index from scenario.

Parameters:
index - index of the Settype
Returns:
true, if operation could be executed

getAllSetTypes

public List<SetType> getAllSetTypes()
Description copied from interface: IProjectionModel
Returns list of all SetType objects, the custom ones and the default one.

Specified by:
getAllSetTypes in interface IProjectionModel
Returns:
list of all SetType objects defined in this scenario (at least the default SetType is defined)

getDefaultSet

public Set getDefaultSet()
Gets the default set.

Returns:
the default set

setDefaultSet

public void setDefaultSet(Set defaultSet)
Sets the default set.

Parameters:
defaultSet - the new default set

getDefaultType

public SetType getDefaultType()
Gets the default type.

Returns:
the default type

setDefaultType

public void setDefaultType(SetType defaultType)
Sets the default type.

Parameters:
defaultType - the new default type

getDefaultSetType

public SetType getDefaultSetType()
Gets the default Settype.

Returns:
the default Settype

getGenerations

public int getGenerations()
Description copied from interface: IProjectionModel
Gets the number of projected generations.

Specified by:
getGenerations in interface IProjectionModel
Returns:
the number of generations

setGenerations

public void setGenerations(int generations)
Sets the generations.

Parameters:
generations - the new generations

getMaximumAge

public int getMaximumAge()
Description copied from interface: IProjectionModel
Gets the maximum age.

Specified by:
getMaximumAge in interface IProjectionModel
Returns:
the maximum age

setMaximumAge

public void setMaximumAge(int maximumAge)
Sets the maximum age.

Parameters:
maximumAge - the new maximum age

getYears

public int getYears()
Description copied from interface: IProjectionModel
Gets the number of projected years.

Specified by:
getYears in interface IProjectionModel
Returns:
the number of years

setYears

public void setYears(int years)
Sets the years.

Parameters:
years - the new years

getUserDefinedTypes

public List<SetType> getUserDefinedTypes()
Gets the user defined types.

Returns:
the user defined types

setUserDefinedTypes

public void setUserDefinedTypes(List<SetType> userDefinedTypes)
Sets the user defined types.

Parameters:
userDefinedTypes - the new user defined types

getAllParameterInstances

public List<ParameterInstance> getAllParameterInstances()
Gets the all parameter instances.

Returns:
the all parameter instances

setAllParameterInstances

public void setAllParameterInstances(List<ParameterInstance> allParameterInstances)
Sets the all parameter instances.

Parameters:
allParameterInstances - the new all parameter instances

getInstanceSetTypes

public Map<ParameterInstance,SetType> getInstanceSetTypes()
Description copied from interface: IProjectionModel
Gets the map parameter instance => Settype.

Specified by:
getInstanceSetTypes in interface IProjectionModel
Returns:
the map from parameter instance to Settypes

setInstanceSetTypes

public void setInstanceSetTypes(Map<ParameterInstance,SetType> instanceSetTypes)
Sets the instance Settypes.

Parameters:
instanceSetTypes - the instance Settypes

removeSetType

public boolean removeSetType(SetType setType)
Removes the Settype.

Parameters:
setType - the Settype
Returns:
true, if successful

getNumOfSetTypes

public int getNumOfSetTypes()
Gets the number of (user-defined) of Settypes.

Returns:
the number of Settypes

getID

public int getID()
Gets the id.

Returns:
the id

setID

public void setID(int uniqueID)
Sets the id.

Parameters:
uniqueID - the new id

getName

public String getName()
Specified by:
getName in interface james.core.base.INamedEntity
Overrides:
getName in class james.core.base.NamedEntity

setName

public void setName(String name)
Specified by:
setName in interface james.core.base.INamedEntity
Overrides:
setName in class james.core.base.NamedEntity

getDescription

public String getDescription()
Gets the description.

Returns:
the description

setDescription

public void setDescription(String description)
Sets the description.

Parameters:
description - the new description

getNumberOfAgeClasses

public int getNumberOfAgeClasses()
Gets the number of age classes. Is calculated by adding 1 to maximumAge.

Returns:
the number of age classes

getJumpOffYear

public int getJumpOffYear()
Gets the jump off year.

Returns:
the jump off year

setJumpOffYear

public void setJumpOffYear(int jumpOffYear)
Sets the jump off year.

Parameters:
jumpOffYear - the new jump off year


Copyright © 2012. All Rights Reserved.