Changeset 119 for trunk/EventBenchConsole/src/de/ugoe
- Timestamp:
- 07/13/11 10:15:13 (13 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcCoverage.java
r117 r119 32 32 33 33 IStochasticProcess process = null; 34 List<List<? extends Event<?>>> sequences = null;34 Collection<List<? extends Event<?>>> sequences = null; 35 35 Object dataObjectProcess = GlobalDataContainer.getInstance().getData(modelname); 36 36 if( dataObjectProcess==null ) { … … 58 58 59 59 process = (IStochasticProcess) dataObjectProcess; 60 sequences = ( List<List<? extends Event<?>>>) dataObjectSequences;60 sequences = (Collection<List<? extends Event<?>>>) dataObjectSequences; 61 61 Console.print(sequenceName); 62 62 for( int length=minLength ; length<=maxLength ; length++) { -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomSequences.java
r84 r119 2 2 3 3 import java.security.InvalidParameterException; 4 import java.util.HashSet; 4 5 import java.util.LinkedList; 5 6 import java.util.List; 7 import java.util.Set; 6 8 7 9 import de.ugoe.cs.eventbench.data.GlobalDataContainer; … … 18 20 String sequencesName; 19 21 int numSessions; 22 long maxIter; 20 23 try { 21 24 modelname = (String) parameters.get(0); 22 25 sequencesName = (String) parameters.get(1); 23 26 numSessions = Integer.parseInt((String) parameters.get(2)); 27 maxIter = numSessions*10; 28 if( parameters.size()==4 ) { 29 maxIter = Long.parseLong((String) parameters.get(3)); 30 } 24 31 } 25 32 catch (Exception e) { … … 36 43 } else { 37 44 model = (IStochasticProcess) dataObject; 38 List<List<? extends Event<?>>> sequences = new LinkedList<List<? extends Event<?>>>(); 39 for( int i=0 ; i<numSessions ; i++ ) { 45 Set<List<? extends Event<?>>> sequences = new HashSet<List<? extends Event<?>>>(numSessions); 46 long numIterations = 0; 47 while( sequences.size()<numSessions && numIterations<maxIter ) { 40 48 sequences.add(model.randomSequence()); 49 numIterations++; 50 } 51 if( sequences.size() < numSessions ) { 52 Console.println("Only " + sequences.size() + " unique sessions generated after " + maxIter + " iterations"); 41 53 } 42 54 if( GlobalDataContainer.getInstance().addData(sequencesName, sequences) ) { … … 48 60 @Override 49 61 public void help() { 50 Console.println("Usage: generateRandomSequenecs <modelName> <sequencesName> <numSessions> ");62 Console.println("Usage: generateRandomSequenecs <modelName> <sequencesName> <numSessions> {<maxIter>}"); 51 63 } 52 64
Note: See TracChangeset
for help on using the changeset viewer.