Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

### 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.
  - `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.
  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

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD