public SimpleTimePeriod(SimpleTime start, SimpleTime end) { if (start.TotalSecond <= end.TotalSecond) { this.end = end; this.start = start; } else { this.end = start; this.start = end; } }
public bool isBetween(SimpleTime t1, SimpleTime t2) { int s1 = t1.TotalSecond; int s2 = t2.TotalSecond; int s = this.TotalSecond; return (s1 <= s && s <= s2) || (s1 >= s && s >= s2); }
public bool isBefore(SimpleTime anotherTime) { return this.TotalSecond <= anotherTime.TotalSecond; }
public SimpleTime getAfter(SimpleTime time) { return new SimpleTime(this.TotalSecond + time.TotalSecond); }
public SimpleTime getBefore(SimpleTime time) { return new SimpleTime(this.TotalSecond - time.TotalSecond); }
public SimpleTimePeriod(SimpleTime start, SimpleTime end, String name) : this(start, end){ this.name = name; }