package de.dhbwstuttgart.syntaxtree; import java.util.*; import de.dhbwstuttgart.parser.NullToken; import de.dhbwstuttgart.parser.antlr.Java8Parser; import de.dhbwstuttgart.typecheck.JavaClassName; import de.dhbwstuttgart.typeinference.ConstraintSet; import de.dhbwstuttgart.typeinference.Pair; import de.dhbwstuttgart.typeinference.TypeInferenceInformation; public class SourceFile extends SyntaxTreeNode{ private String pkgName; public List KlassenVektor = new ArrayList<>(); private List imports; /** * Die SourceFile repräsntiert eine zu einem Syntaxbaum eingelesene Java-Datei. * SourceFile stellt dabei den Wurzelknoten des Syntaxbaumes dar. */ public SourceFile(String pkgName,List classDefinitions,List imports){ super(new NullToken()); this.KlassenVektor = classDefinitions; if(pkgName != null){ this.pkgName = pkgName; } if(imports != null){ this.imports = imports; } } public SourceFile(List classDefinitions){ this(null, classDefinitions, null); } public SourceFile(String pkgName, List classDefinitions){ this(pkgName, classDefinitions, null); } public SourceFile(List classDefinitions, List imports){ this(null, classDefinitions, imports); } public String getPkgName(){ return this.pkgName; } // Get imports (to test implementation) public List getImports(){ return this.imports; } public ConstraintSet getConstraints(TypeInferenceInformation info){ ConstraintSet ret = new ConstraintSet(); for(ClassOrInterface cl : this.KlassenVektor){ ret.addAll(cl.getConstraints(info)); } return ret; } }