本文整理汇总了Java中org.joda.time.DurationFieldType.minutes方法的典型用法代码示例。如果您正苦于以下问题:Java DurationFieldType.minutes方法的具体用法?Java DurationFieldType.minutes怎么用?Java DurationFieldType.minutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DurationFieldType
的用法示例。
在下文中一共展示了DurationFieldType.minutes方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeDuration
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
/**
* Creates a Joda duration/period object
*
* @param date object that represents the duration of the period through milisseconds
*/
private void initializeDuration(Date date) {
// Get duration from Date
mDuration = new Duration(date.getTime());
// Get period
final DurationFieldType[] durationFields = new DurationFieldType[]{DurationFieldType.weeks(), DurationFieldType.days(), DurationFieldType.hours(), DurationFieldType.minutes()};
mPeriod = mDuration.toPeriod(PeriodType.forFields(durationFields)).normalizedStandard();
updatePeriod();
}
示例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 ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.minutes(), 2);
assertEquals(false, iField.equals(dummy));
dummy = new ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.minutes(), 90);
assertEquals(true, iField.equals(dummy));
dummy = new ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.millis(), 90);
assertEquals(false, iField.equals(dummy));
assertEquals(false, iField.equals(""));
assertEquals(false, iField.equals(null));
}
示例3: test_hashCode
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_hashCode() {
assertEquals(iField.hashCode(), iField.hashCode());
assertEquals(false, iField.hashCode() == ISOChronology.getInstance().minutes().hashCode());
DurationField dummy = new ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.minutes(), 2);
assertEquals(false, iField.hashCode() == dummy.hashCode());
dummy = new ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.minutes(), 90);
assertEquals(true, iField.hashCode() == dummy.hashCode());
dummy = new ScaledDurationField(MillisDurationField.INSTANCE, DurationFieldType.millis(), 90);
assertEquals(false, iField.hashCode() == dummy.hashCode());
}
示例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.minutes(), 0);
assertEquals(1, iField.compareTo(dummy));
// try {
// iField.compareTo("");
// fail();
// } catch (ClassCastException ex) {}
try {
iField.compareTo(null);
fail();
} catch (NullPointerException ex) {}
}
示例5: test_getType
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_getType() {
BaseDateTimeField field = new MockPreciseDurationDateTimeField(
DateTimeFieldType.secondOfDay(), new MockCountingDurationField(DurationFieldType.minutes()));
assertEquals(DateTimeFieldType.secondOfDay(), field.getType());
}
示例6: test_getName
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_getName() {
BaseDateTimeField field = new MockPreciseDurationDateTimeField(
DateTimeFieldType.secondOfDay(), new MockCountingDurationField(DurationFieldType.minutes()));
assertEquals("secondOfDay", field.getName());
}
示例7: test_toString
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public void test_toString() {
BaseDateTimeField field = new MockPreciseDurationDateTimeField(
DateTimeFieldType.secondOfDay(), new MockCountingDurationField(DurationFieldType.minutes()));
assertEquals("DateTimeField[secondOfDay]", field.toString());
}
示例8: getRangeDurationField
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
public DurationField getRangeDurationField() {
return new MockCountingDurationField(DurationFieldType.minutes());
}
示例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();
}
示例10: MockPreciseDateTimeField
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
protected MockPreciseDateTimeField() {
super(DateTimeFieldType.secondOfMinute(),
new MockCountingDurationField(DurationFieldType.seconds(), 60),
new MockCountingDurationField(DurationFieldType.minutes(), 60 * 60));
}
示例11: setUp
import org.joda.time.DurationFieldType; //导入方法依赖的package包/类
protected void setUp() throws Exception {
DurationField base = MillisDurationField.INSTANCE;
iField = new ScaledDurationField(base, DurationFieldType.minutes(), 90);
}