@Test public void shouldCalculateDurationAgainstDoubleValue() { Double aDouble = DVUtil.calculateDuration("1,d", 1, "-"); assertThat(aDouble, equalTo(8.64E7)); }
public static Double calculateDuration(String value, Object operationValue, String symbol) { if (operationValue instanceof DvQuantity) { return calculateDurationAgainstQuantity(value, (DvQuantity) operationValue, symbol); } else if (operationValue instanceof Number) { return calculateDurationAgainstNumber(value); } else if (operationValue instanceof String) { return calculateDurationAgainstStringDateTime(value, operationValue, symbol); } else if (operationValue instanceof DvTemporal) { return calculateDurationAgainstDvTemporal(value, (DvTemporal) operationValue, symbol); } else { throw new RuntimeException(format("Invalid duration value '%s' used.", operationValue)); } }
DVUtil { public static Double calculateDuration(String value, Object operationValue, String symbol) { if (operationValue instanceof DvQuantity) { return calculateDurationAgainstQuantity(value, (DvQuantity) operationValue, symbol); } else if (operationValue instanceof Number) { return calculateDurationAgainstNumber(value); } else if (operationValue instanceof String) { return calculateDurationAgainstStringDateTime(value, operationValue, symbol); } else if (operationValue instanceof DvTemporal) { return calculateDurationAgainstDvTemporal(value, (DvTemporal) operationValue, symbol); } else { throw new RuntimeException(format("Invalid duration value '%s' used.", operationValue)); } } }
DVUtil { public static Double calculateDuration(String value, Object operationValue, String symbol) { if (operationValue instanceof DvQuantity) { return calculateDurationAgainstQuantity(value, (DvQuantity) operationValue, symbol); } else if (operationValue instanceof Number) { return calculateDurationAgainstNumber(value); } else if (operationValue instanceof String) { return calculateDurationAgainstStringDateTime(value, operationValue, symbol); } else if (operationValue instanceof DvTemporal) { return calculateDurationAgainstDvTemporal(value, (DvTemporal) operationValue, symbol); } else { throw new RuntimeException(format("Invalid duration value '%s' used.", operationValue)); } }  }
DVUtil { public static Double calculateDuration(String value, Object operationValue, String symbol) { if (operationValue instanceof DvQuantity) { return calculateDurationAgainstQuantity(value, (DvQuantity) operationValue, symbol); } else if (operationValue instanceof Number) { return calculateDurationAgainstNumber(value); } else if (operationValue instanceof String) { return calculateDurationAgainstStringDateTime(value, operationValue, symbol); } else if (operationValue instanceof DvTemporal) { return calculateDurationAgainstDvTemporal(value, (DvTemporal) operationValue, symbol); } else { throw new RuntimeException(format("Invalid duration value '%s' used.", operationValue)); } }  static DataValue createDV(
            ElementInstance elementInstance, String rmName, String attributeName, Object value); static boolean equalDVs(DataValue dv1, DataValue dv2); static boolean equalDV(boolean inPredicate, ElementInstance ei, DataValue dv2, boolean negated); static boolean nullValueEquals(DvCodedText nullFlavour, Object obj); @Deprecated static boolean isSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            DataValue... dataValues); static boolean isSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            String bindReference, DataValue... dataValues); static boolean isSubClassOf(boolean inPredicate, ElementInstance ei, DataValue... dataValues); static boolean isSubClassOfCached(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            boolean negation, String bindReference, DataValue... dataValues); @Deprecated static boolean isNotSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap, DataValue... dataValues); static boolean isNotSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap, String bindReference, DataValue... dataValues); static boolean isNotSubClassOf(boolean inPredicate, ElementInstance ei, DataValue... dataValues); @SuppressWarnings({"rawtypes", "unchecked"}) static int compareDVs(DataValue dv1, DataValue dv2); static boolean compatibleComparison(DataValue dv1, DataValue dv2); static double round(double unroundedDouble, int precision); static ConstantExpression convertToExpression(DataValue dv); static boolean checkMaxMin(DataValue originalDv, DataValue checkDv, String opSymbol, ArchetypeReference originalAr, ArchetypeReference checkAr); static Double calculateDuration(String value, Object operationValue, String symbol); static Double calculateDuration(String value, String symbol); static Long ucumToMilliseconds(DvQuantity quantity); }
DVUtil { public static Double calculateDuration(String value, Object operationValue, String symbol) { if (operationValue instanceof DvQuantity) { return calculateDurationAgainstQuantity(value, (DvQuantity) operationValue, symbol); } else if (operationValue instanceof Number) { return calculateDurationAgainstNumber(value); } else if (operationValue instanceof String) { return calculateDurationAgainstStringDateTime(value, operationValue, symbol); } else if (operationValue instanceof DvTemporal) { return calculateDurationAgainstDvTemporal(value, (DvTemporal) operationValue, symbol); } else { throw new RuntimeException(format("Invalid duration value '%s' used.", operationValue)); } }  static DataValue createDV(
            ElementInstance elementInstance, String rmName, String attributeName, Object value); static boolean equalDVs(DataValue dv1, DataValue dv2); static boolean equalDV(boolean inPredicate, ElementInstance ei, DataValue dv2, boolean negated); static boolean nullValueEquals(DvCodedText nullFlavour, Object obj); @Deprecated static boolean isSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            DataValue... dataValues); static boolean isSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            String bindReference, DataValue... dataValues); static boolean isSubClassOf(boolean inPredicate, ElementInstance ei, DataValue... dataValues); static boolean isSubClassOfCached(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap,
            boolean negation, String bindReference, DataValue... dataValues); @Deprecated static boolean isNotSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap, DataValue... dataValues); static boolean isNotSubClassOf(
            boolean inPredicate, ElementInstance ei, Map<ElementInstance, Map<String, Boolean>> bindingsMap, String bindReference, DataValue... dataValues); static boolean isNotSubClassOf(boolean inPredicate, ElementInstance ei, DataValue... dataValues); @SuppressWarnings({"rawtypes", "unchecked"}) static int compareDVs(DataValue dv1, DataValue dv2); static boolean compatibleComparison(DataValue dv1, DataValue dv2); static double round(double unroundedDouble, int precision); static ConstantExpression convertToExpression(DataValue dv); static boolean checkMaxMin(DataValue originalDv, DataValue checkDv, String opSymbol, ArchetypeReference originalAr, ArchetypeReference checkAr); static Double calculateDuration(String value, Object operationValue, String symbol); static Double calculateDuration(String value, String symbol); static Long ucumToMilliseconds(DvQuantity quantity);  }