Equal returns true only if the two execution segments have the same from and to values.
(other *ExecutionSegment)
| 197 | // Equal returns true only if the two execution segments have the same from and |
| 198 | // to values. |
| 199 | func (es *ExecutionSegment) Equal(other *ExecutionSegment) bool { |
| 200 | if es == other { |
| 201 | return true |
| 202 | } |
| 203 | thisFrom, otherFrom, thisTo, otherTo := zeroRat, zeroRat, oneRat, oneRat |
| 204 | if es != nil { |
| 205 | thisFrom, thisTo = es.from, es.to |
| 206 | } |
| 207 | if other != nil { |
| 208 | otherFrom, otherTo = other.from, other.to |
| 209 | } |
| 210 | return thisFrom.Cmp(otherFrom) == 0 && thisTo.Cmp(otherTo) == 0 |
| 211 | } |
| 212 | |
| 213 | // SubSegment returns a new execution sub-segment - if a is (1/2:1] and b is |
| 214 | // (0:1/2], then a.SubSegment(b) will return a new segment (1/2, 3/4]. |
no outgoing calls