Skip to content

Commit

Permalink
Removed KnowledgePath evaluation filed
Browse files Browse the repository at this point in the history
Path is evaluated each time
 - caching not possible even for ScheduleableProcesses
 -  [expression] value can changeduring run-time
  • Loading branch information
alf committed Aug 30, 2012
1 parent a971fe7 commit e39515e
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/cz/cuni/mff/d3s/deeco/path/grammar/KnowledgePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,20 @@ public class KnowledgePath implements Serializable {
private static final long serialVersionUID = -6173052910579323995L;

private final PNode pathNode;
private String evaluation;

public KnowledgePath(String path) throws ParseException {
this.pathNode = JDEECoParser.parse(path);
this.evaluation = null;
}

public String getEvaluatedPath(KnowledgeManager km) {
return getEvaluatedPath(km, null, null, null);
}

public String getEvaluatedPath(KnowledgeManager km, ISession session) {
return getEvaluatedPath(km, null, null, session);
}

public String getEvaluatedPath(KnowledgeManager km, String coord,
String member, ISession session) {
if (evaluation == null || (coord != null && member != null)) {
try {
evaluation = evaluatePath(pathNode, km, coord, member, session);
} catch (KMException kme) {
System.out.println("Knowledge path evaluation error!");
}
try {
return evaluatePath(pathNode, km, coord, member, session);
} catch (KMException kme) {
System.out.println("Knowledge path evaluation error!");
return null;
}
return evaluation;

}

private String evaluatePath(PNode pathNode, KnowledgeManager km,
Expand Down

0 comments on commit e39515e

Please sign in to comment.