public TimePeriod(Date startTime,Date endTime){
  if (startTime != null && endTime != null && !endTime.after(startTime)) {
    throw new IllegalArgumentException("EndTime: " + endTime + " is not after startTime: "+ startTime);
  }
  this.startTime=startTime;
  this.endTime=endTime;
}

public TimePeriod ( Date startTime , Date endTime ) { if ( startTime != null && endTime != null && ! endTime . after ( startTime ) ) { throw new IllegalArgumentException ( "EndTime: " + endTime + " is not after startTime: " + startTime ) ; } this . startTime = startTime ; this . endTime = endTime ; }
creates time interval [ starttime , endtime ) if times are not null . creates time interval ( - inf , endtime ) if start time is null . creates time interval [ starttime , + inf ) if end time is null . creates time interval ( - inf , + inf ) if both times are null .
