| Total Complexity | 6 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package it.cnr.istc.pst.platinum.ai.framework.microkernel.resolver.timeline.scheduling; |
||
| 14 | public class OverlappingSetSchedule extends FlawSolution { |
||
|
|
|||
| 15 | |||
| 16 | private List<PrecedenceConstraint> constraints; // precedence constraints |
||
| 17 | |||
| 18 | /** |
||
| 19 | * |
||
| 20 | * @param cs |
||
| 21 | * @param cost |
||
| 22 | */ |
||
| 23 | protected OverlappingSetSchedule(OverlappingSet cs, double cost) { |
||
| 24 | super(cs, cost); |
||
| 25 | this.constraints = new ArrayList<>(); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * |
||
| 30 | * @param reference |
||
| 31 | * @param target |
||
| 32 | */ |
||
| 33 | public void addConstraint(Decision reference, Decision target) { |
||
| 34 | |||
| 35 | // create constraint data |
||
| 36 | PrecedenceConstraint pc = new PrecedenceConstraint(reference, target); |
||
| 37 | // add constraint |
||
| 38 | this.constraints.add(pc); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * |
||
| 43 | * @return |
||
| 44 | */ |
||
| 45 | public List<PrecedenceConstraint> getConstraints() { |
||
| 46 | return new ArrayList<>(this.constraints); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * |
||
| 51 | */ |
||
| 52 | @Override |
||
| 53 | public int compareTo(FlawSolution o) { |
||
| 54 | OverlappingSetSchedule schedule = (OverlappingSetSchedule) o; |
||
| 55 | return this.constraints.size() > schedule.constraints.size() ? -1 : |
||
| 56 | this.constraints.size() < schedule.constraints.size() ? 1 : 0; |
||
| 57 | } |
||
| 59 |