com.togethersoft.openapi.sci
Interface SciLanguageHelper

All Known Subinterfaces:
SciCppHelper, SciCSharpHelper, SciJavaHelper, SciNetHelper

public interface SciLanguageHelper

This interface contains useful utility language-dependent methods.
An instance of SciLanguageHelper for a specific language can be obtained using
SciModel.getLanguageHelper(String language) method.

Author:
TogetherSoft
Since: Together 3.0
See Also: SciModel.getLanguageHelper(java.lang.String)

Method Summary
 SciFileEnumerationallFiles(SciClass sciClass)
          Provides access to all files containing declarations and definitions of the class and its members.
 SciFileEnumerationallFiles(SciMember sciMember)
          Provides access to all files containing member declarations and definitions.
 StringconvertMemberQualifiedNameToPresentableForm(String qName)
          Converts the member's qualified name from Together's internal format to a normal
string like "Hashtable.containsKey".
 StringconvertMemberSignatureToPresentableForm(String signature, SciClass containingClass)
          Converts the member's signature string from Together's internal format to a normal
string like "name(parameterType1, parameterType2, ...
 SciCommentgetComment(SciObject object, boolean before)
           
 StringgetDefaultConstantOfType(String type)
          Provides a language-dependent constant value for the specified type.
 StringgetDefaultObjectText(String key)
          Reserved.
 StringgetPresentableLanguageName()
           
 StringgetProperty(SciElement element, String key)
          Provides access to language-specific properties of elements.
 StringgetShortClassName(String qualifiedName)
          Extracts a short name from the specified qualified name of a class/interface.
 StringinquirePasteName(SciClass sciClass, SciMember sciMember)
          Provides possibility to inquire about the name of the member being pasted to the given class.
 booleanisPrimitiveType(SciType type)
          Checks whether the specified type is a simple type.
 booleanisPrimitiveType(String type)
           
 booleanisValidIdentifier(String name)
          Checks whether the specified name is a valid identifier for the language of this SciLanguageHelper
 SciTypemakePointerType(SciType type)
          Creates new SciType which represents a pointer to the specified type (if supported by the language).
 SciTypemakeReferenceType(SciType type)
          Creates a new SciType which represents a reference to the specified type (if supported by the language).
 StringsetProperty(SciElement element, String key, String value)
          Provides access to language-specific properties of elements.

Method Detail

allFiles

public SciFileEnumeration allFiles(SciClass sciClass)
Provides access to all files containing declarations and definitions of the class and its members.
Returns: enumeration of SciFiles related to specified class
Since:
Together 4.1

allFiles

public SciFileEnumeration allFiles(SciMember sciMember)
Provides access to all files containing member declarations and definitions.
Returns: enumeration of SciFiles related to specified member
Since:
Together 4.1

convertMemberQualifiedNameToPresentableForm

public String convertMemberQualifiedNameToPresentableForm(String qName)
Converts the member's qualified name from Together's internal format to a normal
string like "Hashtable.containsKey". For example, for an SciOperation named mySciOper
representing this operation:


Class1 {
public myOper(String int){
return null;
}
}

the execution of


SciModel model = SciModelAccess.getModel();
SciLanguageHelper javaHelper = model.getLanguageHelper(SciLanguage.JAVA);
System.out.println(javaHelper.convertMemberQualifiedNameToPresentableForm(mySciOper.getQualifiedName()));

will produce the following output: "Class1.myOper"
Parameters:
qName the string returned by SciElement.getQualifiedName method
of the SciMember
Returns: String

convertMemberSignatureToPresentableForm

public String convertMemberSignatureToPresentableForm(String signature, SciClass containingClass)
Converts the member's signature string from Together's internal format to a normal
string like "name(parameterType1, parameterType2, ... )". For example, for an SciOperation named mySciOper
representing this operation:


Class1 {
public myOper(String int){
return null;
}
}

the execution of


SciModel model = SciModelAccess.getModel();
SciLanguageHelper javaHelper = model.getLanguageHelper(SciLanguage.JAVA);
System.out.println(javaHelper.convertMemberSignatureToPresentableForm(mySciOper.getSignature(), mySciOper.getContainingClass()));

will produce the following output: "myOper(String)"
Parameters:
signature the string returned by SciMember.getSignature method
containingClass SciClass containing the member
Returns: String

getComment

public SciComment getComment(SciObject object, boolean before)
Returns: comment near the object

getDefaultConstantOfType

public String getDefaultConstantOfType(String type)
Provides a language-dependent constant value for the specified type.
For example, "false" for boolean type in Java,
or bool type in C++); "0" for all integer types
in Java and C++; "null" for all non-primitive types in Java,
Returns: string representation of constant value for specified type.
null string if void type specified.
Since:
Together 4.0

getDefaultObjectText

public String getDefaultObjectText(String key)
Reserved. Not implemented yet.
Since:
Together 4.0

getPresentableLanguageName

public String getPresentableLanguageName()
Returns: presentable language name (for example, Java, C++, OMG IDL, etc)
Since:
Together 4.0

getProperty

public String getProperty(SciElement element, String key)
Provides access to language-specific properties of elements.
Returns: null if the element has no property with the given key, or the
property value otherwise.
Since:
Together 4.0

getShortClassName

public String getShortClassName(String qualifiedName)
Extracts a short name from the specified qualified name of a class/interface.
Parameters:
qualifiedName the fully qualified name of a class/interface
Returns: a short name of a class/interface

inquirePasteName

public String inquirePasteName(SciClass sciClass, SciMember sciMember)
Provides possibility to inquire about the name of the member being pasted to the given class.
Paste member to class can change its name in order to avoid name conflicts.
Returns: Name that will be assigned to given member when it is pasted to the given class.
Since:
Together 4.0

isPrimitiveType

public boolean isPrimitiveType(SciType type)
Checks whether the specified type is a simple type.
For example, int, char, or double in Java or C++.
Returns: true if the language is currently supported (enabled) and
the specified type is simple in terms of this language, otherwise false.
Since:
Together 4.0

isPrimitiveType

public boolean isPrimitiveType(String type)
Since:
Together 4.0

isValidIdentifier

public boolean isValidIdentifier(String name)
Checks whether the specified name is a valid identifier for the language of this SciLanguageHelper
Parameters:
name the string with the name of an identifier
Returns: true if the specified string is a valid identifier, false otherwise

makePointerType

public SciType makePointerType(SciType type)
Creates new SciType which represents a pointer to the specified type (if supported by the language).
For example, if the specified type is "int", the new type "int*" will be created for C++
but the same type will be returned for Java.
Returns: new instance of SciType that represents pointer to specified type.
If it is impossible to create one, return passes SciType instance.
Since:
Together 4.1

makeReferenceType

public SciType makeReferenceType(SciType type)
Creates a new SciType which represents a reference to the specified type (if supported by the language).
For example, if the specified type is "int", the new type "int&" will be created for C++
but the same type will be returned for Java.
Returns: new instance of SciType that represents pointer to specified type.
If it is impossible to create one, return passes SciType instance.
Since:
Together 4.1

setProperty

public String setProperty(SciElement element, String key, String value)
Provides access to language-specific properties of elements.
Pass null when it is necessary to remove a property.
Since:
Together 4.0