forked from JavaTX/JavaCompilerCore
73 lines
1.5 KiB
Java
73 lines
1.5 KiB
Java
package de.dhbwstuttgart.syntaxtree;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.ListIterator;
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
|
|
import de.dhbwstuttgart.parser.GenericVarDeclarationList;
|
|
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
|
|
|
|
|
/**
|
|
* Stellt eine Deklarations-Liste von Generischen Variablen dar.
|
|
* Kann vor Methoden und Klassen auftauchen. (<....>)
|
|
* @author janulrich
|
|
*
|
|
*/
|
|
public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<GenericTypeVar>{
|
|
|
|
private int offsetOfLastElement;
|
|
private Menge<GenericTypeVar> gtvs = new Menge<>();
|
|
|
|
public GenericDeclarationList(Menge<GenericTypeVar> values, int endOffset) {
|
|
this.addAll(values);
|
|
this.offsetOfLastElement = endOffset;
|
|
}
|
|
|
|
private void addAll(Menge<GenericTypeVar> values) {
|
|
this.gtvs.addAll(values);
|
|
}
|
|
|
|
public int getEndOffset(){
|
|
return offsetOfLastElement;
|
|
}
|
|
|
|
@Override
|
|
public int getOffset() {
|
|
return getEndOffset();
|
|
}
|
|
|
|
@Override
|
|
public int getVariableLength() {
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public Iterator<GenericTypeVar> iterator() {
|
|
return this.gtvs.iterator();
|
|
}
|
|
|
|
@Override
|
|
public Menge<SyntaxTreeNode> getChildren() {
|
|
Menge<SyntaxTreeNode> ret = new Menge<>();
|
|
for(GenericTypeVar gtv : gtvs){
|
|
ret.add(gtv);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public int size() {
|
|
return gtvs.size();
|
|
}
|
|
|
|
public Menge<GenericTypeVar> getMenge() {
|
|
return this.gtvs;
|
|
}
|
|
|
|
public void add(GenericTypeVar t) {
|
|
this.gtvs.add(t);
|
|
}
|
|
}
|