forked from JavaTX/JavaCompilerCore
42 lines
864 B
Java
42 lines
864 B
Java
|
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 {
|
|||
|
|
|||
|
Vector<TypeInsertPoint> points = new Vector<TypeInsertPoint>();
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
}
|