PIANOS.datastructures
Class Variable

java.lang.Object
  extended by PIANOS.datastructures.Variable

public class Variable
extends java.lang.Object

A representation for a stochastic or functional variable/parameter in a statistical PIANOS model.


Constructor Summary
Variable()
          Constructs a new Variable from scratch, ready to take in field values.
 
Method Summary
 void addAffected(Variable variable)
          Adds a new Variable at the end of the list of Variables that this Variable affects.
 void addDependence(Variable variable)
          Adds a new Variable at the end of the list of Variables that this Variables depends on.
 java.util.LinkedList<Variable> getAffectsList()
           
 java.lang.String getAlgorithm()
           
 int getColumn()
           
 java.util.LinkedList<Variable> getDependsList()
           
 Distribution getDistribution()
           
 Entity getEntity()
           
 Equation getEquation()
           
 int getMissingValueCount()
           
 java.lang.String getName()
           
 Distribution getProposal()
           
 java.lang.String getStrategy()
           
 int getUpdates()
           
 void incrementMissingValues()
          Adds one to the number of missing values.
 boolean isData()
           
 boolean isFunctional()
           
 boolean isInteger()
           
 boolean isOk()
          Runs this Variable through a health check.
 boolean isPrinted()
           
 boolean isSpatial()
           
 void setAlgorithm(java.lang.String algorithm)
          (currently not implemented) This will set the update algorithm for this Variable.
 void setColumn(int column)
          Sets the data column number for the Variable (See getColumn())
 void setData(boolean data)
           
 void setDistribution(Distribution distribution)
           
 void setEntity(Entity belongsTo)
           
 void setEquation(Equation equation)
           
 void setFunctional(boolean functional)
           
 void setName(java.lang.String name)
           
 void setPrinted()
          Sets that this Variable should be printed.
 void setProposal(Distribution proposal)
          Sets the proposal Distribution for this variable (see the manual)
 void setSpatial(boolean spatial)
           
 void setStrategy(java.lang.String strategy)
          Sets the update strategy for this variable {sequential, random}
 void setType(boolean typeInteger)
           
 void setUpdates(int updates)
          Sets the number of updates this variable should have before end of simulation.
 java.lang.String toString()
          Prints a limited amount of information about this Variable similar to a model file variable definition line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Variable

public Variable()
Constructs a new Variable from scratch, ready to take in field values.

Method Detail

getAffectsList

public java.util.LinkedList<Variable> getAffectsList()
Returns:
A list of Variables this variable affects in the model.

addAffected

public void addAffected(Variable variable)
Adds a new Variable at the end of the list of Variables that this Variable affects.


getDependsList

public java.util.LinkedList<Variable> getDependsList()
Returns:
a list of Variables that this Variable depends on.

addDependence

public void addDependence(Variable variable)
Adds a new Variable at the end of the list of Variables that this Variables depends on.


getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the update algorithm used for this Variable (currently not implemented), defaults to M-H

setAlgorithm

public void setAlgorithm(java.lang.String algorithm)
(currently not implemented) This will set the update algorithm for this Variable. Choices would include Metropolis-Hastings and Gibbs sampling.


getColumn

public int getColumn()
Returns:
the column number for the variable if it is found in data, or -1 if the variable spans the whole data matrix (and as such all the columns)

setColumn

public void setColumn(int column)
Sets the data column number for the Variable (See getColumn())


isData

public boolean isData()
Returns:
if this Variable can be found in the data of this model.

setData

public void setData(boolean data)
Parameters:
data - set this to true if the Variable is found in data.

getEquation

public Equation getEquation()
Returns:
The Equation used for this Variable if it is functional (see Equation)

setEquation

public void setEquation(Equation equation)

getDistribution

public Distribution getDistribution()
Returns:
The Distribution used for this Variable if it is stochastic (not functional) (see Distribution)

setDistribution

public void setDistribution(Distribution distribution)

isFunctional

public boolean isFunctional()
Returns:
true if this Variable is functional.

setFunctional

public void setFunctional(boolean functional)

isSpatial

public boolean isSpatial()
Returns:
true if this Variable is a functional variable that has an expression that consists of the SUM or COUNT statements and a spatial dependence in them, such as COUNT(&x)

setSpatial

public void setSpatial(boolean spatial)

getName

public java.lang.String getName()
Returns:
The name used in the model for this variable and to be used in the Fortran program.

setName

public void setName(java.lang.String name)

setProposal

public void setProposal(Distribution proposal)
Sets the proposal Distribution for this variable (see the manual)


getProposal

public Distribution getProposal()

setStrategy

public void setStrategy(java.lang.String strategy)
Sets the update strategy for this variable {sequential, random}


getStrategy

public java.lang.String getStrategy()

setUpdates

public void setUpdates(int updates)
Sets the number of updates this variable should have before end of simulation.


getUpdates

public int getUpdates()

getMissingValueCount

public int getMissingValueCount()
Returns:
How many missing values this variable has (if it's a data variable that has missing values), otherwise returns 0.

incrementMissingValues

public void incrementMissingValues()
Adds one to the number of missing values. Used by the Parser.


isInteger

public boolean isInteger()
Returns:
true if this variable should have integer values.

setType

public void setType(boolean typeInteger)

getEntity

public Entity getEntity()
Returns:
The entity this Variable belongs to.

setEntity

public void setEntity(Entity belongsTo)

setPrinted

public void setPrinted()
Sets that this Variable should be printed.


isPrinted

public boolean isPrinted()

isOk

public boolean isOk()
Runs this Variable through a health check. Returns true if it is alright. Called by the parser at end of reading.

Returns:
true if this variable is valid.

toString

public java.lang.String toString()
Prints a limited amount of information about this Variable similar to a model file variable definition line.

Overrides:
toString in class java.lang.Object