Changeset 2287 for trunk/autoquest-ui-core
- Timestamp:
- 01/28/20 15:59:17 (5 years ago)
- Location:
- trunk/autoquest-ui-core/src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-ui-core/src/main/java/de/ugoe/cs/autoquest/commands/sequences/CMDcheckEventTimestamps.java
r1438 r2287 18 18 import java.util.LinkedList; 19 19 import java.util.List; 20 import java.util.ListIterator; 20 21 import java.util.logging.Level; 21 22 … … 84 85 Console.println("sequences with timestamp issues listed"); 85 86 } 87 else if ("sort".equals(command)) { 88 sortEventsUsingTimestamps(sequences, newSequencesName); 89 } 86 90 else if ("delete".equals(command)) { 87 91 deleteSequencesWithInvalidTimestamps(sequences, newSequencesName); … … 156 160 } 157 161 } 162 } 163 } 164 165 /** 166 * <p> 167 * sorts events in sequences with invalid timestamps from the provided collection of sequences and 168 * stores them under new name 169 * </p> 170 * 171 * @param sequences the collection of sequences to sort the events in 172 * @param newSequencesName the name for the new corrected collection of sequences 173 */ 174 private void sortEventsUsingTimestamps(Collection<List<Event>> sequences, 175 String newSequencesName) 176 { 177 Collection<List<Event>> newSequences = new LinkedList<List<Event>>(); 178 179 for (List<Event> sequence : sequences) { 180 181 List<Event> newSequence = new LinkedList<>(); 182 183 for (Event currentEvent : sequence) { 184 boolean added = false; 185 186 ListIterator<Event> iterator = newSequence.listIterator(); 187 188 while (iterator.hasNext()) { 189 if (iterator.next().getTimestamp() > currentEvent.getTimestamp()) { 190 iterator.previous(); 191 iterator.add(currentEvent); 192 added = true; 193 break; 194 }; 195 } 196 197 if (!added) { 198 newSequence.add(currentEvent); 199 } 200 201 } 202 203 newSequences.add(newSequence); 204 } 205 206 Console.traceln(Level.WARNING, sequences.size() + 207 " sequences sorted based on event timestamps"); 208 209 if (GlobalDataContainer.getInstance().addData(newSequencesName, newSequences)) { 210 CommandHelpers.dataOverwritten(newSequencesName); 158 211 } 159 212 } -
trunk/autoquest-ui-core/src/main/resources/manuals/checkEventTimestamps
r1438 r2287 1 checks all sequences of a collection of sequences for correct timestamps and event order. It supports counting the number of invalid sequences, listing details about invalid sequences and timestamps, as well as deleting invalid sequences.1 checks all sequences of a collection of sequences for correct timestamps and event order. It supports counting the number of invalid sequences, listing details about invalid sequences and timestamps, sorting sequences based on the timestamps, as well as deleting invalid sequences. 2 2 3 3 $USAGE$ 4 <command> one of "count", "list", and "delete"4 <command> one of "count", "list", "sort" and "delete" 5 5 <sequencesName> the name of the collection of sequences that shall be checked 6 <newSequences> optional; the name of the collection of sequences into which the resulting sequences shall be stored in case the delete command is selected; if left out, the result is stored in the collection identified by <sequencesName>6 <newSequences> optional; the name of the collection of sequences into which the resulting sequences shall be stored in case the sort or delete command is selected; if left out, the result is stored in the collection identified by <sequencesName> 7 7 8 8 Example(s): 9 9 checkEventTimestamps count someSequences 10 10 checkEventTimestamps list someSequences 11 checkEventTimestamps sort someSequences someNewSequences 11 12 checkEventTimestamps delete someSequences someNewSequences
Note: See TracChangeset
for help on using the changeset viewer.