@@ 145-189 (lines=45) @@ | ||
142 | * @param compName |
|
143 | * @return |
|
144 | */ |
|
145 | public double[] getMakespan(String name) |
|
146 | { |
|
147 | // set makespan |
|
148 | double[] mk = new double[] { |
|
149 | 0.0, |
|
150 | 0.0 |
|
151 | }; |
|
152 | ||
153 | // check timelines |
|
154 | for (Timeline tl : this.timelines) |
|
155 | { |
|
156 | // check primitive components only |
|
157 | if (tl.getComponent().getName().equals(name)) |
|
158 | { |
|
159 | // preapre makespan |
|
160 | mk = new double[] { |
|
161 | Double.MIN_VALUE + 1, |
|
162 | Double.MAX_VALUE - 1 |
|
163 | }; |
|
164 | ||
165 | ||
166 | // get last token of the timeline |
|
167 | Token last = tl.getTokens().get(0); |
|
168 | for (int index = 1; index < tl.getTokens().size(); index++) { |
|
169 | // get token |
|
170 | Token t = tl.getTokens().get(index); |
|
171 | // check last token |
|
172 | if (t.getInterval().getEndTime().getLowerBound() > last.getInterval().getEndTime().getLowerBound()) { |
|
173 | // update last token |
|
174 | last = t; |
|
175 | } |
|
176 | } |
|
177 | ||
178 | // update max end time |
|
179 | mk[0] = Math.max(mk[0], last.getInterval().getEndTime().getLowerBound()); |
|
180 | mk[1] = Math.min(mk[1], last.getInterval().getEndTime().getUpperBound()); |
|
181 | ||
182 | // stop search |
|
183 | break; |
|
184 | } |
|
185 | } |
|
186 | ||
187 | ||
188 | // get makespan |
|
189 | return mk; |
|
190 | } |
|
191 | ||
192 | /** |
|
@@ 100-137 (lines=38) @@ | ||
97 | * |
|
98 | * @return |
|
99 | */ |
|
100 | public double[] getMakespan() |
|
101 | { |
|
102 | // set makespan |
|
103 | double[] mk = new double[] { |
|
104 | Double.MIN_VALUE + 1, |
|
105 | Double.MAX_VALUE - 1 |
|
106 | }; |
|
107 | ||
108 | // check timelines |
|
109 | for (Timeline tl : this.timelines) |
|
110 | { |
|
111 | // check primitive components only |
|
112 | if (tl.getComponent().getType().equals(DomainComponentType.SV_PRIMITIVE)) |
|
113 | { |
|
114 | // check tokens |
|
115 | if (!tl.getTokens().isEmpty()) { |
|
116 | // get last token of the timeline |
|
117 | Token last = tl.getTokens().get(0); |
|
118 | for (int index = 1; index < tl.getTokens().size(); index++) { |
|
119 | // get token |
|
120 | Token t = tl.getTokens().get(index); |
|
121 | // check last token |
|
122 | if (t.getInterval().getEndTime().getLowerBound() > last.getInterval().getEndTime().getLowerBound()) { |
|
123 | // update last token |
|
124 | last = t; |
|
125 | } |
|
126 | } |
|
127 | ||
128 | // update max end time |
|
129 | mk[0] = Math.max(mk[0], last.getInterval().getEndTime().getLowerBound()); |
|
130 | mk[1] = Math.min(mk[1], last.getInterval().getEndTime().getUpperBound()); |
|
131 | } |
|
132 | } |
|
133 | } |
|
134 | ||
135 | ||
136 | // get makespan |
|
137 | return mk; |
|
138 | } |
|
139 | ||
140 | /** |