Commit da14fc5e authored by Joachim Müssig's avatar Joachim Müssig

clear up code, javadoc

parent a146dc5b
......@@ -15,7 +15,6 @@ import edu.kit.joana.api.lattice.BuiltinLattices;
import edu.kit.joana.api.sdg.SDGCall;
import edu.kit.joana.api.sdg.SDGCallPart;
import edu.kit.joana.api.sdg.SDGProgram;
import edu.kit.joana.ifc.sdg.graph.SDG;
public class ExtractAnnotations {
......@@ -25,7 +24,7 @@ public class ExtractAnnotations {
public static Collection<IFCAnnotation> loadAnnotations(InputStream source,
SDGProgram program)
throws IOException {
SDG sdg = program.getSDG();
// SDG sdg = program.getSDG();
Set<IFCAnnotation> toAnnotate = new LinkedHashSet<IFCAnnotation>();
// SDGProgram program = new SDGProgram(sdg,null);
......
......@@ -23,9 +23,6 @@ public class SDGNodeAnnotation extends IFCAnnotation {
private SDGNode annotatedNode;
public SDGNodeAnnotation(SDGNode annotatedNode, AnnotationType type, String level, SDGProgramPart annotatedPart) {
super(type, level, annotatedPart);
this.annotatedNode = annotatedNode;
......
/**
* This file is part of the Joana IFC project. It is developed at the
* Programming Paradigms Group of the Karlsruhe Institute of Technology.
*
* For further details on licensing please read the information at
* http://joana.ipd.kit.edu or contact the authors.
*/
package joanakey.annotations;
import java.util.Collection;
......@@ -17,18 +10,10 @@ import edu.kit.joana.api.sdg.SDGProgram;
import edu.kit.joana.ifc.sdg.graph.SDGNode;
/**
* TODO: @author muessig.
* @author joachim
*/
public class SDGNodeAnnotationApplicator extends IFCAnnotationApplicator {
// private final SDGProgram program;
// protected SDGAnalysis analysis;
// private final Map<SecurityNode, Set<NodeAnnotationInfo>> annotatedNodes = new HashMap<SecurityNode, Set<NodeAnnotationInfo>>();
//private final IFCAnalysis analysis;
//private final Map<SecurityNode, Set<NodeAnnotationInfo>> annotatedNodes = new HashMap<SecurityNode, Set<NodeAnnotationInfo>>();
public SDGNodeAnnotationApplicator(SDGProgram program, IFCAnalysis analysis) {
super(program, analysis);
}
......@@ -47,13 +32,7 @@ public class SDGNodeAnnotationApplicator extends IFCAnnotationApplicator {
if (ann.getType() == AnnotationType.SOURCE || ann.getType() == AnnotationType.SINK) {
annotationDebug.outln(String.format("Annnotation nodes for %s '%s' of security level %s...", ann.getType().toString(), ann.getProgramPart(), ann.getLevel1()));
}
// IFCAnnotationApplicator thisApp = (IFCAnnotationApplicator) this;
// ann.accept(thisApp);
//TODO: muessig test this. Alternatively "instance of" -.-
ann.accept(this);
// applyAnnotation(ann);
}
}
......@@ -61,19 +40,4 @@ public class SDGNodeAnnotationApplicator extends IFCAnnotationApplicator {
annotateNode(ann.getAnnotatedNode(), ann);
}
// public void applyAnnotations(Collection<IFCAnnotation> anns) {
// for (IFCAnnotation ann : anns) {
// if (ann instanceof SDGNodeAnnotation) {
// SDGNodeAnnotation annSDG = (SDGNodeAnnotation) ann;
// if (ann.getType() == AnnotationType.SOURCE || annSDG.getType() == AnnotationType.SINK) {
// // annotationDebug.outln(String.format("Annnotation nodes for %s '%s' of security level %s...", ann.getType().toString(), ann.getProgramPart(), ann.getLevel1()));
// }
// annotateNode(annSDG);
// } else {
// System.out.println("!");
// super.applyAnnotations(anns);
// }
// }
// }
}
......@@ -17,51 +17,31 @@ import edu.kit.joana.api.sdg.SDGProgramPart;
import edu.kit.joana.ifc.sdg.graph.SDGNode;
/**
* TODO: @author muessig
*
*@author joachim
*/
public class SDGNodeAnnotationManager extends IFCAnnotationManager {
// private final SDGNodeAnnotationApplicator app;
// private final Map<SDGNode, SDGNodeAnnotation> sourceAnnotations;
// private final Map<SDGNode, SDGNodeAnnotation> sinkAnnotations;
// private final Map<SDGNode, SDGNodeAnnotation> declassAnnotations;
/**
*
*/
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ?
public SDGNodeAnnotationManager(SDGProgram program, IFCAnalysis analysis) {
super(program, analysis);
// sourceAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
// sinkAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
// declassAnnotations = new HashMap<SDGNode, SDGNodeAnnotation>();
this.app = new SDGNodeAnnotationApplicator(program, analysis);
}
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ?
/**
* remove the annotation with the given sdg node
* @param annotated node you want to remove the annotation from
*/
//TODO: Test
public void removeAnnotation(SDGNode node) {
sourceAnnotations.remove(node);
sinkAnnotations.remove(node);
declassAnnotations.remove(node);
}
//TODO: sourceAnnotations/sinkAnnotations really needed with hash<NOde, annotation> ? add
public void addAnnotation(SDGNodeAnnotation ann) {
if (!isAnnotationLegal(ann)) {
throw new IllegalArgumentException();
}
// if (ann.getType() == AnnotationType.SOURCE) {
// sourceAnnotations.put(ann.getAnnotatedNode(), ann);
// } else if (ann.getType() == AnnotationType.SINK) {
// this.sinkAnnotations.put(ann.getAnnotatedNode(), ann);
// } else {
// this.declassAnnotations.put(ann.getAnnotatedNode(), ann);
// }
if (ann.getType() == AnnotationType.SOURCE) {
sourceAnnotations.put(ann.getProgramPart(), ann);
} else if (ann.getType() == AnnotationType.SINK) {
......@@ -97,12 +77,8 @@ public class SDGNodeAnnotationManager extends IFCAnnotationManager {
// return ret;
// }
//TODO test
public boolean isAnnotated(SDGNode node) {
return sourceAnnotations.keySet().contains(node) || sinkAnnotations.keySet().contains(node) || declassAnnotations.keySet().contains(node);
}
//TODO: removeAllAnnotation etc. correct ?
}
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