JavaCompilerCore/src/mycompiler/myclass/ClassHelper.java
2013-10-18 13:33:46 +02:00

59 lines
1.8 KiB
Java
Executable File

// ino.module.ClassHelper.8555.package
package mycompiler.myclass;
// ino.end
// ino.module.ClassHelper.8555.import
import java.util.Vector;
import mycompiler.mytype.GenericTypeVar;
import mycompiler.mytype.RefType;
import mycompiler.mytype.Type;
// ino.end
// ino.class.ClassHelper.23206.declaration
public class ClassHelper
// ino.end
// ino.class.ClassHelper.23206.body
{
// ino.method.findGenericType.23209.defdescription type=javadoc
/**
* HOTI
* Diese Methode sucht in der Klassendefinition nach einen GTV, die
* so heißt wie die im RefType definierte Variable. Wenn sie diese gefunden
* hat, wird sie zurückgeben. Wenn dies nicht der Fall war, schaut sie, falls
* angegeben in den Methodenparametern nach. Findet sie dort auch nichts, liefert
* die Methode <b>null</b>.
* @param type
* @return
*/
// ino.end
// ino.method.findGenericType.23209.definition
public static GenericTypeVar findGenericType(Type type, Vector<Type> paralist, Vector<GenericTypeVar> methodParaList)
// ino.end
// ino.method.findGenericType.23209.body
{
if(!(type instanceof RefType)){
return null;
}
for(int i=0;i<paralist.size();i++){
if(paralist.get(i) instanceof GenericTypeVar){
GenericTypeVar gtv=(GenericTypeVar)paralist.get(i);
if(gtv.getName().equals(type.getName())){
return gtv;
}
}
}
if(methodParaList!=null){
for(int i=0;i<methodParaList.size();i++){
GenericTypeVar gtv=methodParaList.elementAt(i);
if(gtv.getName().equals(type.getName())){
return gtv;
}
}
}
return(null);
}
// ino.end
}
// ino.end