csheets.core.formula.util
Class ReferenceFetcher

java.lang.Object
  extended by csheets.core.formula.util.AbstractExpressionVisitor
      extended by csheets.core.formula.util.ReferenceFetcher
All Implemented Interfaces:
ExpressionVisitor

public class ReferenceFetcher
extends AbstractExpressionVisitor

An expression visitor that collects the references from an expression.

Author:
Einar Pehrson

Constructor Summary
ReferenceFetcher()
          Creates a new reference fetcher.
 
Method Summary
 SortedSet<Reference> getReferences(Expression expression)
          Traverses the given expression and returns the references that were found.
 Object visitReference(Reference reference)
          Adds the reference to the set.
 
Methods inherited from class csheets.core.formula.util.AbstractExpressionVisitor
visitBinaryOperation, visitFunctionCall, visitLiteral, visitUnaryOperation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceFetcher

public ReferenceFetcher()
Creates a new reference fetcher.

Method Detail

getReferences

public SortedSet<Reference> getReferences(Expression expression)
Traverses the given expression and returns the references that were found.

Parameters:
expression - the expression from which to fetch references
Returns:
the references that have been fetched

visitReference

public Object visitReference(Reference reference)
Adds the reference to the set.

Specified by:
visitReference in interface ExpressionVisitor
Overrides:
visitReference in class AbstractExpressionVisitor
Parameters:
reference - the reference to visit
Returns:
an arbitrary object