JavaPatternMatching/src/mycompiler/myclass/ClassHelper.java

60 lines
1.8 KiB
Java
Raw Normal View History

2013-10-18 11:33:46 +00:00
// 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<EFBFBD>t wie die im RefType definierte Variable. Wenn sie diese gefunden
* hat, wird sie zur<EFBFBD>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
@Deprecated
2013-10-18 11:33:46 +00:00
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