/** * Create a Duration from two instances of DvWorldTime * * @param start * @param end */ public static DvDuration getDifference(DvTemporal start, DvTemporal end) { Duration d = new Duration(start.getDateTime(), end.getDateTime()); return new DvDuration(null, null, null, 0.0, false, null, d.toPeriodFrom(start.getDateTime())); }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; final DvDate dDate = (DvDate) o; return new EqualsBuilder() .append(isPartial, dDate.isPartial) .append(monthKnown, dDate.monthKnown) .append(dayKnown, dDate.dayKnown) .isEquals(); }
/** * IsEquivalent for DvTime is valid only for point of time within one single day. * For example, 00:00:01Z(for 1970-01-01) is supposed to be equivalent to the * point of datetime 23:00:01-01(on 1969-12-31). However, because no date is involved * in DvTime, 23:00:01-01 can only be treated as 23:00:01-01(of the same day as the other * DvTime in comparison). So 23:00:01-01 is simply interpreted as a point of time on * 1970-01-01 in a zone an hour behind UTC. * */ public boolean isEquivalent(Object o) { return super.isEquivalent(o); }
/** * Construct a WorldTime string value * * @param otherReferenceRanges * null if not specified * @param normalReference * @param accuracy * 0 if not specified * @param accuracyPercent * @param value * @param pattern * @throws IllegalArgumentException */ public DvTemporal(List<ReferenceRange<T>> otherReferenceRanges, DvInterval<T> normalRange, CodePhrase normalStatus, DvDuration accuracy, String magnitudeStatus, String value) { super(otherReferenceRanges, normalRange, normalStatus, accuracy, magnitudeStatus); this.dateTime = parseStringValue(value); this.value = value; setBooleans(value); }
/** * Output DvDate in extended date format if a DvDate is not constructed * via the single String constructor. */ public String toString(boolean isExtended) { String date = super.toString(); if (isExtended) { date = DvDateTimeParser.basicToExtendedDate(date); } else { date = date.replace("-", ""); } return date; }
/** * Construct a WorldTime string value * * @param otherReferenceRanges * null if not specified * @param normalReference * @param accuracy * 0 if not specified * @param accuracyPercent * @param value * @param pattern * @throws IllegalArgumentException */ public DvTemporal(List<ReferenceRange<T>> otherReferenceRanges, DvInterval<T> normalRange, CodePhrase normalStatus, DvDuration accuracy, String magnitudeStatus, String value) { super(otherReferenceRanges, normalRange, normalStatus, accuracy, magnitudeStatus); this.dateTime = parseStringValue(value); this.value = value; setBooleans(value); }
public String toString(boolean isExtended) { String dt = super.toString(); if (isExtended) { dt = DvDateTimeParser.basicToExtendedDateTime(dt); } else { dt = dt.replace(":", "").replace("-", ""); } return dt; }
/** * Create a Duration from two instances of DvWorldTime * * @param start * @param end */ public static DvDuration getDifference(DvTemporal start, DvTemporal end) { Duration d = new Duration(start.getDateTime(), end.getDateTime()); return new DvDuration(null, null, null, 0.0, false, null, d.toPeriodFrom(start.getDateTime())); }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; final DvDate dDate = (DvDate) o; return new EqualsBuilder() .append(isPartial, dDate.isPartial) .append(monthKnown, dDate.monthKnown) .append(dayKnown, dDate.dayKnown) .isEquals(); }
public String toString(boolean isExtended) { String time = super.toString(); if (isExtended) { time = DvDateTimeParser.basicToExtendedTime(time); } else { time = time.replace(":", ""); } return time; }
/** * Two DvTemporal are equal if both indicate the same point of * datetime. This function should be overwritten in subclass. * * @param o * @return true if equals */ public boolean equals(Object o) { return isEquivalent(o); }
/** * Compares this object with the specified object for order. Returns a * negative integer, zero, or a positive integer as this object is less * than, equal to, or greater than the specified object. * * @param o * the Object to be compared. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. * @throws ClassCastException * if the specified object's type prevents it from being * compared to this Object. */ public int compareTo(DvOrdered o) { DvTemporal d = (DvTemporal) o; return getDateTime().compareTo(d.getDateTime()); }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; final DvDateTime dt = (DvDateTime) o; return new EqualsBuilder().append( this.getDateTime().getZone().hashCode(), this.getDateTime().getZone().hashCode()).append(isPartial, dt.isPartial).append(minuteKnown, dt.minuteKnown).append( secondKnown, dt.secondKnown).append(fractionalSecKnown, dt.fractionalSecKnown).isEquals(); }
public String toString(boolean isExtended) { String dt = super.toString(); if (isExtended) { dt = DvDateTimeParser.basicToExtendedDateTime(dt); } else { dt = dt.replace(":", "").replace("-", ""); } return dt; }
/** * IsEquivalent for DvTime is valid only for point of time within one single day. * For example, 00:00:01Z(for 1970-01-01) is supposed to be equivalent to the * point of datetime 23:00:01-01(on 1969-12-31). However, because no date is involved * in DvTime, 23:00:01-01 can only be treated as 23:00:01-01(of the same day as the other * DvTime in comparison). So 23:00:01-01 is simply interpreted as a point of time on * 1970-01-01 in a zone an hour behind UTC. * */ public boolean isEquivalent(Object o) { return super.isEquivalent(o); }
static DateTime getDateTime(DvTemporal operationDataValue, String value) { if (operationDataValue instanceof DvDateTime) { return operationDataValue.getDateTime(); } else if (operationDataValue instanceof DvDate) { return operationDataValue.getDateTime(); } else if (operationDataValue instanceof DvTime) { return operationDataValue.getDateTime(); } else { if (operationDataValue == null) { throw new IllegalArgumentException( format("Cannot use null data value to evaluate expression %s", value)); } else { throw new IllegalArgumentException( format("Cannot use data value with class %s to evaluate expression %s", operationDataValue.getClass().getName(), value)); } } }
@Override public boolean equals(Object o) { if (!super.equals(o)) return false; final DvDateTime dt = (DvDateTime) o; return new EqualsBuilder().append( this.getDateTime().getZone().hashCode(), this.getDateTime().getZone().hashCode()).append(isPartial, dt.isPartial).append(minuteKnown, dt.minuteKnown).append( secondKnown, dt.secondKnown).append(fractionalSecKnown, dt.fractionalSecKnown).isEquals(); }
public String toString(boolean isExtended) { String time = super.toString(); if (isExtended) { time = DvDateTimeParser.basicToExtendedTime(time); } else { time = time.replace(":", ""); } return time; }
/** * Two DvTemporal are equal if both indicate the same point of * datetime. This function should be overwritten in subclass. * * @param o * @return true if equals */ public boolean equals(Object o) { return isEquivalent(o); }
/** * Compares this object with the specified object for order. Returns a * negative integer, zero, or a positive integer as this object is less * than, equal to, or greater than the specified object. * * @param o * the Object to be compared. * @return a negative integer, zero, or a positive integer as this object is * less than, equal to, or greater than the specified object. * @throws ClassCastException * if the specified object's type prevents it from being * compared to this Object. */ public int compareTo(DvOrdered o) { DvTemporal d = (DvTemporal) o; return getDateTime().compareTo(d.getDateTime()); }