| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A generic element of a program (class, function, variable etc). Every SCI element has a set of characteristics which define its behavior and structure:
SciClasses and
SciMembers, and contains the full name of the element.
For example, the qualified name for a java class will look like a standard Java language
fully qualified class name: "java.lang.String".
You can identify a class by its qualified name if you now its language. For example:
SciClass justFoundClass = mySciModel.findClass(SciLanguage.JAVA,"com.togethersoft.openapi.sci.SciElement");
Every SciElement's derivative inherits the accept(SciElementVisitor) method which
runs visitor's visitXXX method corresponding to the kind of this element.
visitReferences(SciReferenceVisitor) and
visitReferences(SciReferenceVisitor, SciElement) methods are used to perform
actions upon references contained in this element.
This interfaces contains very useful method getTagList, which gives an access to the
SciTag objects representing RWI properties of this element, written in the JavaDoc
manner in the comment field.
The isDeleted method is used for checking whether this SciElement
represents the existing element of the model.
| Method Summary | |
Object | accept(SciElementVisitor visitor)"Accepts" a visitor, calling up its visitXXX method corresponding to the kind of this element. |
boolean | canSetName(String name)Checks whether the specified name can be set for this element. |
boolean | canSetProperty(int property, boolean value)Checks if the value is valid for this property, or can be assigned to it at this time. |
String | getDeclarationText()Returns a string with a text of this element's declaration. |
String | getName()Returns a string containing the name for this element. |
String | getQualifiedName()Returns a string with the qualified name of this element. |
SciTagList | getTagList()Returns SciTagList object containing all SciTags for this element. |
String | getUniqueName()Returns a string with the unique name of this element. |
boolean | hasProperty(int property)Checks whether this element has the specified property. |
boolean | isDeleted()Checks whether this SciElement represents existing model's data. |
boolean | isPropertyReadable(int property)Checks whether the property is readable (used to check whether the property has a sense for this element). |
boolean | isPropertyWritable(int property)Checks whether the property is writable for this element. |
void | setName(String name)Sets the name for this element. |
void | setProperty(int property, boolean value)Sets the value for the property. |
void | visitReferences(SciReferenceVisitor visitor)In this element, makes a specified visitor perform certain actions upon all references. |
void | visitReferences(SciReferenceVisitor visitor, SciElement referencedElement)In this element, 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 |
public Object accept(SciElementVisitor visitor)
visitXXX method corresponding to the kind of this element.SciElementVisitor type visitorpublic boolean canSetName(String name)
true if the specified name can be set for this element, false otherwisepublic boolean canSetProperty(int property, boolean value)
SciProperty interface for a predefined kinds of properties.true if the value can be assigned to the property, false otherwisepublic String getDeclarationText()
SciMember
representing this Java operation:
/**
* @author TogetherSoft Corporation
*/
public void someOperation(String str){
System.out.println(str);
}
this method will return "public void someOperation(String str)".public String getName()
public String getQualifiedName()
SciClass the qualified name is a fully qualified name of this class.
For SciMembers this method returns a string written in Together's internal format.
To obtain a normal string with the member's qualified name, method
SciLanguageHelper.convertMemberQualifiedNameToPresentableForm
can be used.
public SciTagList getTagList()
SciTagList object containing all SciTags for this element.SciTagList object containing all SciTags for this elementpublic String getUniqueName()
public boolean hasProperty(int property)
true if it has,
false otherwise.SciProperty interface for a predefined kinds of properties.true if this element has the specified property, false otherwise.
For example, suppose we have SciClass. SciClass might represent either a
class or an interface. Here is how we can distinguish them:
if (someSciClass.hasProperty(SciProperty.INTERFACE)){
... // it is an interface
} else {
... // it is a class
}
Another example: suppose you have SciOperation and you need to know if it is a
public abstract operation:
if (someSciOperation.hasProperty(SciProperty.PUBLIC) && someSciOperation.hasProperty(SciProperty.ABSTRACT)){
... // it is an public abstract operation
} else {
... // it is something else, not public abstract
}
public boolean isDeleted()
SciElement represents existing model's data. For example, if you have gotten
an SciElement representing an operation, and after that (while your script or pattern was
passive) the user deleted this operation in the text editor (or your script deleted SciObject
representing this operation via SciObject.delete method, or the user just
closed the project), then your SciElement
will refer to a non-existing element.
If you try to use methods of a deleted SciElement, the result is unpredictable
(you might get a NullPointerException etc.). You should always check whether
SciElement is
deleted, if you are not sure in it:
if (!mySciElement.isDeleted()) {
return mySciElement.getPositions();
}
The only exception is methods equals and hashCode which can be performed
on deleted elements as well.
true if this SciElement represents a non-existing model's element,
and cannot be used any longer, false otherwisepublic boolean isPropertyReadable(int property)
SciProperty interface for a predefined kinds of properties.true if the property is readable, false otherwisepublic boolean isPropertyWritable(int property)
SciProperty interface for a predefined kinds of properties.true if the property is writable, false otherwisepublic void setName(String name)
public void setProperty(int property, boolean value)
SciProperty interface for a predefined kinds of properties.
For example, if you have SciOperation representing a public operation and you would like
to make it private:
if (someSciOperation.canSetProperty(SciProperty.PRIVATE, true)){
someSciOperation.setProperty(SciProperty.PRIVATE, true); //do it
}
public void visitReferences(SciReferenceVisitor visitor)
SciReferenceVisitor which will perform certain actions
upon all references in this elementpublic void visitReferences(SciReferenceVisitor visitor, SciElement referencedElement)
SciReferenceVisitor which will perform certain actions
upon all references to the specified elementSciElement, references to which are subject for the actions
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||