| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
SciReference interface provides methods for working with references.
In the SCI model, references are:
For example, in the following Java source code fragment, the references are
MyType1, someObject, someMethod and iTotal
(in the line with iTotal=1;):
MyType1 myFirstAttribute=null;
MyType2 mySecondAttribure=null;
int iTotal=0; // this is not a reference!
someObject.someMethod();
iTotal=1;
getReferencedElement method.
It is possible
to change a referenced element using the setReferencedElement method. For the example described above
, if the refToMyType2 is a reference to MyType2, and the
elementMyType1 is an SCI element representing MyType1, the code:
refToType2.setReferencedElement(elementMyType1)
MyType1 myFirstAttribute=null;
MyType1 mySecondAttribure=null;
...
| Method Summary | |
boolean | canSetReferencedElement(SciElement element)Checks whether the specified element can be set as a target for this reference. |
boolean | canSetReferenceText(String text)Checks whether the specified text can be set as the text for this reference. |
SciObject | getOwner()Returns the owner of this reference. |
SciElement | getReferencedElement()Returns the SciElement this reference points to. |
String | getReferenceText()Returns the string containing this reference text in source code. |
void | setReferencedElement(SciElement element)Sets another SciElement for this reference to point to. |
void | setReferenceText(String text)Sets this reference text to the specified value. |
| 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 |
public boolean canSetReferencedElement(SciElement element)
SciElement which needs to be set as a target for this referencetrue if the specified element can be set as a target for this reference,
false otherwisepublic boolean canSetReferenceText(String text)
true if the specified text can be set as the text for this reference,
false otherwisepublic SciObject getOwner()
null in particular situations if no appropriate owner is found. For example,
getType() of SciExpression has no
SciObject.public SciElement getReferencedElement()
SciElement this reference points to. If Together cannot find such an element
null.SciElement this reference points topublic String getReferenceText()
public void setReferencedElement(SciElement element)
SciElement for this reference to point to.SciElement which needs to be set as a target for this referencepublic void setReferenceText(String text)
setReferencedElement method.
Note the difference with SciType.setText
method when working with the SciType objects (SciType is a special kind
of a reference - a reference to a type).
| ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||