| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
SciModel contains a set of starting-point methods for working with the
SCI model.
SCI model's data is stored in special data containers - packages. A package can have other packages called subpackages. The model can have several upper-level packages called root packages.
The model can be obtained via SciModelAccess.getModel() method:
SciModel model = SciModelAccess.getModel();
The model's root packages can be obtained using the rootPackages(String) method:
SciPackageEnumeration roots = model.rootPackages(SciModelPart.MODEL);
while (roots.hasMoreElements()){
SciPackage nextRoot = roots.nextSciPackage();
myCoolMethodThatProcessesAPackage(nextRoot);
}
Once working with a package, the information can be extracted from it in as either files, classes or subpackages:
SciPackageEnumeration roots = model.rootPackages(SciModelPart.MODEL);
while (roots.hasMoreElements()){
SciPackage nextRoot = roots.nextSciPackage();
SciClassEnumeration classes = nextRoot.classes();
while (classes.hasMoreElements()){
SciClass nextClass = classes.nextSciClass();
myCoolMethodThatProcessesAClass(nextClass);
}
}
SciModel interface also provides an access to the powerful language-dependent auxiliary tools
such as SciFactory, SciPatternManager, and SciLanguageHelper.
These interfaces allow to work with a model in a language-independent manner, that means that you
can create default classes, check a validity of an identifier etc., using the same methods for all supported
languages.
Class SciUtil contains useful methods for finding a member by the signature or by other method used as a template.
| Method Summary | |
SciClass | findClass(String language, String qualifiedName)Finds a class/interface by its qualified name. |
SciElement | findElement(String uniqueName)Finds an element by its unique name. |
SciFile | findFile(String qualifiedName)Finds a file by its qualified name. |
SciMember | findMember(String language, String qualifiedName)Finds a member by its qualified name. |
SciPackage | findPackage(String qualifiedName, String modelPart)Finds a package by its qualified name. |
void | formatFile(SciFile sciFile) |
SciFactory | getFactory(String language)Returns SciFactory object for the specified language. |
SciGenericFactory | getGenericFactory(String language)Returns SciGenericFactory object for the specified language. |
SciLanguageHelper | getLanguageHelper(String language)Returns SciLangugeHelper object for the specified language. |
SciPatternManager | getPatternManager()Returns SciPatternManger object. |
StringEnumeration | languages()Returns an enumeration of string with the names of languages being used in this model. |
SciPackageEnumeration | rootPackages(String modelPart)Returns an enumeration of the root packages of the specific kind. |
| Method Detail |
public SciClass findClass(String language, String qualifiedName)
SciLanguage interface.SciClass by its qualified name, or null if there is no such classpublic SciElement findElement(String uniqueName)
null if there is no such elementpublic SciFile findFile(String qualifiedName)
null if there is no such filepublic SciMember findMember(String language, String qualifiedName)
SciLanguage interface.null if there is no such memberpublic SciPackage findPackage(String qualifiedName, String modelPart)
SciModelPart.MODEL,
SciModelPart.IMPORT or SciModelPart.COMPONENT.null if there is no such packagepublic void formatFile(SciFile sciFile)
public SciFactory getFactory(String language)
SciFactory object for the specified language. This object allows to create
various types of model's elements - classes, operations, attributes etc.SciLanguage interface.SciFactory object for the specified languagepublic SciGenericFactory getGenericFactory(String language)
SciGenericFactory object for the specified language.SciLanguage interface.SciGenericFactory object for the specified languagepublic SciLanguageHelper getLanguageHelper(String language)
SciLangugeHelper object for the specified language. This object allows to check
a validity of an identifier, and other language-dependent checks.SciLanguage interface.SciLangugeHelper object for the specified languagepublic SciPatternManager getPatternManager()
SciPatternManger object. This object provides an
access to Together patterns.SciPatternManger objectpublic StringEnumeration languages()
public SciPackageEnumeration rootPackages(String modelPart)
rootPackages(SciModelPart.MODEL) returns an enumeration of the model's root packages.
These are packages composing the model itself, they contain its data (they are specified in the
"Project Paths" tab in the project properties dialog (Advanced mode)).
Normally you would use the method only with SciModelPart.MODEL parameter when working
with the model.
rootPackages(SciModelPart.IMPORT) returns an enumeration of the model's imported root packages.
These are packages specified in the "Search/Classpath" tab in the project properties dialog (Advanced mode)).
rootPackages(SciModelPart.COMPONENT) returns an enumeration of the components' root packages.
Components can be added to the project by checking the "Include Components" checkbox in the project properties dialog.
Note that components' packages are considered imported packages as well and they will be included in
the enumeration of packages returned by rootPackages(SciModelPart.IMPORT) call.
SciModel model = SciModelAccess.getModel();
SciPackageEnumeration roots = model.rootPackages(SciModelPart.MODEL);
while (roots.hasMoreElements()){
SciPackage nextRoot = roots.nextSciPackage();
myCoolMethodThatProcessesAPackage(nextRoot);
}SciModelPart.MODEL,
SciModelPart.IMPORT or SciModelPart.COMPONENT
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||