p3j.pppm.parameters
Class ParameterAssignment

java.lang.Object
  extended by p3j.pppm.parameters.ParameterAssignment
All Implemented Interfaces:
Serializable, IStochasticOccurrence

public class ParameterAssignment
extends Object
implements Serializable, IStochasticOccurrence

One assignment of a parameter instance. This is a matrix with a concrete name, a description, and a specific content (stored in matrix). This is, in other words, the basic input for the PPPM. Each object is associated with a specific ParameterInstance and therefore with a specific Parameter. It also has a specific probability to occur, therefore IStochasticOccurrence is implemented. Example for an assignment: TFR is constant at 1.3 for native population in the next 100 years. Created on January 20, 2007

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

Constructor Summary
ParameterAssignment()
          Constructor for bean compatibility.
ParameterAssignment(ParameterInstance instance)
          Default constructor.
ParameterAssignment(ParameterInstance instance, String assignName, String desc, double prob, double dev, Matrix val)
          Full constructor.
 
Method Summary
 ParameterAssignment getCopy()
          Copies the assignment.
 String getDescription()
           
 double getDeviation()
           
 int getID()
           
 Matrix getMatrix()
           
 byte[] getMatrixBinary()
          Returns the matrix value as a byte array (for serialization).
 Matrix2D getMatrixValue()
          This method returns the fixed matrix values, as entered by the user.
 String getName()
           
 ParameterInstance getParamInstance()
           
 double getProbability()
          Get the probability that this entity will be chosen.
 void setDescription(String description)
           
 void setDeviation(Double newDeviation)
          Sets deviation.
 void setID(int uniqueID)
           
 void setMatrix(Matrix matrix)
           
 void setMatrixBinary(byte[] byteArray)
          Sets matrix from a byte array (for deserialization).
 void setMatrixValue(Matrix2D matrix2D)
          Sets the matrix value.
 void setName(String name)
           
 void setParamInstance(ParameterInstance paramInstance)
           
 void setProbability(double probability)
          Set probability for being chosen.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterAssignment

public ParameterAssignment(ParameterInstance instance)
Default constructor.

Parameters:
instance - parameter instance to which this assignment belongs

ParameterAssignment

public ParameterAssignment(ParameterInstance instance,
                           String assignName,
                           String desc,
                           double prob,
                           double dev,
                           Matrix val)
Full constructor.

Parameters:
instance - the associated instance
assignName - the name of the assignment
desc - the description of the assignment
prob - the probability of the assignment
dev - the assumption-inherent deviation
val - the assigned value

ParameterAssignment

public ParameterAssignment()
Constructor for bean compatibility.

Method Detail

setMatrixBinary

public void setMatrixBinary(byte[] byteArray)
Sets matrix from a byte array (for deserialization).

Parameters:
byteArray - the byte array which contains the persistent matrix object

getMatrixBinary

public byte[] getMatrixBinary()
Returns the matrix value as a byte array (for serialization).

Returns:
byte representation of assignment value (a matrix object)

getCopy

public ParameterAssignment getCopy()
Copies the assignment. This produces a deep copy, i.e., the value matrix is copied too.

Returns:
a copy of the parameter assignment

toString

public String toString()
Overrides:
toString in class Object

getProbability

public double getProbability()
Description copied from interface: IStochasticOccurrence
Get the probability that this entity will be chosen.

Specified by:
getProbability in interface IStochasticOccurrence
Returns:
probability to be chosen, in [0,1]

setProbability

public void setProbability(double probability)
Description copied from interface: IStochasticOccurrence
Set probability for being chosen.

Specified by:
setProbability in interface IStochasticOccurrence
Parameters:
probability - the probability (in [0,1])

getDescription

public String getDescription()

setDescription

public void setDescription(String description)

getName

public String getName()

setName

public void setName(String name)

getMatrix

public Matrix getMatrix()

setMatrix

public void setMatrix(Matrix matrix)

setMatrixValue

public void setMatrixValue(Matrix2D matrix2D)
Sets the matrix value.

Parameters:
matrix2D - the new matrix value

getMatrixValue

public Matrix2D getMatrixValue()
This method returns the fixed matrix values, as entered by the user. It should NOT be called to get values for any calculations, only for editing. For calculations, call ParameterAssignment#getMatrixValueForExecution(...).

Returns:
the matrix values entered by the user

getParamInstance

public ParameterInstance getParamInstance()

setParamInstance

public void setParamInstance(ParameterInstance paramInstance)

getID

public int getID()

setID

public void setID(int uniqueID)

getDeviation

public double getDeviation()

setDeviation

public void setDeviation(Double newDeviation)
Sets deviation. Compatibility with older databases (which do not necessarily include this field) is ensured by taking a Double as a parameter, which can be null. This is checked, and the primitive is set accordingly.

Parameters:
newDeviation - the deviation


Copyright © 2012. All Rights Reserved.