public class Formula extends Object implements Expression
Constructor and Description |
---|
Formula(Cell cell,
Expression expression)
Creates a new formula.
|
Modifier and Type | Method and Description |
---|---|
Object |
accept(ExpressionVisitor visitor)
Accepts to visit the given expression visitor.
|
Value |
evaluate()
Evaluates the expression and returns the result.
|
Cell |
getCell()
Returns the cell to which the formula belongs.
|
Expression |
getExpression()
Returns the expression in the formula.
|
SortedSet<Reference> |
getReferences()
Returns the references in the expression.
|
boolean |
hasCircularReference()
Checks if the given formula has any circular references.
|
String |
toString()
Returns a string representation of the formula.
|
public Formula(Cell cell, Expression expression)
cell
- the cell to which the formula belongsexpression
- the expression in the formulapublic Value evaluate() throws IllegalValueTypeException
Expression
evaluate
in interface Expression
IllegalValueTypeException
- if a value of an unexpected type was
encountered when evaluating the expressionpublic Object accept(ExpressionVisitor visitor)
Expression
accept
in interface Expression
visitor
- the visitorpublic Cell getCell()
public Expression getExpression()
public SortedSet<Reference> getReferences()
public boolean hasCircularReference()
CircularReferenceException
- if the formula contains any circular references