From 40ed660f6a85974715ecd2a999cd052a690132a2 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Sat, 13 Aug 2011 14:51:56 +0000 Subject: [PATCH] Extend PathFullInfo method to clarify what info is stored. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@3468 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/simulator/PathFull.java | 30 ++++++++++++++++++++++ prism/src/simulator/PathFullInfo.java | 36 +++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/prism/src/simulator/PathFull.java b/prism/src/simulator/PathFull.java index c6fed9ea..60e5c613 100644 --- a/prism/src/simulator/PathFull.java +++ b/prism/src/simulator/PathFull.java @@ -378,6 +378,36 @@ public class PathFull extends Path implements PathFullInfo return steps.get(step).transitionRewards[rsi]; } + @Override + public boolean hasRewardInfo() + { + return true; + } + + @Override + public boolean hasChoiceInfo() + { + return true; + } + + @Override + public boolean hasActionInfo() + { + return true; + } + + @Override + public boolean hasTimeInfo() + { + return true; + } + + @Override + public boolean hasLoopInfo() + { + return true; + } + // Other methods /** diff --git a/prism/src/simulator/PathFullInfo.java b/prism/src/simulator/PathFullInfo.java index 4ec28405..a4db3097 100644 --- a/prism/src/simulator/PathFullInfo.java +++ b/prism/src/simulator/PathFullInfo.java @@ -46,6 +46,7 @@ public interface PathFullInfo /** * Get a state reward for the state at a given step of the path. + * If no reward info is stored ({@link #hasRewardInfo()} is false), returns 0.0. * @param step Step index (0 = initial state/step of path) * @param rsi Reward structure index */ @@ -53,12 +54,14 @@ public interface PathFullInfo /** * Get the total time spent up until entering a given step of the path. + * If no time info is stored ({@link #hasTimeInfo()} is false), returns 0.0. * @param step Step index (0 = initial state/step of path) */ public abstract double getCumulativeTime(int step); /** * Get the total (state and transition) reward accumulated up until entering a given step of the path. + * If no reward info is stored ({@link #hasRewardInfo()} is false), returns 0.0. * @param step Step index (0 = initial state/step of path) * @param rsi Reward structure index */ @@ -66,12 +69,14 @@ public interface PathFullInfo /** * Get the time spent in a state at a given step of the path. + * If no time info is stored ({@link #hasTimeInfo()} is false), returns 0.0. * @param step Step index (0 = initial state/step of path) */ public abstract double getTime(int step); /** * Get the index of the choice taken for a given step. + * If no choice info is stored ({@link #hasChoiceInfo()} is false), returns 0. * @param step Step index (0 = initial state/step of path) */ public abstract int getChoice(int step); @@ -80,18 +85,21 @@ public interface PathFullInfo * Get the index i of the action taken for a given step. * If i>0, then i-1 is the index of an action label (0-indexed) * If i<0, then -i-1 is the index of a module (0-indexed) + * If no action info is stored ({@link #hasActionInfo()} is false), returns 0. * @param step Step index (0 = initial state/step of path) */ public abstract int getModuleOrActionIndex(int step); /** * Get a string describing the action/module of a given step. + * If no action info is stored ({@link #hasActionInfo()} is false), returns "". * @param step Step index (0 = initial state/step of path) */ public abstract String getModuleOrAction(int step); /** * Get a transition reward associated with a given step. + * If no reward info is stored ({@link #hasRewardInfo()} is false), returns 0.0. * @param step Step index (0 = initial state/step of path) * @param rsi Reward structure index */ @@ -99,16 +107,44 @@ public interface PathFullInfo /** * Does the path contain a deterministic loop? + * If no loop info is stored ({@link #hasLoopInfo()} is false), returns false. */ public abstract boolean isLooping(); /** * What is the step index of the start of the deterministic loop, if it exists? + * If no loop info is stored ({@link #hasLoopInfo()} is false), returns 0. */ public abstract int loopStart(); /** * What is the step index of the end of the deterministic loop, if it exists? + * If no loop info is stored ({@link #hasLoopInfo()} is false), returns 0. */ public abstract int loopEnd(); + + /** + * Does this object store information about rewards? + */ + public abstract boolean hasRewardInfo(); + + /** + * Does this object store information about which choices were taken? + */ + public abstract boolean hasChoiceInfo(); + + /** + * Does this object store information about rewards? + */ + public abstract boolean hasActionInfo(); + + /** + * Does this object store information about time elapse (for continuous-time models)? + */ + public abstract boolean hasTimeInfo(); + + /** + * Does this object store information about loops in the path? + */ + public abstract boolean hasLoopInfo(); }