Aufräumen

This commit is contained in:
JanUlrich 2016-12-15 17:02:39 +01:00
parent a35bcd490b
commit e84d6373c7
3 changed files with 24 additions and 28 deletions

View File

@ -4,7 +4,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.*;
import java.util.stream.Stream;
@ -18,16 +18,10 @@ import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ByteCodeResult;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.UnifyConstraintsSet;
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
@ -512,6 +506,11 @@ public class SourceFile extends SyntaxTreeNode
return 0;
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException();
}
@Override
public int getVariableLength() {
// TODO Auto-generated method stub

View File

@ -14,7 +14,6 @@ import de.dhbwstuttgart.syntaxtree.modifier.Public;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Statement;
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.typeinference.Menge;

View File

@ -79,13 +79,13 @@ public class RefType extends SyntaxTreeNode
return false;
if(parameter==null || parameter.size()==0){
ret &= (((RefType)obj).get_ParaList()==null || ((RefType)obj).get_ParaList().size()==0);
ret &= (((RefType)obj).getParaList()==null || ((RefType)obj).getParaList().size()==0);
}
else{
if(((RefType)obj).get_ParaList()==null){
if(((RefType)obj).getParaList()==null){
ret = false;
}
else if(parameter.size() != ((RefType)obj).get_ParaList().size())
else if(parameter.size() != ((RefType)obj).getParaList().size())
{
ret = false;
}
@ -93,7 +93,7 @@ public class RefType extends SyntaxTreeNode
{
for(int i = 0; i<parameter.size(); i++)
{
ret &= parameter.get(i).equals(((RefType)obj).get_ParaList().get(i));
ret &= parameter.get(i).equals(((RefType)obj).getParaList().get(i));
}
}
}
@ -106,22 +106,20 @@ public class RefType extends SyntaxTreeNode
public RefType clone()
{
if(this.get_ParaList() != null )
if(this.getParaList() != null )
{
List para = this.get_ParaList();
Menge<Type> clonepara = new Menge<Type>();
List para = this.getParaList();
List<RefType> clonepara = new ArrayList<>();
for(int i = 0; i< para.size(); i++)
{
clonepara.addElement(((Type)para.get(i)).clone());
clonepara.add(((RefType)para.get(i)).clone());
}
RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset());
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
RefType newRefType=new RefType(this.getName(), clonepara, getOffset());
newRefType.IsArray = this.IsArray;
return newRefType;
}
else {
RefType newRefType = new RefType(this.getTypeName(),getOffset());
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
RefType newRefType = new RefType(this.getName(),getOffset());
newRefType.IsArray = this.IsArray;
return newRefType;
}
@ -169,31 +167,31 @@ public class RefType extends SyntaxTreeNode
return ret;
}
public Menge<TypePlaceholder> getUnresolvedTPH(ResultSet resultSet) {
Menge<TypePlaceholder> ret = super.getUnresolvedTPH(resultSet);
public List<TypePlaceholder> getUnresolvedTPH(ResultSet resultSet) {
List<TypePlaceholder> ret = new ArrayList<>(); //super.getUnresolvedTPH(resultSet);
ret.addAll(this.printJavaCode(resultSet).getUnresolvedTPH());
return ret;
}
public List<TypePlaceholder> getInvolvedTypePlaceholder() {
Menge<TypePlaceholder> ret = super.getInvolvedTypePlaceholder();
List<TypePlaceholder> ret = new ArrayList<>(); //super.getInvolvedTypePlaceholder();
if(this.parameter == null)return ret;
for(Type param : this.parameter){
for(RefType param : this.parameter){
ret.addAll(param.getInvolvedTypePlaceholder());
}
return ret;
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = super.getChildren();
public List<SyntaxTreeNode> getChildren() {
List<SyntaxTreeNode> ret = new ArrayList<>(); //super.getChildren();
ret.addAll(this.getParaList());
return ret;
}
public org.apache.bcel.generic.Type getBytecodeType(ClassGenerator cg, TypeinferenceResultSet rs) {
org.apache.bcel.generic.ObjectType ret = new org.apache.bcel.generic.ObjectType(getCombinedType(cg, rs));
if(this.IsArray()){
if(this.IsArray){
//Hier wird einfachhalber von einer Dimension ausgegangen. Arrays sind im Bytecode nur für main-Methode relevant
return new org.apache.bcel.generic.ArrayType(ret, 1);
}else{