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 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);
}


While working
with a package, the information can be extracted from it in 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 access to powerful language-dependent auxiliary tools
such as SciFactory, SciPatternManager, and SciLanguageHelper.
These interfaces enable you to work with a model in a language-independent manner, which means that you
can create default classes, check the validity of an identifier, and so on, using the same methods for all supported
languages.


The class SciUtil contains useful methods for finding a member by the
signature or by another method used as a template.

Author:
TogetherSoft
Since: Together 3.0
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)
          Deprecated. Method findPackage(String, String) should be used instead.
 SciPackagefindPackage(String qualifiedName, String modelPart)
          Finds a package by its qualified name.
 SciPackagefindPackageToPasteFile(String absoluteURL)
          Tries to find an existing SciPackage where a new file with a given absolute URL
can be pasted according to project structure and "writeable for" properties of project roots.
 voidformatFile(SciFile sciFile)
           
 SciPackagegetDefaultRootPackage()
          Deprecated. Method rootPackages(String, String) should be used instead.
 SciFactorygetFactory(String language)
          Returns SciFactory object for the specified language.
 SciGenericFactorygetGenericFactory(String language)
          Returns SciGenericFactory object for the specified language.
 SciLanguageHelpergetLanguageHelper(String language)
          Returns SciLanguageHelper object for the specified language.
 SciPatternManagergetPatternManager()
          Returns SciPatternManager object.
 booleanisLanguageSupported(String language)
          Checks whether a given language is supported in the current runtime configuration.
 StringEnumerationlanguages()
          Returns an enumeration of the string with the names of languages being used in this model.
 SciPackageEnumerationrootPackages()
          Deprecated. Method rootPackages(String) should be used instead.
 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)
Deprecated.
Method findPackage(String, String) should be used instead.
See Also:
findPackage(java.lang.String,java.lang.String)

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 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

findPackageToPasteFile

public SciPackage findPackageToPasteFile(String absoluteURL)
Tries to find an existing SciPackage where a new file with a given absolute URL
can be pasted according to project structure and "writeable for" properties of project roots.
This operation can be helpful when it is necessary to place some source element
(for example, a definition of a c++ operation) into the new file with a certain URL.
Steps to get it done could be as follows: create a new file with factory,
set its short name according to given URL, find target SciPackage by
call to this operation, paste file into package, paste source element to file.
Parameters:
absoluteURL The absolute URL of file to be created in the project
Returns: SciPackage object if an appropriate one is found, or null otherwise.
Since:
Together 5.0
See Also:
SciFile, SciPackage, SciFactory.newFile()

formatFile

public void formatFile(SciFile sciFile)
Since:
Together 3.1

getDefaultRootPackage

public SciPackage getDefaultRootPackage()
Deprecated.
Method rootPackages(String, String) should be used instead.
See Also:
rootPackages(java.lang.String)

getFactory

public SciFactory getFactory(String language)
Returns SciFactory object for the specified language. This object allows to create
various types of model elements - classes, operations, attributes, and so on.
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 SciLanguageHelper object for the specified language. This object enables you to check
the 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: SciLanguageHelper object for the specified language
See Also:
SciLanguage

getPatternManager

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

isLanguageSupported

public boolean isLanguageSupported(String language)
Checks whether a given language is supported in the current runtime configuration.
A particular language might not be supported because of configuration settings
(languages.config) or license restrictons.
Parameters:
language The string with the name of the source code language. The predefined
language names are in SciLanguage interface.
Returns: true if the language is supported, false otherwise
Since:
Together 6.0
See Also:
languages(), SciLanguage

languages

public StringEnumeration languages()
Returns an enumeration of the string with the names of languages being used in this model.
The predefined language names are in SciLanguage interface.
Returns: an enumeration of the string with the names of languages being used in this model
See Also:
StringEnumeration, SciLanguage, isLanguageSupported(java.lang.String)

rootPackages

public SciPackageEnumeration rootPackages()
Deprecated.
Method rootPackages(String) should be used instead.
See Also:
rootPackages(java.lang.String)

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