protected DvDuration(List<ReferenceRange<DvDuration>> referenceRanges, DvInterval<DvDuration> normalRange, CodePhrase normalStatus, double accuracy, boolean accuracyPercent, String magnitudeStatus, Period period) { super(referenceRanges, normalRange, normalStatus, accuracy, accuracyPercent, magnitudeStatus); this.period = period; setValue(ISOPeriodFormat.standard().print(period).replace(".", ",")); }
protected DvDuration(List<ReferenceRange<DvDuration>> referenceRanges, DvInterval<DvDuration> normalRange, CodePhrase normalStatus, double accuracy, boolean accuracyPercent, String magnitudeStatus, Period period) { super(referenceRanges, normalRange, normalStatus, accuracy, accuracyPercent, magnitudeStatus); this.period = period; setValue(ISOPeriodFormat.standard().print(period).replace(".", ",")); }
setValue(ISOPeriodFormat.standard().print(period).replace(".", ","));
setValue(ISOPeriodFormat.standard().print(period).replace(".", ","));
/** * Create a Duration from a ISO8601 string presentation * * @param value * @throws IllegalArgumentException * if value null or wrong format */ public static DvDuration getInstance(String value) { if (value == null) { throw new IllegalArgumentException("null value"); } if (!value.matches(PATTERN)) { throw new IllegalArgumentException("Wrong duration format: " + value); } Period period = null; final String suppliedValue = value; if (value.startsWith("-")) { value = value.substring(1, value.length()); // skip '-' period = ISOPeriodFormat.standard().parsePeriod(value); period = negatePeriod(period); } else { period = ISOPeriodFormat.standard().parsePeriod(value); } DvDuration duration = new DvDuration(null, null, null, 0.0, false, null, period); duration.setValue(suppliedValue); // If we don't set this we cannot reconstruct the original constraint if 0s or 0h etc if all the same period, but the constraint in the ADL / XML serialisation still looks different return duration; }
/** * Create a Duration from a ISO8601 string presentation * * @param value * @throws IllegalArgumentException * if value null or wrong format */ public static DvDuration getInstance(String value) { if (value == null) { throw new IllegalArgumentException("null value"); } if (!value.matches(PATTERN)) { throw new IllegalArgumentException("Wrong duration format: " + value); } Period period = null; final String suppliedValue = value; if (value.startsWith("-")) { value = value.substring(1, value.length()); // skip '-' period = ISOPeriodFormat.standard().parsePeriod(value); period = negatePeriod(period); } else { period = ISOPeriodFormat.standard().parsePeriod(value); } DvDuration duration = new DvDuration(null, null, null, 0.0, false, null, period); duration.setValue(suppliedValue); // If we don't set this we cannot reconstruct the original constraint if 0s or 0h etc if all the same period, but the constraint in the ADL / XML serialisation still looks different return duration; }