Changeset 209 for trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsequenceStatistics.java
- Timestamp:
- 09/28/11 03:03:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDsequenceStatistics.java
r203 r209 7 7 import java.util.TreeMap; 8 8 9 import de.ugoe.cs.eventbench.SequenceInstanceOf; 9 10 import de.ugoe.cs.eventbench.data.Event; 10 11 import de.ugoe.cs.eventbench.data.GlobalDataContainer; … … 39 40 Object dataObject = GlobalDataContainer.getInstance().getData( 40 41 sequencesName); 42 if (dataObject == null) { 43 Console.println("Object " + sequencesName 44 + " not found in storage."); 45 return; 46 } 47 if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 48 Console.println("Object " + sequencesName 49 + "not of type Collection<List<Event<?>>>."); 50 return; 51 } 41 52 42 try { 43 sequences = (Collection<List<Event<?>>>) dataObject; 44 Console.traceln("Number of Sequences: " + sequences.size()); 45 SortedMap<Integer, Integer> lengthMap = new TreeMap<Integer, Integer>(); 46 for (List<Event<?>> sequence : sequences) { 47 Integer currentSize = sequence.size(); 48 if (lengthMap.containsKey(currentSize)) { 49 lengthMap.put(currentSize, lengthMap.get(currentSize) + 1); 50 } else { 51 lengthMap.put(currentSize, 1); 52 } 53 sequences = (Collection<List<Event<?>>>) dataObject; 54 Console.traceln("Number of Sequences: " + sequences.size()); 55 SortedMap<Integer, Integer> lengthMap = new TreeMap<Integer, Integer>(); 56 for (List<Event<?>> sequence : sequences) { 57 Integer currentSize = sequence.size(); 58 if (lengthMap.containsKey(currentSize)) { 59 lengthMap.put(currentSize, lengthMap.get(currentSize) + 1); 60 } else { 61 lengthMap.put(currentSize, 1); 53 62 } 54 for (Entry<Integer, Integer> entry : lengthMap.entrySet()) { 55 Console.traceln("Of length " + entry.getKey() + ": " 56 + entry.getValue()); 57 } 58 59 } catch (ClassCastException e) { 60 Console.println("Sequences not found"); 63 } 64 for (Entry<Integer, Integer> entry : lengthMap.entrySet()) { 65 Console.traceln("Of length " + entry.getKey() + ": " 66 + entry.getValue()); 61 67 } 62 68 }
Note: See TracChangeset
for help on using the changeset viewer.