public TreeNodeOngoing(int clusterId, long min, long mid) throws Exception { this.clusterId = clusterId; this.interval = new TimeInterval(min, (NowReference)null); this.mid = mid; }
public TreeNodeRegular(int clusterId, long min, long max, long mid) throws Exception { this.clusterId = clusterId; this.interval = new TimeInterval(min, max); this.mid = mid; }
static public TimeInterval fromJson(JSONObject jsonInterval) throws Exception { TimeInterval timeInterval = null; boolean ongoing = jsonInterval.optBoolean("ongoing", false); long min = jsonInterval.getLong("min"); if( ongoing ){ timeInterval = new TimeInterval(min, (NowReference)null); } else { long max = jsonInterval.getLong("max"); timeInterval = new TimeInterval(min, max); } return timeInterval; }
public DateStructureElement(JSONObject dateStructure) throws Exception{ this.dateStructure = dateStructure; long min = dateStructure.getLong("min"); boolean ongoing = dateStructure.optBoolean("ongoing",false); if( ongoing ){ this.interval = new TimeInterval(min, (NowReference)null); } else { long max = dateStructure.getLong("max"); this.interval = new TimeInterval(min, max); } int clusterId = dateStructure.optInt("index", -1); if( clusterId >= 0 ){ this.clusterId = clusterId; } }
return new TimeInterval(nextMin, new NowReference(nextMin)); } else { return new TimeInterval(nextMin, nextMax);
interval = new TimeInterval(min,NowReference.now()); } else { interval = new TimeInterval(min,max);
TimeInterval interval = new TimeInterval(0, 1500000000000L); regularNode = new TreeNodeRegular(nextId, interval); ++nextId; TimeInterval interval = new TimeInterval(0, (NowReference)null); ongoingNode = new TreeNodeOngoing(nextId, interval); ++nextId;
public TimeInterval getIntersection(TimeInterval interval, NowReference now) throws Exception { if( !this.intersectsWith(interval, now) ){ return null; }; if( this.isIncludedIn(interval, now) ) { return this; } else if(interval.isIncludedIn(this, now)) { return interval; } else { long min = this.min; long max = this.getMax(now); if( min < interval.min ){ min = interval.min; }; if( max > interval.getMax(now) ){ max = interval.max; }; return new TimeInterval(min,max); } }
fullRegularInterval = new TimeInterval(0, 1500000000000L); fullOngoingInterval = new TimeInterval(0, (NowReference)null);