com.togethersoft.openapi.sci
Interface SciExpression

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

public interface SciExpression
extends SciObject

SciExpression represents all posible 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 an expression, its type, parent expression.

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

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

Author:
TogetherSoft

Method Summary
 Objectaccept(SciExpressionVisitor visitor)
           "Accepts" a visitor, calling up its visitXXX method corresponding to the kind of this expression.
 intgetKind()
           Returns an integer value representing the kind of this expression.
 SciExpressiongetParent()
           Returns an expression in which this expression plays a 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 upon all references.
 voidvisitReferences(SciReferenceVisitor visitor, SciElement referencedElement)
           In this expression, makes a specified visitor perform certain actions upon 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 this 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 this expression. All kinds of expressions are defined in the SciExpressionKind inteface.
Returns: an integer value representing the kind of this expression
See Also:
SciExpressionKind

getParent

public SciExpression getParent()
Returns an expression in which this expression plays a 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 a 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 a 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 upon 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 upon 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 for the actions
See Also:
SciReferenceVisitor