Extend constructor of SourceFile.

This commit is contained in:
Jakob Herrmann 2017-01-11 16:42:02 +01:00
parent 647196bf16
commit e4e98797fc
3 changed files with 53 additions and 35 deletions

View File

@ -33,4 +33,10 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith
public void setClassName(JavaClassName name){
this.name = name;
}
// Sets interface "switch".
public void setInterface(Boolean isInterface){
this.isInterface = isInterface;
}
}

View File

@ -5,10 +5,7 @@ import java.util.*;
import de.dhbwstuttgart.typecheck.JavaClassName;
public class SourceFile extends SyntaxTreeNode
{
public class SourceFile extends SyntaxTreeNode{
private String pkgName;
public List<ClassOrInterface> KlassenVektor = new ArrayList<>();
@ -18,10 +15,25 @@ public class SourceFile extends SyntaxTreeNode
* Die SourceFile repräsntiert eine zu einem Syntaxbaum eingelesene Java-Datei.
* SourceFile stellt dabei den Wurzelknoten des Syntaxbaumes dar.
*/
public SourceFile(List<ClassOrInterface> classDefinitions) {
public SourceFile(String pkgName,List<ClassOrInterface> classDefinitions,List<JavaClassName> imports){
this.KlassenVektor = classDefinitions;
if(pkgName != null){
this.pkgName = pkgName;
}
if(imports != null){
this.imports = imports;
}
}
public SourceFile(List<ClassOrInterface> classDefinitions){
this(null, classDefinitions, null);
}
public SourceFile(String pkgName, List<ClassOrInterface> classDefinitions){
this(pkgName, classDefinitions, null);
}
public SourceFile(List<ClassOrInterface> classDefinitions, List<JavaClassName> imports){
this(null, classDefinitions, imports);
}
}
// ino.end