Changeset 765 for trunk/quest-ui-core/src/main/java
- Timestamp:
- 09/04/12 16:12:06 (12 years ago)
- Location:
- trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/commands/sequences
- Files:
-
- 1 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-ui-core/src/main/java/de/ugoe/cs/quest/commands/sequences/CMDsortKeyInteractions.java
r750 r765 6 6 import java.util.LinkedList; 7 7 import java.util.List; 8 import java.util.logging.Level; 8 9 9 10 import de.ugoe.cs.quest.CommandHelpers; 10 11 import de.ugoe.cs.quest.SequenceInstanceOf; 11 12 import de.ugoe.cs.quest.eventcore.Event; 12 import de.ugoe.cs.quest.eventcore.gui.SortedInteractionEventList; 13 import de.ugoe.cs.quest.eventcore.gui.KeyInteractionSorter; 14 import de.ugoe.cs.quest.eventcore.gui.KeyInteractionSorter.CleanupMode; 13 15 import de.ugoe.cs.util.console.Command; 16 import de.ugoe.cs.util.console.Console; 14 17 import de.ugoe.cs.util.console.GlobalDataContainer; 15 18 16 19 /** 17 20 * <p> 18 * Command to sort the key interactions in a sequence of events. An example, the sequence 19 * t o write the upper case D21 * Command to sort the key interactions in a sequence of events. An example, the sequence to write 22 * the upper case D 20 23 * <ul> 21 * 22 * 23 * 24 * 24 * <li>press shift key</li> 25 * <li>press D key</li> 26 * <li>release shift key</li> 27 * <li>release D key</li> 25 28 * </ul> 26 29 * … … 28 31 * 29 32 * <ul> 30 * 31 * 32 * 33 * 33 * <li>press shift key</li> 34 * <li>press D key</li> 35 * <li>release D key</li> 36 * <li>release shift key</li> 34 37 * </ul> 35 38 * 36 * in which the first pressed key (shift in this case) is always released last. The same is done 37 * forthe alt and the ctrl keys.39 * in which the first pressed key (shift in this case) is always released last. The same is done for 40 * the alt and the ctrl keys. 38 41 * 39 42 * </p> … … 64 67 String sequencesName; 65 68 String newSequencesName; 69 String modeString = "ADDITION"; 66 70 try { 67 71 sequencesName = (String) parameters.get(0); … … 71 75 else { 72 76 newSequencesName = sequencesName; 77 } 78 if (parameters.size() > 2) { 79 modeString = (String) parameters.get(2); 73 80 } 74 81 } … … 88 95 } 89 96 97 CleanupMode mode = null; 98 try { 99 mode = CleanupMode.valueOf(modeString); 100 } 101 catch (IllegalArgumentException e) { 102 Console.printerrln("Invalid mode. Only REMOVAL and ADDITION are allowed values!"); 103 return; 104 } 105 90 106 sequences = (Collection<List<Event>>) dataObject; 91 SortedInteractionEventList sortedEventList;92 107 93 108 Collection<List<Event>> newSequences = new LinkedList<List<Event>>(); 94 109 110 int i = 1; 95 111 for (List<Event> sequence : sequences) { 96 sortedEventList = new SortedInteractionEventList(); 97 98 for (Event event : sequence) { 99 sortedEventList.add(event); 100 } 101 102 newSequences.add(sortedEventList); 112 Console.traceln(Level.INFO, "Processing sequence " + i++); 113 newSequences.add(new KeyInteractionSorter(mode).sortKeyInteractions(sequence)); 103 114 } 104 115 … … 106 117 CommandHelpers.dataOverwritten(newSequencesName); 107 118 } 108 119 109 120 } 110 121
Note: See TracChangeset
for help on using the changeset viewer.