com.togethersoft.openapi.sci
Interface SciVariable

All Known Subinterfaces:
SciAttribute, SciParameter

public interface SciVariable
extends SciElement

Represents a source code variable (parameter, attribute, local variable, and so on).


This interface has two derivatives:
SciParameter and SciAttribute, which are used to clearly
identify whether the variable is a parameter or an attribute.

Author:
TogetherSoft
Since: Together 3.0
See Also: SciParameter, SciAttribute

Method Summary
 booleancanSetInitialValue(SciExpression expr)
          Checks whether the specified SciExpression can be assigned to this variable as the initial value.
 booleancanSetType(SciType type)
          Checks whether the specified type can be set as the type for this variable.
 SciExpressiongetInitialValue()
          Returns SciExpression containing the initial value for this variable.
 SciTypegetType()
          Returns a type of this variable.
 voidsetInitialValue(SciExpression expr)
          Sets the initial value for this variable to the specified SciExpression.
 voidsetType(SciType type)
          Sets the type for this variable to the specified type.

Methods inherited from interface com.togethersoft.openapi.sci.SciElement
accept, canSetName, canSetProperty, getDeclarationText, getName, getQualifiedName, getTagList, getUniqueName, hasProperty, isDeleted, isPropertyReadable, isPropertyWritable, setName, setProperty, visitReferences, visitReferences

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

canSetInitialValue

public boolean canSetInitialValue(SciExpression expr)
Checks whether the specified SciExpression can be assigned to this variable as the initial value.
Parameters:
expr the SciExpression which needs to be assigned to this variable as the initial value
Returns: true if specified SciExpression can be assigned to this variable as the initial value,
false otherwise

canSetType

public boolean canSetType(SciType type)
Checks whether the specified type can be set as the type for this variable. Returns
true if it can be done, false otherwise.
Parameters:
type the type which needs to be assigned to this variable
Returns: true if the specified type can be set as the type for this variable,
false otherwise

getInitialValue

public SciExpression getInitialValue()
Returns SciExpression containing the initial value for this variable.
Returns: SciExpression containing the initial value for this variable
See Also:
SciExpression

getType

public SciType getType()
Returns a type of this variable.
Returns: a type of this variable

setInitialValue

public void setInitialValue(SciExpression expr)
Sets the initial value for this variable to the specified SciExpression.
Parameters:
expr the SciExpression which needs to be assigned to this variable as the initial value

setType

public void setType(SciType type)
Sets the type for this variable to the specified type. Usually there is no need for this method, since
it is much easier to change a variable's type using the SciType.setText
method. For example, if myAttribute represents this source code attribute:

int k;

then the execution of

myAttribute.getType().setText("java.util.Hashtable");

will transform the original attribute into

java.util.Hashtable k;
Parameters:
type the type which needs to be assigned to this variable