com.togethersoft.openapi.sci
Interface SciExpression

All Known Subinterfaces:
SciAssignmentExpression, SciConstantExpression, SciDirectInitExpression, SciFunctionCallExpression, SciMemberAccessExpression, SciNewExpression, SciReferenceExpression, SciTypeCastExpression, SciTypeExpression

public interface SciExpression
extends SciObject

SciExpression represents all possible types of expressions in a source code.


It also provides common methods for all types of expressions, allowing to get information about the kind of
expression, its type, and parent expression.


Each derivative of SciExpression inherits the accept(SciExpressionVisitor) method, which
runs the visitor's visitXXX method corresponding to the kind of expression.


visitReferences(SciReferenceVisitor) and
visitReferences(SciReferenceVisitor, SciElement) methods are used to perform
actions upon references taking place in this expression.

Author:
TogetherSoft
Since: Together 3.0

Method Summary
 Objectaccept(SciExpressionVisitor visitor)
          "Accepts" a visitor, calling up its visitXXX method corresponding to the kind of expression.
 intgetKind()
          Returns an integer value representing the kind of expression.
 SciObjectgetOwner()
          Returns an object that owns this expression.
 SciExpressiongetParent()
          Returns an expression in which this expression plays the role of an operand.
 SciTypegetType()
          Returns SciType instance for this expression.
 SciExpressionEnumerationoperands()
           
 voidvisitReferences(SciReferenceVisitor visitor)
          In this expression, makes a specified visitor perform certain actions on all references.
 voidvisitReferences(SciReferenceVisitor visitor, SciElement referencedElement)
          In this expression, makes a specified visitor perform certain actions on all references to the specified
element.

Methods inherited from interface com.togethersoft.openapi.sci.SciObject
canCut, canDelete, canReplace, copy, cut, delete, getContainingFile, getContainingScope, getLanguage, getPositions, getText, getUserProperty, isReadOnly, replace, setUserProperty

Method Detail

accept

public Object accept(SciExpressionVisitor visitor)
"Accepts" a visitor, calling up its visitXXX method corresponding to the kind of expression.
Parameters:
visitor the SciExpressionVisitor type visitor
Returns: visitor-specific result.
See Also:
SciExpressionVisitor, com.togethersoft.openapi.sci.visitor

getKind

public int getKind()
Returns an integer value representing the kind of expression. All kinds of expressions
are defined in the SciExpressionKind interface.
Returns: an integer value representing the kind of this expression
See Also:
SciExpressionKind

getOwner

public SciObject getOwner()
Returns an object that owns this expression.
In many cases the owner is the parent expression, so objects returned by getParent and getOwner
are equal. However, expressions are not only operands of other expressions; they could appear in other contexts as well.
For example, SciVariable.getInitialValue() or SciExpressionStatement.getExpression().

This operation may be helpful to get information about the context where the expression appeared, especially when you
get an expression object using an expression visitor.

Note that for SciReferenceExspression this operation is derived from both SciReference and SciExpression interfaces.

Returns: an object that owns this expression
Since:
Together 6.0
See Also:
getParent(), SciReference.getOwner(), SciExpressionVisitor, SciScope.visitExpressions(com.togethersoft.openapi.sci.visitor.SciExpressionVisitor)

getParent

public SciExpression getParent()
Returns an expression in which this expression plays the role of an operand. Returns null
if this expression isn't an operand of an upper-level expression.


For example, for the SciFunctionCallExpression representing
a call of someMethod() in this line of code:



myObject.someMethod();

the getParent() method will return SciExpression being an instance of
SciMemberAccessExpression.
Returns: an expression in which this expression plays the role of an operand
See Also:
SciFunctionCallExpression, SciMemberAccessExpression

getType

public SciType getType()
Returns SciType instance for this expression.
Returns: SciType instance for this expression
See Also:
SciType

operands

public SciExpressionEnumeration operands()

visitReferences

public void visitReferences(SciReferenceVisitor visitor)
In this expression, makes a specified visitor perform certain actions on all references.
Parameters:
visitor the SciReferenceVisitor which will perform certain actions
upon all references in this expression
See Also:
SciReferenceVisitor

visitReferences

public void visitReferences(SciReferenceVisitor visitor, SciElement referencedElement)
In this expression, makes a specified visitor perform certain actions on all references to the specified
element.
Parameters:
visitor the SciReferenceVisitor which will perform certain actions
upon all references to the specified element
referencedElement the SciElement, references to which are subject to the actions
See Also:
SciReferenceVisitor