2014-09-02 10:33:54 +02:00
|
|
|
package de.dhbwstuttgart.syntaxtree;
|
2014-06-25 17:31:04 +02:00
|
|
|
|
2014-09-16 17:34:04 +02:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.ListIterator;
|
2015-04-22 21:40:22 +02:00
|
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
2014-06-25 17:31:04 +02:00
|
|
|
|
2014-09-02 10:33:54 +02:00
|
|
|
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
2014-06-25 17:31:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stellt eine Deklarations-Liste von Generischen Variablen dar.
|
|
|
|
* Kann vor Methoden und Klassen auftauchen. (<....>)
|
|
|
|
* @author janulrich
|
2016-12-02 01:23:01 +01:00
|
|
|
*
|
2014-06-25 17:31:04 +02:00
|
|
|
*/
|
2014-09-16 17:34:04 +02:00
|
|
|
public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<GenericTypeVar>{
|
2014-06-25 17:31:04 +02:00
|
|
|
|
2014-07-09 15:07:40 +02:00
|
|
|
private int offsetOfLastElement;
|
2016-09-13 17:32:22 +02:00
|
|
|
private List<GenericTypeVar> gtvs = new Menge<>();
|
2014-09-16 17:34:04 +02:00
|
|
|
|
2016-09-13 17:32:22 +02:00
|
|
|
public GenericDeclarationList(List<GenericTypeVar> values, int endOffset) {
|
2016-09-16 13:25:20 +02:00
|
|
|
super(endOffset);
|
2016-09-13 17:32:22 +02:00
|
|
|
gtvs = values;
|
2014-07-31 15:15:33 +02:00
|
|
|
this.offsetOfLastElement = endOffset;
|
2014-06-25 17:31:04 +02:00
|
|
|
}
|
|
|
|
|
2014-07-31 15:15:33 +02:00
|
|
|
public int getEndOffset(){
|
2014-07-09 15:07:40 +02:00
|
|
|
return offsetOfLastElement;
|
|
|
|
}
|
2014-09-16 17:34:04 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getOffset() {
|
|
|
|
return getEndOffset();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Iterator<GenericTypeVar> iterator() {
|
|
|
|
return this.gtvs.iterator();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-22 21:40:22 +02:00
|
|
|
public Menge<SyntaxTreeNode> getChildren() {
|
|
|
|
Menge<SyntaxTreeNode> ret = new Menge<>();
|
2014-09-16 17:34:04 +02:00
|
|
|
for(GenericTypeVar gtv : gtvs){
|
|
|
|
ret.add(gtv);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int size() {
|
|
|
|
return gtvs.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void add(GenericTypeVar t) {
|
|
|
|
this.gtvs.add(t);
|
|
|
|
}
|
2016-09-16 13:25:20 +02:00
|
|
|
|
|
|
|
public List<GenericTypeVar> getGTVList() {
|
|
|
|
return this.gtvs;
|
|
|
|
}
|
2014-06-25 17:31:04 +02:00
|
|
|
}
|