Methods Summary |
---|
private void | createLanguageToIdlTable()
languageToIdlTable = new Hashtable();
if (getLanguage().equals(UMLElement.CPP)) {
for (int i = 0; i < (cppToIdlTypes.length); i++) {
languageToIdlTable.put(cppToIdlTypes[i][0], cppToIdlTypes[i][1]);
}
}
if (getLanguage().equals(UMLElement.JAVA)) {
for (int i = 0; i < (javaToIdlTypes.length); i++) {
languageToIdlTable.put(javaToIdlTypes[i][0], javaToIdlTypes[i][1]);
}
}
|
public java.lang.String | getConvertedType(java.lang.String type)Is to receive converted type to idlType
String myType = null;
if (getLanguage().equals(UMLElement.CPP)) {
myType = getCppType(type.trim());
}
else {
if (getLanguage().equals(UMLElement.JAVA)) {
myType = getJavaType(type.trim());
}
}
if (myType != null && languageToIdlTable.containsKey(myType)) {
return (String)languageToIdlTable.get(myType);
}
// if unable convert, it's prolly a referenced type
return null;
|
public java.lang.String | getCppType(java.lang.String type)Check for Standard cpp type. It may be : MPoint int - then return int!!!
//check at next type such : < scope_name > <Standard type>
int pointer;
for (int i = 0; i < cppTypes.length; i++) {
pointer = -1;
if (type.length() > cppTypes[i].length()) {
pointer = type.indexOf(" " + cppTypes[i]);
if (pointer == -1) {
pointer = type.indexOf(cppTypes[i] + " ");
}
}
if (type.equals(cppTypes[i]) || pointer != -1) {
return cppTypes[i]; // ex: "LALA unsigned char"
}
}
return null;
|
public java.lang.String | getJavaType(java.lang.String type)Check for Standard Java type. It may be : MPoint int - then return int!!!
//check at next type such : < scope_name > <Standard type>
int pointer;
for (int i = 0; i < javaTypes.length; i++) {
pointer = -1;
if (type.length() > javaTypes[i].length()) {
pointer = type.indexOf(" " + javaTypes[i]);
if (pointer == -1) {
pointer = type.indexOf(javaTypes[i] + " ");
}
}
if (type.equals(javaTypes[i]) || pointer != -1) {
return javaTypes[i]; // ex: "KAKA unsigned char"
}
}
return null;
|
public java.lang.String | getLanguage()
return myLanguage;
|
public java.lang.String | getStandardIdlType(java.lang.String atype)Check for Standard idl type. Is return substring of given type( all decl ) if it's Standard type.
Ex: int d, f, t => int NOTE : don't used now... only for deep parsing of the tags
final String type = atype.trim();
final int typeLength = type.length();
//check at next type such : < scope_name > <Standard type>
for (int i = 0; i < idlTypes.length; i++) {
if (idlTypes[i].equals(type)) {
return type;
}
}
// check for sequence , fixed.
if (type.startsWith("sequence") || type.startsWith("fixed")) {
int counter = 0;
for (int i = 4; i < typeLength; i++) {
if (type.charAt(i) == '<") {
counter++;
}
if (type.charAt(i) == '>") {
counter--;
if (counter == 0) {
return type.substring(0, i + 1);
}
}
}
}
// check for string or wstring
if (type.startsWith(IdlType.STRING) || type.startsWith(IdlType.WSTRING)) {
String idlType = "";
if (type.startsWith("w")) {
idlType = type.substring(7, typeLength).trim();
}
else {
idlType = type.substring(6, typeLength).trim();
}
if (!idlType.startsWith("<")) {
return type;
}
else {
// " string<20>"
int counter = 0;
for (int i = 6; i < typeLength; i++) {
if (type.charAt(i) == '<") {
counter++;
}
if (type.charAt(i) == '>") {
counter--;
if (counter == 0) {
return type.substring(0, i + 1);
}
}
}
}
}
return null;
|
public void | setLanguage(java.lang.String lang)
myLanguage = lang;
|