JavaPatternMatching/src/typinferenz/TypeInsertSet.java

42 lines
871 B
Java
Raw Normal View History

2014-03-09 10:44:12 +00:00
package typinferenz;
import java.util.Vector;
/**
* B<EFBFBD>ndelt ein Set von TypeInsertPoints, die alle zu einem TypePlaceholder geh<EFBFBD>ren.
* Diese m<EFBFBD>ssen gemeinsam eingesetzt werden.
* @author janulrich
*
*/
public class TypeInsertSet {
public Vector<TypeInsertPoint> points = new Vector<TypeInsertPoint>();
2014-03-09 10:44:12 +00:00
public TypeInsertSet(TypeInsertPoint p){
points.add(p);
}
public TypeInsertSet() {
}
public void add(TypeInsertPoint typeInsertPoint) {
points.add(typeInsertPoint);
}
/**
* F<EFBFBD>gt alle Typen dieses TypeInsertSets in den <EFBFBD>bergebenen Quellcode ein
* @param fileContent
* @return
*/
public String insertAllTypes(String fileContent) {
int additionalOffset = 0;
String ret = fileContent;
for(TypeInsertPoint p : points){
ret = p.insertType(ret, additionalOffset);
additionalOffset += p.getInsertLength();
}
return ret;
}
}