当前位置: 首页>>代码示例>>Java>>正文


Java DurationFieldType.seconds方法代码示例

本文整理汇总了Java中org.joda.time.DurationFieldType.seconds方法的典型用法代码示例。如果您正苦于以下问题:Java DurationFieldType.seconds方法的具体用法?Java DurationFieldType.seconds怎么用?Java DurationFieldType.seconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.DurationFieldType的用法示例。


在下文中一共展示了DurationFieldType.seconds方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_compareTo

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_compareTo() {
        assertEquals(0, MillisDurationField.INSTANCE.compareTo(MillisDurationField.INSTANCE));
        assertEquals(-1, MillisDurationField.INSTANCE.compareTo(ISOChronology.getInstance().seconds()));
        DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
        assertEquals(1, MillisDurationField.INSTANCE.compareTo(dummy));
//        try {
//            MillisDurationField.INSTANCE.compareTo("");
//            fail();
//        } catch (ClassCastException ex) {}
        try {
            MillisDurationField.INSTANCE.compareTo(null);
            fail();
        } catch (NullPointerException ex) {}
    }
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:15,代码来源:TestMillisDurationField.java

示例2: test_equals

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_equals() {
    assertEquals(true, iField.equals(iField));
    assertEquals(false, iField.equals(ISOChronology.getInstance().minutes()));
    DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
    assertEquals(false, iField.equals(dummy));
    dummy = new PreciseDurationField(DurationFieldType.seconds(), 1000);
    assertEquals(true, iField.equals(dummy));
    dummy = new PreciseDurationField(DurationFieldType.millis(), 1000);
    assertEquals(false, iField.equals(dummy));
    assertEquals(false, iField.equals(""));
    assertEquals(false, iField.equals(null));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestPreciseDurationField.java

示例3: test_hashCode

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_hashCode() {
    assertEquals(true, iField.hashCode() == iField.hashCode());
    assertEquals(false, iField.hashCode() == ISOChronology.getInstance().minutes().hashCode());
    DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
    assertEquals(false, iField.hashCode() == dummy.hashCode());
    dummy = new PreciseDurationField(DurationFieldType.seconds(), 1000);
    assertEquals(true, iField.hashCode() == dummy.hashCode());
    dummy = new PreciseDurationField(DurationFieldType.millis(), 1000);
    assertEquals(false, iField.hashCode() == dummy.hashCode());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:11,代码来源:TestPreciseDurationField.java

示例4: test_compareTo

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_compareTo() {
        assertEquals(0, iField.compareTo(iField));
        assertEquals(-1, iField.compareTo(ISOChronology.getInstance().minutes()));
        DurationField dummy = new PreciseDurationField(DurationFieldType.seconds(), 0);
        assertEquals(1, iField.compareTo(dummy));
//        try {
//            iField.compareTo("");
//            fail();
//        } catch (ClassCastException ex) {}
        try {
            iField.compareTo(null);
            fail();
        } catch (NullPointerException ex) {}
    }
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:15,代码来源:TestPreciseDurationField.java

示例5: MockPreciseDurationDateTimeField

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
protected MockPreciseDurationDateTimeField() {
    super(DateTimeFieldType.secondOfMinute(),
        new MockCountingDurationField(DurationFieldType.seconds()));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:5,代码来源:TestPreciseDurationDateTimeField.java

示例6: MockPreciseDateTimeField

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
protected MockPreciseDateTimeField() {
    super(DateTimeFieldType.secondOfMinute(),
        new MockCountingDurationField(DurationFieldType.seconds(), 60),
        new MockCountingDurationField(DurationFieldType.minutes(), 60 * 60));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:6,代码来源:TestPreciseDateTimeField.java

示例7: setUp

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    iField = new PreciseDurationField(DurationFieldType.seconds(), 1000);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:TestPreciseDurationField.java

示例8: getDurationField

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public DurationField getDurationField() {
    return new MockCountingDurationField(DurationFieldType.seconds());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:TestBaseDateTimeField.java

示例9: DateTimeConvertor

import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public DateTimeConvertor(DateTimeFormatSpec inputFormat, DateTimeFormatSpec outputFormat,
    DateTimeGranularitySpec outputGranularity) {

  inputTimeSize = inputFormat.getColumnSize();
  inputTimeUnit = inputFormat.getColumnUnit();
  TimeFormat inputTimeFormat = inputFormat.getTimeFormat();
  if (inputTimeFormat.equals(TimeFormat.SIMPLE_DATE_FORMAT)) {
    inputDateTimeFormatter = inputFormat.getDateTimeFormatter();
  }

  outputTimeSize = outputFormat.getColumnSize();
  outputTimeUnit = outputFormat.getColumnDateTimeTransformUnit();
  TimeFormat outputTimeFormat = outputFormat.getTimeFormat();
  if (outputTimeFormat.equals(TimeFormat.EPOCH)) {
    DurationFieldType durationFieldType;
    switch (outputTimeUnit) {

    case YEARS:
      durationFieldType = DurationFieldType.years();
      break;
    case MONTHS:
      durationFieldType = DurationFieldType.months();
      break;
    case WEEKS:
      durationFieldType = DurationFieldType.weeks();
      break;
    case DAYS:
      durationFieldType = DurationFieldType.days();
      break;
    case HOURS:
      durationFieldType = DurationFieldType.hours();
      break;
    case MINUTES:
      durationFieldType = DurationFieldType.minutes();
      break;
    case SECONDS:
      durationFieldType = DurationFieldType.seconds();
      break;
    case MILLISECONDS:
      durationFieldType = DurationFieldType.millis();
      break;
    default:
      throw new IllegalArgumentException("Illegal argument for time unit: " + outputTimeUnit);
    }
    outputDurationField = durationFieldType.getField(EPOCH_START_CHRONOLOGY);

  } else {
    outputDateTimeFormatter = outputFormat.getDateTimeFormatter();
  }

  outputGranularityMillis = outputGranularity.granularityToMillis();
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:53,代码来源:DateTimeConvertor.java


注:本文中的org.joda.time.DurationFieldType.seconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。