Commit f53a2c64 authored by Clemens Pflaum's avatar Clemens Pflaum

Added some JavaDoc

parent 3ef9eb3c
......@@ -6,6 +6,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.SimpleName;
......@@ -41,6 +42,10 @@ public abstract class CodeBlock extends AbstractNode {
this.blob = blob;
}
/**
* Returns a HashSet with all valid method startPositions as Integer Offset from start of CodeBlock
* @return
*/
public HashSet<Integer> methodPositions() {
HashSet<Integer> methodPositions = new HashSet<Integer>();
for (int i = 0; i < this.methodList.size(); i++) {
......@@ -50,6 +55,10 @@ public abstract class CodeBlock extends AbstractNode {
return methodPositions;
}
/**
* Returns a HashSet with all valid variable startPositions as Integer Offset from start of CodeBlock
* @return
*/
public HashSet<Integer> variablePositions()
{
HashSet<Integer> variablePositions = new HashSet<Integer>();
......@@ -70,6 +79,11 @@ public abstract class CodeBlock extends AbstractNode {
return variablePositions;
}
/**
* Report Java ParseProblems of this CodeBlock
* Currently not functional because ErrorManager needs Position Objects with absolute column and lineNumbers not Offsets
* @param errMan
*/
public void reportProblems(ErrorManager errMan){
IProblem[] problems = cu.getProblems();
for(IProblem problem : problems){
......
......@@ -32,13 +32,16 @@ public class SpecialCodeBlock extends CodeBlock implements IProductionRightPart
}
@Override
public void parseJavaCode(String[] classpathEntries) {
public void parseJavaCode(String[] classpathEntries, ErrorManager errMan) {
//Parse JavaCode to CompilationUnit
this.cu = (CompilationUnit) JavaCompiler.parseJava(this, classpathEntries);
//Collect variable and method Bindings
BindingCollector variableCollector = new BindingCollector();
this.cu.accept(variableCollector);
this.variableMap = variableCollector.getVariableMap();
this.methodList = variableCollector.getMethodList();
this.setCupOffset(this.getRange().getBegin().getOffsetFromStart());
//Report Java parseProblems
reportProblems(errMan);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment