Changeset 171 for trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java
- Timestamp:
- 09/09/11 06:23:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java
r18 r171 12 12 import de.ugoe.cs.util.console.Console; 13 13 14 /** 15 * <p> 16 * Command to create a replay file with randomly generated sessions. 17 * </p> 18 * 19 * @author Steffen Herbold 20 * @version 1.0 21 */ 14 22 public class CMDgenerateRandomReplay implements Command { 15 23 24 /* 25 * (non-Javadoc) 26 * 27 * @see de.ugoe.cs.util.console.Command#help() 28 */ 16 29 @Override 17 30 public void help() { … … 19 32 } 20 33 34 /* 35 * (non-Javadoc) 36 * 37 * @see de.ugoe.cs.util.console.Command#run(java.util.List) 38 */ 21 39 @SuppressWarnings("unchecked") 22 40 @Override … … 28 46 modelname = (String) parameters.get(0); 29 47 filename = (String) parameters.get(1); 30 if ( parameters.size()<3) {48 if (parameters.size() < 3) { 31 49 numSessions = Integer.parseInt((String) parameters.get(2)); 32 50 } 33 } 34 catch (Exception e) { 51 } catch (Exception e) { 35 52 throw new InvalidParameterException(); 36 53 } 37 38 IStochasticProcess model = null; 39 Object dataObject = GlobalDataContainer.getInstance().getData(modelname); 40 if( dataObject==null ) { 54 55 IStochasticProcess model = null; 56 Object dataObject = GlobalDataContainer.getInstance() 57 .getData(modelname); 58 if (dataObject == null) { 41 59 Console.println("Model " + modelname + " not found in storage."); 42 } 43 else if( !(dataObject instanceof IStochasticProcess) ) { 60 } else if (!(dataObject instanceof IStochasticProcess)) { 44 61 Console.println("Object " + modelname + " not of type MarkovModel!"); 45 62 } else { … … 47 64 List<List<ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>(); 48 65 try { 49 for( int i=0 ; i<numSessions ; i++ ) { 50 sequences.add((List<ReplayableEvent<?>>) model.randomSequence()); 66 for (int i = 0; i < numSessions; i++) { 67 sequences.add((List<ReplayableEvent<?>>) model 68 .randomSequence()); 51 69 } 52 70 } catch (ClassCastException e) {
Note: See TracChangeset
for help on using the changeset viewer.