예제 #1
0
  /** Constructor for a range of dates, beginning at date start and finishing at date end */
  public ISODateInstance(ISODateInstance start, ISODateInstance end) {
    String startString = start.getDateString();
    if (start.isRange()) {
      startString = start.getStartDate();
    }
    String endString = end.getDateString();
    if (end.isRange()) {
      endString = end.getEndDate();
    }

    isoDate = startString + '/' + endString;
    unparseable = (start.isUnparseable() || end.isUnparseable());
  }
예제 #2
0
  /**
   * Looks if the days for the two dates are compatible. This method does not consider ranges and
   * uses only the start date.
   */
  public boolean isDayCompatible(ISODateInstance other) {
    if (this.isUnparseable() || other.isUnparseable()) {
      return this.isoDate.equals(other.isoDate);
    }

    return isDayCompatible(isoDate, other.getDateString());
  }
예제 #3
0
  public boolean isCompatibleDate(ISODateInstance other) {
    if (this.isUnparseable() || other.isUnparseable()) {
      return this.isoDate.equals(other.isoDate);
    }

    // first see if either is a range
    if (this.isRange()) {
      return this.contains(other);
    } else if (other.isRange()) {
      return false; // not compatible if other is range and this isn't
    } else {
      return isCompatible(isoDate, other.getDateString());
    }
  }