This commit is contained in:
JanUlrich 2014-04-23 14:36:26 +02:00
parent eab2c7ef93
commit db4442628b
5 changed files with 24 additions and 17 deletions

View File

@ -303,6 +303,7 @@ public class Pair
{
boolean ret = true;
ret &= (obj instanceof Pair);
if(!ret)return ret;
ret &= ((Pair)obj).TA1.equals(this.TA1);
ret &= ((Pair)obj).TA2.equals(this.TA2);
return ret;

View File

@ -174,8 +174,8 @@ public class Type implements IItemWithOffset
// ino.method.equals.26765.body
{
if(obj instanceof Type){
String name2 = ((Type)obj).name;
return getName().equals(name2);
String name2 = ((Type)obj).printJavaCode(new ResultSet()).toString();
return printJavaCode(new ResultSet()).toString().equals(name2);
}
else{
return false;

View File

@ -21,6 +21,13 @@ public class ResultSet implements Iterable<Pair> {
resultPairs = resultSet;
}
/**
* Erstellt ein leeres ResultSet
*/
public ResultSet() {
this(new Vector<Pair>());
}
public Vector<Pair> getResultSet(){
return resultPairs;
}

View File

@ -21,26 +21,18 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
protected IItemWithOffset point;
protected Type type;
protected ResultSet resultSet;
protected Vector<TypePlaceholder> generics = null;
public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet){
this(insertPoint, insertType, resultSet, null);
this.generics = this.getUnresolvedTPH();//Alle im insertType vorkommenden TPH müssen als Generics eingesetzt werden.
}
/**
* Dieser Konstruktor erstellt einen TypInsertPoint, welcher nicht nur insertType einsetzt,
* sonder auch die übergebenen generischen Variablen einsetzt.
* Dieser Konstruktor erstellt einen TypInsertPoint
* @param insertPoint
* @param insertType
* @param resultSet
* @param generics - die generischen Parameter des einzusetzenden Typs
*/
public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet, Vector<TypePlaceholder> generics){
public TypeInsertPoint(IItemWithOffset insertPoint, Type insertType, ResultSet resultSet){
this.point = insertPoint;
this.type = insertType;
this.resultSet = resultSet;
this.generics = generics;
}
/**
@ -62,7 +54,7 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
public Vector<TypePlaceholder> getUnresolvedTPH(){
Vector<TypePlaceholder> ret = new Vector<TypePlaceholder>();
ret.addAll(this.type.getUnresolvedTPH(resultSet));
ret.addAll(this.getInsertType().getUnresolvedTPH(resultSet));
return ret;
}
@ -74,12 +66,16 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
return this.getInsertNode().getOffset();
}
protected Type getInsertType(){
return this.type;
}
/**
* Die Zeichenkette die durch diesen TypeInsertPoint eingesetzt wird. (Der Typ als String)
* @return
*/
public JavaCodeResult getTypeInsertString(){
JavaCodeResult ret = type.printJavaCode(this.resultSet).attach(" ");
JavaCodeResult ret = this.getInsertType().printJavaCode(this.resultSet).attach(" ");
return ret;
}
@ -94,9 +90,9 @@ public class TypeInsertPoint implements Comparable<TypeInsertPoint>{
public boolean equals(Object obj){
if(! (obj instanceof TypeInsertPoint))return false;
TypeInsertPoint equals = (TypeInsertPoint) obj;
if(!(equals.point.equals(this.point)))return false;
if(!(equals.getInsertNode().equals(this.getInsertNode())))return false;
if(!(equals.resultSet.equals(this.resultSet)))return false;
if(!(equals.type.equals(this.type)))return false;
if(!(equals.getInsertType().equals(this.getInsertType())))return false;
return true;
}

View File

@ -56,7 +56,10 @@ public class TRMEqualTest {
resultContent.add(pair);
ResultSet resultSet = new ResultSet(resultContent);
Vector<TypeInsertPoint> tphs = tph.getTypeInsertPoints(resultSet);
TypeInsertSet toAdd = new TypeInsertSet(tphs);
TypeInsertSet toAdd = new TypeInsertSet();
for(TypeInsertPoint tip : tphs){
toAdd.add(tip);
}
System.out.println("Füge hinzu: "+toAdd);
if(!replaceSet.contains(toAdd))replaceSet.add(toAdd);
}