Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/util/event/EventChoiceGenerator.java @ 9:8de43b2b023f
added choice getters for EventChoiceGenerator
added some minor Event functions
author | Peter Mehlitz <Peter.C.Mehlitz@nasa.gov> |
---|---|
date | Fri, 13 Feb 2015 20:20:15 -0800 |
parents | fdc263e5806b |
children | b1790909ebb1 |
comparison
equal
deleted
inserted
replaced
8:54b7125309a9 | 9:8de43b2b023f |
---|---|
205 | 205 |
206 @Override | 206 @Override |
207 public Class<Event> getChoiceType() { | 207 public Class<Event> getChoiceType() { |
208 return Event.class; | 208 return Event.class; |
209 } | 209 } |
210 | |
211 protected Event[] getFirstNChoices(int n){ | |
212 Event[] a = new Event[n]; | |
213 | |
214 Event e = base; | |
215 for (int i=0; i<n; i++){ | |
216 a[i] = e; | |
217 e = e.getAlt(); | |
218 } | |
219 | |
220 return a; | |
221 } | |
222 | |
223 @Override | |
224 public Event[] getAllChoices(){ | |
225 return getFirstNChoices( getTotalNumberOfChoices()); | |
226 } | |
227 | |
228 @Override | |
229 public Event[] getProcessedChoices(){ | |
230 return getFirstNChoices( getProcessedNumberOfChoices()); | |
231 } | |
232 | |
233 @Override | |
234 public Event[] getUnprocessedChoices(){ | |
235 int n=0; | |
236 for (Event e=cur; e != null; e = e.getAlt()){ | |
237 n++; | |
238 } | |
239 | |
240 Event[] a = new Event[n]; | |
241 | |
242 Event e = cur; | |
243 for (int i=0; i<n; i++){ | |
244 a[i] = e; | |
245 e = e.getAlt(); | |
246 } | |
247 | |
248 return a; | |
249 } | |
210 } | 250 } |