| Total Complexity | 18 |
| Total Lines | 147 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package it.cnr.istc.pst.platinum.ai.framework.time.tn; |
||
| 8 | public class TimePoint extends TemporalData |
||
|
|
|||
| 9 | { |
||
| 10 | private long domLb; |
||
| 11 | private long domUb; |
||
| 12 | |||
| 13 | // computed values |
||
| 14 | private long lb; |
||
| 15 | private long ub; |
||
| 16 | private double execTime; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * |
||
| 20 | * @param id |
||
| 21 | * @param lb |
||
| 22 | * @param ub |
||
| 23 | */ |
||
| 24 | protected TimePoint(int id, long lb, long ub) { |
||
| 25 | super(id); |
||
| 26 | this.domLb = lb; |
||
| 27 | this.domUb = ub; |
||
| 28 | // initialize data |
||
| 29 | this.lb = this.domLb; |
||
| 30 | this.ub = this.domUb; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * |
||
| 35 | * @param lb |
||
| 36 | * @param ub |
||
| 37 | */ |
||
| 38 | public void clear(long lb, long ub) { |
||
| 39 | this.domLb = lb; |
||
| 40 | this.domUb = ub; |
||
| 41 | this.lb = this.domLb; |
||
| 42 | this.ub = this.domUb; |
||
| 43 | this.execTime = 0; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * |
||
| 48 | * @param lb |
||
| 49 | */ |
||
| 50 | protected void setDomLb(long lb) { |
||
| 51 | this.domLb = lb; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * |
||
| 56 | * @param ub |
||
| 57 | */ |
||
| 58 | protected void setDomUb(long ub) { |
||
| 59 | this.domUb = ub; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * |
||
| 64 | * @return |
||
| 65 | */ |
||
| 66 | public long getDomLb() { |
||
| 67 | return this.domLb; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * |
||
| 72 | * @return |
||
| 73 | */ |
||
| 74 | public long getDomUb() { |
||
| 75 | return this.domUb; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * |
||
| 80 | * @param lb |
||
| 81 | */ |
||
| 82 | public void setLowerBound(long lb) { |
||
| 83 | this.lb = lb; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * |
||
| 88 | * @return |
||
| 89 | */ |
||
| 90 | public long getLowerBound() { |
||
| 91 | return lb; |
||
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * |
||
| 96 | * @param ub |
||
| 97 | */ |
||
| 98 | public void setUpperBound(long ub) { |
||
| 99 | this.ub = ub; |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * |
||
| 104 | * @return |
||
| 105 | */ |
||
| 106 | public long getUpperBound() { |
||
| 107 | return ub; |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * |
||
| 112 | * @param execTime |
||
| 113 | */ |
||
| 114 | public void setExecTime(double execTime) { |
||
| 115 | this.execTime = execTime; |
||
| 116 | } |
||
| 117 | |||
| 118 | /** |
||
| 119 | * |
||
| 120 | * @return |
||
| 121 | */ |
||
| 122 | public double getExecTime() { |
||
| 123 | return execTime; |
||
| 124 | } |
||
| 125 | |||
| 126 | /** |
||
| 127 | * |
||
| 128 | * @return |
||
| 129 | */ |
||
| 130 | public TimePoint clone() { |
||
| 131 | TimePoint clone = new TimePoint(this.id, this.domLb, this.domUb); |
||
| 132 | clone.setLowerBound(this.lb); |
||
| 133 | clone.setUpperBound(this.ub); |
||
| 134 | clone.setExecTime(this.execTime); |
||
| 135 | return clone; |
||
| 136 | } |
||
| 137 | |||
| 138 | /** |
||
| 139 | * |
||
| 140 | */ |
||
| 141 | @Override |
||
| 142 | public int compareTo(TemporalData o) { |
||
| 143 | // get time point |
||
| 144 | TimePoint p = (TimePoint) o; |
||
| 145 | return this.lb < p.lb ? -1 : this.lb == p.lb && this.ub < p.ub ? -1 : |
||
| 146 | this.lb == p.lb && this.ub == p.ub ? 0 : 1; |
||
| 147 | } |
||
| 148 | |||
| 149 | /** |
||
| 150 | * |
||
| 151 | */ |
||
| 152 | @Override |
||
| 153 | public String toString() { |
||
| 154 | return "[TimePoint id=" + this.id + ", lb= " + this.lb + ", ub= " + this.ub + "]"; |
||
| 155 | } |
||
| 157 |