Class ConstantExpression
java.lang.Object
edu.cmu.tetrad.calculator.expression.ConstantExpression
- All Implemented Interfaces:
Expression,TetradSerializable,Serializable
Represents a constant expression, that is an expression that always evaluates to the same value.
- Version:
- $Id: $Id
- Author:
- Tyler Gibson
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConstantExpressionConstant expression for e.static final ConstantExpressionConstant expression for PI. -
Constructor Summary
ConstructorsConstructorDescriptionConstantExpression(double value) Constructs the constant expression given the value to use. -
Method Summary
Modifier and TypeMethodDescriptiondoubleEvaluates the expression using the given contextgetExpressions.org.apache.commons.math3.distribution.IntegerDistributiongetIntegerDistribution(Context context) getIntegerDistribution.getName()Getter for the fieldname.getPosition.org.apache.commons.math3.distribution.RealDistributiongetRealDistribution(Context context) getRealDistribution.getToken()getToken.static ConstantExpressionserializableInstance.toString()toString.
-
Field Details
-
PI
Constant expression for PI. -
E
Constant expression for e.
-
-
Constructor Details
-
ConstantExpression
public ConstantExpression(double value) Constructs the constant expression given the value to use.- Parameters:
value- a double
-
-
Method Details
-
serializableInstance
serializableInstance.
- Returns:
- a
ConstantExpressionobject
-
getName
Getter for the field
name.- Returns:
- the name of the constant or null if there isn't one.
-
evaluate
Evaluates the expression using the given context- Specified by:
evaluatein interfaceExpression- Parameters:
context- aContextobject- Returns:
- a double
-
getToken
getToken.
- Specified by:
getTokenin interfaceExpression- Returns:
- a
Stringobject
-
getPosition
getPosition.
- Specified by:
getPositionin interfaceExpression- Returns:
- a
ExpressionDescriptor.Positionobject
-
getExpressions
getExpressions.
- Specified by:
getExpressionsin interfaceExpression- Returns:
- a
Listobject
-
toString
toString.
-
getRealDistribution
getRealDistribution.
- Specified by:
getRealDistributionin interfaceExpression- Parameters:
context- aContextobject- Returns:
- a
RealDistributionobject
-
getIntegerDistribution
public org.apache.commons.math3.distribution.IntegerDistribution getIntegerDistribution(Context context) getIntegerDistribution.
- Specified by:
getIntegerDistributionin interfaceExpression- Parameters:
context- aContextobject- Returns:
- a
IntegerDistributionobject
-