@Test public void testEncodeDuration() { Long d1 = 2743414L; assertEquals(d1, decodeDuration(encodeDuration(d1).getValue())); Long d2 = 78534795325L; assertEquals(d2, decodeDuration(encodeDuration(d2).getValue())); Long d3 = 234L; assertEquals(d3, decodeDuration(encodeDuration(d3).getValue())); assertEquals(new Long(1 * 1000 * 60 * 60 + 10 * 1000 * 60 + 5 * 1000), decodeDuration("01:10:05")); assertEquals(Opt.some(DublinCore.ENC_SCHEME_ISO8601), encodeDuration(d3).getEncodingScheme()); assertNull(decodeDuration(DublinCoreValue.mk("bla"))); assertNull(decodeDuration(DublinCoreValue.mk(encodeDuration(d1).getValue(), DublinCore.LANGUAGE_UNDEFINED, DublinCore.ENC_SCHEME_BOX))); }
public static DublinCoreValue encodeDuration(long duration) { return DublinCoreValue.mk(ISOPeriodFormat.standard().print(new Duration(duration).toPeriod()), DublinCore.LANGUAGE_UNDEFINED, Opt.some(DublinCore.ENC_SCHEME_ISO8601)); }
EncodingSchemeUtils { public static DublinCoreValue encodeDuration(long duration) { return DublinCoreValue.mk(ISOPeriodFormat.standard().print(new Duration(duration).toPeriod()), DublinCore.LANGUAGE_UNDEFINED, Opt.some(DublinCore.ENC_SCHEME_ISO8601)); } }
EncodingSchemeUtils { public static DublinCoreValue encodeDuration(long duration) { return DublinCoreValue.mk(ISOPeriodFormat.standard().print(new Duration(duration).toPeriod()), DublinCore.LANGUAGE_UNDEFINED, Opt.some(DublinCore.ENC_SCHEME_ISO8601)); } private  EncodingSchemeUtils(); }
EncodingSchemeUtils { public static DublinCoreValue encodeDuration(long duration) { return DublinCoreValue.mk(ISOPeriodFormat.standard().print(new Duration(duration).toPeriod()), DublinCore.LANGUAGE_UNDEFINED, Opt.some(DublinCore.ENC_SCHEME_ISO8601)); } private  EncodingSchemeUtils(); static DublinCoreValue encodeDate(Date date, Precision precision); static String formatDate(Date date, Precision precision); static DublinCoreValue encodePeriod(DCMIPeriod period, Precision precision); static DublinCoreValue encodeDuration(long duration); static Long decodeDuration(String value); static Long decodeDuration(DublinCoreValue value); static Long decodeMandatoryDuration(String value); static Date decodeDate(DublinCoreValue value); static Date decodeDate(String value); static Date decodeMandatoryDate(DublinCoreValue value); static Date decodeMandatoryDate(String value); static DCMIPeriod decodePeriod(DublinCoreValue value); static DCMIPeriod decodePeriod(String value); static DCMIPeriod decodeMandatoryPeriod(DublinCoreValue value); static DCMIPeriod decodeMandatoryPeriod(String value); static Temporal decodeTemporal(DublinCoreValue value); static Temporal decodeMandatoryTemporal(DublinCoreValue value); }
EncodingSchemeUtils { public static DublinCoreValue encodeDuration(long duration) { return DublinCoreValue.mk(ISOPeriodFormat.standard().print(new Duration(duration).toPeriod()), DublinCore.LANGUAGE_UNDEFINED, Opt.some(DublinCore.ENC_SCHEME_ISO8601)); } private  EncodingSchemeUtils(); static DublinCoreValue encodeDate(Date date, Precision precision); static String formatDate(Date date, Precision precision); static DublinCoreValue encodePeriod(DCMIPeriod period, Precision precision); static DublinCoreValue encodeDuration(long duration); static Long decodeDuration(String value); static Long decodeDuration(DublinCoreValue value); static Long decodeMandatoryDuration(String value); static Date decodeDate(DublinCoreValue value); static Date decodeDate(String value); static Date decodeMandatoryDate(DublinCoreValue value); static Date decodeMandatoryDate(String value); static DCMIPeriod decodePeriod(DublinCoreValue value); static DCMIPeriod decodePeriod(String value); static DCMIPeriod decodeMandatoryPeriod(DublinCoreValue value); static DCMIPeriod decodeMandatoryPeriod(String value); static Temporal decodeTemporal(DublinCoreValue value); static Temporal decodeMandatoryTemporal(DublinCoreValue value);  }