com.togethersoft.openapi.sci
Interface SciPackage


public interface SciPackage
extends SciContainer, SciObject

A container of source code files (for the Java language, it represents a Java package).
SciPackage interface provides a set of methods for accessing the information about files, classes,
and subpackages contained in this package.


It is possible to get a package's content as an enumeration of files, classes, or subpackages using
files, classes, or subpackages methods respectively:



SciModel model = SciModelAccess.getModel();
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);
}
}


Each package has a string called qualified name.
Qualified name is language-specific. It contains the full name of this package in a valid systax
construction for the programming language.
For example, the qualified name for a java package will look like a standard Java language
package name: "com.togethersoft.openapi.sci.enum".


Note that you can find a package by its qualified name. For example:


SciPackage justFoundPackage = model.findPackage("com.togethersoft.openapi.sci.enum", SciModelPart.MODEL);



Note that the classes method returns an enumeration of upper-level classes only without their
inner classes. For accessing the information about inner classes of an upper-level class,
the innerClasses method should be used.

Author:
TogetherSoft
Since: Together 3.0
See Also: files(), classes(), SciClass.innerClasses(), subpackages()

Method Summary
 booleancanSetName(String name)
          Checks whether the specified name can be set as the name for this package.
 SciClassEnumerationclasses()
          Returns an enumeration of upper-level classes in this package.
 SciFileEnumerationfiles()
          Returns an enumeration of all files in this package.
 StringgetModelPart()
          Returns a string representing the kind of package.
 StringgetName()
          Returns the string with the name of this package.
 SciPackagegetParentPackage()
          Returns the package this package belongs to.
 StringgetQualifiedName()
          Returns the fully-qualified name which uniquely identifies this package.
 voidsetName(String name)
          Sets the name for this package.
 SciPackageEnumerationsubpackages()
          Returns an enumeration of subpackages in this package.

Methods inherited from interface com.togethersoft.openapi.sci.SciContainer
canPaste, objects, paste

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

canSetName

public boolean canSetName(String name)
Checks whether the specified name can be set as the name for this package. Returns true if
it can be done, false otherwise.
Parameters:
name the string with the name which needs to be set for this package
Returns: true if the name can be set as a name for this package,
false otherwise

classes

public SciClassEnumeration classes()
Returns an enumeration of upper-level classes in this package. For accessing the information
about inner classes of an upper-level one, the innerClasses method should be used.
Returns: an enumeration of upper-level classes in this package
See Also:
SciClass.innerClasses()

files

public SciFileEnumeration files()
Returns an enumeration of all files in this package.
Returns: an enumeration of all files in this package

getModelPart

public String getModelPart()
Returns a string representing the kind of package. For an explanation, see the description of
SciModelPart interface.


The returned value can be:

Returns: a string representing the kind of package.

getName

public String getName()
Returns the string with the name of this package. The getQualifiedName method returns the
fully-qualified name which uniquely identifies this package.
Returns: the string with the name of this package
See Also:
getQualifiedName()

getParentPackage

public SciPackage getParentPackage()
Returns the package this package belongs to. For root packages returns null.
Returns: the package this package belongs to

getQualifiedName

public String getQualifiedName()
Returns the fully-qualified name which uniquely identifies this package.
Returns: the fully-qualified name which uniquely identifies this package

setName

public void setName(String name)
Sets the name for this package.
Parameters:
name the string with the name for this package

subpackages

public SciPackageEnumeration subpackages()
Returns an enumeration of subpackages in this package.
Returns: an enumeration of subpackages in this package