1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package zeus.concepts;
25
26 import java.util.*;
27 import zeus.util.*;
28 import zeus.concepts.fn.*;
29 /***
30 PlanScripts are (I think) a set of tasks chained together to form a meta task
31 */
32 public class PlanScript extends SummaryTask {
33
34 public PlanScript() {
35 super();
36 type = SCRIPT;
37 autorun = true;
38 }
39
40 public PlanScript(String name, ValueFunction time, ValueFunction cost,
41 TaskNode[] nodes, TaskLink[] links,
42 LogicalFn[] constraints) {
43 super(name,time,cost,nodes,links,constraints);
44 type = SCRIPT;
45 autorun = true;
46 }
47
48
49 public PlanScript(String name, String time, String cost,
50 TaskNode[] nodes, TaskLink[] links,
51 LogicalFn[] constraints) {
52 super(name,time,cost,nodes,links,constraints);
53 type = SCRIPT;
54 autorun = true;
55 }
56
57
58 public PlanScript(String name, ValueFunction time, ValueFunction cost,
59 Vector nodes, Vector links, Vector constraints) {
60 super(name,time,cost,nodes,links,constraints);
61 type = SCRIPT;
62 autorun = true;
63 }
64
65
66 public PlanScript(String name, String time, String cost,
67 Vector nodes, Vector links, Vector constraints) {
68 super(name,time,cost,nodes,links,constraints);
69 type = SCRIPT;
70 autorun = true;
71 }
72
73
74
75 public PlanScript(String name, boolean autorun,
76 ValueFunction time, ValueFunction cost,
77 TaskNode[] nodes, TaskLink[] links,
78 LogicalFn[] constraints) {
79 super(name,time,cost,nodes,links,constraints);
80 type = SCRIPT;
81 this.autorun = autorun;
82 }
83 public PlanScript(String name, boolean autorun,
84 String time, String cost,
85 TaskNode[] nodes, TaskLink[] links,
86 LogicalFn[] constraints) {
87 super(name,time,cost,nodes,links,constraints);
88 type = SCRIPT;
89 this.autorun = autorun;
90 }
91
92
93 public PlanScript(String name, boolean autorun,
94 ValueFunction time, ValueFunction cost,
95 Vector nodes, Vector links, Vector constraints) {
96 super(name,time,cost,nodes,links,constraints);
97 type = SCRIPT;
98 this.autorun = autorun;
99 }
100
101
102 public PlanScript(String name, boolean autorun,
103 String time, String cost,
104 Vector nodes, Vector links, Vector constraints) {
105 super(name,time,cost,nodes,links,constraints);
106 type = SCRIPT;
107 this.autorun = autorun;
108 }
109
110
111 public PlanScript(PlanScript task) {
112 type = SCRIPT;
113 autorun = task.isAutorun();
114 name = task.getName();
115 cost = task.getCostFn();
116 time = task.getTimeFn();
117 setNodes( task.getNodes() );
118 setLinks( task.getLinks() );
119 setConstraints( task.getConstraints() );
120 }
121
122
123 public boolean isAutorun() { return autorun; }
124
125 public void setAutorun(boolean autorun) { this.autorun = autorun; }
126
127 public AbstractTask duplicate(DuplicationTable table) {
128 TaskNode[] Xnodes = new TaskNode[nodes.size()];
129 TaskLink[] Xlinks = new TaskLink[links.size()];
130 LogicalFn[] Xconstraints = new LogicalFn[constraints.size()];
131
132 ValueFunction Xtime = time.duplicate(table);
133 ValueFunction Xcost = cost.duplicate(table);
134
135 for(int i = 0; i < nodes.size(); i++ )
136 Xnodes[i] = ((TaskNode)nodes.elementAt(i)).duplicate(table);
137
138 for(int i = 0; i < links.size(); i++ )
139 Xlinks[i] = ((TaskLink)links.elementAt(i)).duplicate(table);
140
141 for(int i = 0; i < constraints.size(); i++ )
142 Xconstraints[i] = (LogicalFn)((LogicalFn)constraints.elementAt(i)).duplicate(table);
143
144 return new PlanScript(name,autorun,Xtime,Xcost,Xnodes,Xlinks,Xconstraints);
145 }
146 }