com.togethersoft.openapi.sci
Interface SciLanguageHelper

All Known Subinterfaces:
SciJavaHelper

public interface SciLanguageHelper

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

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

Method Summary
 SciFileEnumerationallFiles(SciClass sciClass)
           Provides access to all files containing declaration and definitions of class and its members.
 SciFileEnumerationallFiles(SciMember sciMember)
           Provides access to all files containing member declaration and definition.
 StringconvertMemberQualifiedNameToPresentableForm(String qName)
           Converts the member's qualified name from Together's internal format to the normal string like "Hashtable.containsKey".
 StringconvertMemberSignatureToPresentableForm(String signature, SciClass containingClass)
           Converts the member's signature string from Together's internal format to the normal string like "name(parameterType1, parameterType2, ...
 StringgetDefaultConstantOfType(String type)
           Provides language dependent constant value for 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 name of member being pasted to given class.
 booleanisPrimitiveType(SciType type)
           Checks whethers the specified type is simple type.
 booleanisPrimitiveType(String type)
           
 booleanisValidIdentifier(String name)
           Checks whethers the specified name is a valid indentifier for the languge of this SciLanguageHelper
 SciTypemakePointerType(SciType type)
           Creates new SciType which represents pointer to specified type (if supported by language).
 SciTypemakeReferenceType(SciType type)
           Creates new SciType which represents reference to specified type (if supported by 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 declaration and definitions of class and its members.
Returns: enumeration of SciFiles related to specified class

allFiles

public SciFileEnumeration allFiles(SciMember sciMember)
Provides access to all files containing member declaration and definition.
Returns: enumeration of SciFiles related to specified member

convertMemberQualifiedNameToPresentableForm

public String convertMemberQualifiedNameToPresentableForm(String qName)
Converts the member's qualified name from Together's internal format to the normal string like "Hashtable.containsKey". For example, for 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 the normal string like "name(parameterType1, parameterType2, ... )". For example, for 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

getDefaultConstantOfType

public String getDefaultConstantOfType(String type)
Provides language dependent constant value for 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.

getDefaultObjectText

public String getDefaultObjectText(String key)
Reserved. Not implemented yet.

getPresentableLanguageName

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

getProperty

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

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 name of member being pasted to 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 pasted to given class.

isPrimitiveType

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

isPrimitiveType

public boolean isPrimitiveType(String type)

isValidIdentifier

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

makePointerType

public SciType makePointerType(SciType type)
Creates new SciType which represents pointer to specified type (if supported by language). For example, if specified type is "int" new type "int*" will be created for C++ but 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 passed SciType instance.

makeReferenceType

public SciType makeReferenceType(SciType type)
Creates new SciType which represents reference to specified type (if supported by language). For example, if specified type is "int" new type "int&" will be created for C++ but 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 passed SciType instance.

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.