com.togethersoft.openapi.sci
Interface SciModel


public interface SciModel

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.

Author:
TogetherSoft
See Also: SciModelAccess, SciFactory, SciPatternManager, SciLanguageHelper

Method Summary
 SciClassfindClass(String language, String qualifiedName)
           Finds a class/interface by its qualified name.
 SciElementfindElement(String uniqueName)
           Finds an element by its unique name.
 SciFilefindFile(String qualifiedName)
           Finds a file by its qualified name.
 SciMemberfindMember(String language, String qualifiedName)
           Finds a member by its qualified name.
 SciPackagefindPackage(String qualifiedName, String modelPart)
           Finds a package by its qualified name.
 voidformatFile(SciFile sciFile)
           
 SciFactorygetFactory(String language)
           Returns SciFactory object for the specified language.
 SciGenericFactorygetGenericFactory(String language)
           Returns SciGenericFactory object for the specified language.
 SciLanguageHelpergetLanguageHelper(String language)
           Returns SciLangugeHelper object for the specified language.
 SciPatternManagergetPatternManager()
           Returns SciPatternManger object.
 StringEnumerationlanguages()
           Returns an enumeration of string with the names of languages being used in this model.
 SciPackageEnumerationrootPackages(String modelPart)
           Returns an enumeration of the root packages of the specific kind.

Method Detail

findClass

public SciClass findClass(String language, String qualifiedName)
Finds a class/interface by its qualified name.
Parameters:
language - The string with the name of the source code language. The predefined language names are in SciLanguage interface.
qualifiedName - the string with the qualified name of the class/interface which needs to be found
Returns: a SciClass by its qualified name, or null if there is no such class
See Also:
SciLanguage

findElement

public SciElement findElement(String uniqueName)
Finds an element by its unique name.
Parameters:
uniqueName - the string with the unique name of an element which needs to be found
Returns: an element by its unique name, or null if there is no such element

findFile

public SciFile findFile(String qualifiedName)
Finds a file by its qualified name.
Parameters:
qualifiedName - the string with the qualified name of a file which needs to be found
Returns: a file by its qualified name, or null if there is no such file

findMember

public SciMember findMember(String language, String qualifiedName)
Finds a member by its qualified name.
Parameters:
language - The string with the name of the source code language. The predefined language names are in SciLanguage interface.
qualifiedName - the string with the qualified name of a member which needs to be found
Returns: a member by its qualified name, or null if there is no such member
See Also:
SciLanguage

findPackage

public SciPackage findPackage(String qualifiedName, String modelPart)
Finds a package by its qualified name.
Parameters:
qualifiedName - the string with the qualified name of a package which needs to be found
modelPart - The string with the kind of a package to be found. Can be either SciModelPart.MODEL, SciModelPart.IMPORT or SciModelPart.COMPONENT.
Returns: a package by its qualified name, or null if there is no such package
See Also:
SciModelPart

formatFile

public void formatFile(SciFile sciFile)

getFactory

public SciFactory getFactory(String language)
Returns SciFactory object for the specified language. This object allows to create various types of model's elements - classes, operations, attributes etc.
Parameters:
language - The string with the name of the source code language. The predefined language names are in SciLanguage interface.
Returns: SciFactory object for the specified language
See Also:
SciLanguage, SciFactory

getGenericFactory

public SciGenericFactory getGenericFactory(String language)
Returns SciGenericFactory object for the specified language.
Parameters:
language - The string with the name of the source code language. The predefined language names are in SciLanguage interface.
Returns: SciGenericFactory object for the specified language
See Also:
SciLanguage, SciGenericFactory

getLanguageHelper

public SciLanguageHelper getLanguageHelper(String language)
Returns SciLangugeHelper object for the specified language. This object allows to check a validity of an identifier, and other language-dependent checks.
Parameters:
language - The string with the name of the source code language. The predefined language names are in SciLanguage interface.
Returns: SciLangugeHelper object for the specified language
See Also:
SciLanguage

getPatternManager

public SciPatternManager getPatternManager()
Returns SciPatternManger object. This object provides an access to Together patterns.
Returns: SciPatternManger object
See Also:
SciPatternManager

languages

public StringEnumeration languages()
Returns an enumeration of string with the names of languages being used in this model.
Returns: an enumeration of string with the names of languages being used in this model
See Also:
StringEnumeration, SciLanguage

rootPackages

public SciPackageEnumeration rootPackages(String modelPart)
Returns an enumeration of the root packages of the specific kind. For example:
 SciModel model = SciModelAccess.getModel();
 SciPackageEnumeration roots = model.rootPackages(SciModelPart.MODEL);
 while (roots.hasMoreElements()){
   SciPackage nextRoot = roots.nextSciPackage();
   myCoolMethodThatProcessesAPackage(nextRoot);
 }
Parameters:
modelPart - the string whose value can be either SciModelPart.MODEL, SciModelPart.IMPORT or SciModelPart.COMPONENT
Returns: an enumeration of the root packages
See Also:
SciModelPart, SciPackage