Changeset 1707 for trunk/autoquest-ui-core-alignment/src
- Timestamp:
- 09/01/14 19:03:47 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-ui-core-alignment/src/main/java/de/ugoe/cs/autoquest/commands/usability/CMDgenerateTaskTree.java
r1146 r1707 28 28 /** 29 29 * <p> 30 * This command generates a task tree based on the provided sequences. It uses the31 * {@link TaskTreeManager} for this purpose. Please consult the documentation of the task tree32 * manager for more details.30 * This command generates a task tree based on the provided sequences. It uses 31 * the {@link TaskTreeManager} for this purpose. Please consult the 32 * documentation of the task tree manager for more details. 33 33 * </p> 34 34 * … … 38 38 public class CMDgenerateTaskTree implements Command { 39 39 40 41 42 43 44 45 46 47 return "generateTaskTree <sequences> {<tasktree>}";48 40 /* 41 * (non-Javadoc) 42 * 43 * @see de.ugoe.cs.util.console.Command#help() 44 */ 45 @Override 46 public String help() { 47 return "generateTaskTree <sequences> {<tasktree>} {<boolean: harmonize sequences or not (true or false)>} {<integer: number of threads>}"; 48 } 49 49 50 /* 51 * (non-Javadoc) 52 * 53 * @see de.ugoe.cs.util.console.Command#run(java.util.List) 54 */ 55 @SuppressWarnings("unchecked") 56 @Override 57 public void run(List<Object> parameters) { 58 String sequencesName; 59 String tasktreeName; 60 try { 61 sequencesName = (String) parameters.get(0); 62 if (parameters.size() > 1) { 63 tasktreeName = (String) parameters.get(1); 64 } 65 else { 66 tasktreeName = "tasktree"; 67 } 68 } 69 catch (Exception e) { 70 throw new IllegalArgumentException("must provide a sequences name"); 71 } 50 /* 51 * (non-Javadoc) 52 * 53 * @see de.ugoe.cs.util.console.Command#run(java.util.List) 54 */ 55 @SuppressWarnings("unchecked") 56 @Override 57 public void run(List<Object> parameters) { 58 String sequencesName; 59 String tasktreeName; 60 try { 61 sequencesName = (String) parameters.get(0); 62 if (parameters.size() > 1) { 63 tasktreeName = (String) parameters.get(1); 64 } else { 65 tasktreeName = "tasktree"; 66 } 67 } catch (Exception e) { 68 throw new IllegalArgumentException("must provide a sequences name"); 69 } 70 if (parameters.size() > 2) { 71 String harmonize = (String) parameters.get(2); 72 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = true; 73 System.out.println(harmonize); 74 if (harmonize.equals("false")) { 75 System.out.println("Not harmonizing"); 76 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.harmonizeSequences = false; 77 } 78 } 79 if (parameters.size() > 3) { 80 String threadCount = (String) parameters.get(3); 81 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.nThreads = 1; 82 try { 83 int tmp = Integer.parseInt(threadCount); 84 de.ugoe.cs.autoquest.tasktrees.temporalrelation.SequenceForTaskDetectionRuleAlignment.nThreads = tmp; 85 } catch (Exception e) { 86 throw new IllegalArgumentException( 87 "The fourth parameter must be an integer. Did you forget to name the tasktree?"); 88 } 89 } 72 90 73 Collection<List<Event>> sequences = null; 74 Object dataObject = GlobalDataContainer.getInstance().getData(sequencesName); 75 if (dataObject == null) { 76 CommandHelpers.objectNotFoundMessage(sequencesName); 77 return; 78 } 79 if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 80 CommandHelpers.objectNotType(sequencesName, "Collection<List<Event<?>>>"); 81 return; 82 } 91 Collection<List<Event>> sequences = null; 92 Object dataObject = GlobalDataContainer.getInstance().getData( 93 sequencesName); 94 if (dataObject == null) { 95 CommandHelpers.objectNotFoundMessage(sequencesName); 96 return; 97 } 98 if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 99 CommandHelpers.objectNotType(sequencesName, 100 "Collection<List<Event<?>>>"); 101 return; 102 } 83 103 84 85 86 87 88 89 90 91 92 104 sequences = (Collection<List<Event>>) dataObject; 105 106 ITaskModel taskModel = new TaskTreeManager().createTaskModel(sequences); 107 108 if (GlobalDataContainer.getInstance().addData(tasktreeName, taskModel)) { 109 CommandHelpers.dataOverwritten(sequencesName); 110 } 111 112 } 93 113 94 114 }
Note: See TracChangeset
for help on using the changeset viewer.