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


Java ReadablePartial.get方法代码示例

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


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

示例1: getDateTimeMillis

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
private long getDateTimeMillis(ReadablePartial partial) {
    int year = partial.get(DateTimeFieldType.year());
    int monthOfYear = partial.get(DateTimeFieldType.monthOfYear());
    int dayOfMonth = partial.get(DateTimeFieldType.dayOfMonth());
    int hourOfDay = partial.get(DateTimeFieldType.hourOfDay());
    int minuteOfHour = partial.get(DateTimeFieldType.minuteOfHour());
    int secondOfMinute = partial.get(DateTimeFieldType.secondOfMinute());
    int millisOfSecond = partial.get(DateTimeFieldType.millisOfSecond());
    return partial.getChronology().getDateTimeMillis(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:Joda.java

示例2: getMaximumValue

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
@Override
public int getMaximumValue(ReadablePartial partial) {
    if (partial.isSupported(DateTimeFieldType.monthOfYear())) {
        int month = partial.get(DateTimeFieldType.monthOfYear());
        return this.daysInMonth[month - 1]; // Months are 1-based
    }
    return this.getMaximumValue();
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:9,代码来源:DayOfMonthOfFixedYearDateTimeField.java

示例3: compareTo

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Compare this field to the same field on another partial instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other partial will be queried
 * whether in the same chronology or not.
 * 
 * @param partial  the partial to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the instant is null
 * @throws IllegalArgumentException if the field of this property cannot be queried
 *  on the specified instant
 */
public int compareTo(ReadablePartial partial) {
    if (partial == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = partial.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:29,代码来源:AbstractPartialFieldProperty.java

示例4: compareTo

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Compare this field to the same field on another partial instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other partial will be queried
 * whether in the same chronology or not.
 * 
 * @param partial  the partial to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the partial is null
 * @throws IllegalArgumentException if the partial doesn't support this field
 */
public int compareTo(ReadablePartial partial) {
    if (partial == null) {
        throw new IllegalArgumentException("The partial must not be null");
    }
    int thisValue = get();
    int otherValue = partial.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:28,代码来源:AbstractReadableInstantFieldProperty.java

示例5: getTwoDigitYear

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
private int getTwoDigitYear(ReadablePartial partial) {
    if (partial.isSupported(iType)) {
        try {
            int year = partial.get(iType);
            if (year < 0) {
                year = -year;
            }
            return year % 100;
        } catch (RuntimeException e) {}
    } 
    return -1;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:13,代码来源:DateTimeFormatterBuilder.java

示例6: getValue

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
protected int getValue(ReadablePartial partial) {
    try {
        int value = partial.get(type);
        if (value < 0) {
            value = -value;
        }
        return value;
    } catch (RuntimeException e) {
        return -1;
    }
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:12,代码来源:TwoDigitNumber.java

示例7: getPartialValues

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Extracts the values of the partial from an object of this converter's type.
 * The chrono parameter is a hint to the converter, should it require a
 * chronology to aid in conversion.
 * 
 * @param fieldSource  a partial that provides access to the fields.
 *  This partial may be incomplete and only getFieldType(int) should be used
 * @param object  the object to convert
 * @param chrono  the chronology to use, which is the non-null result of getChronology()
 * @return the array of field values that match the fieldSource, must be non-null valid
 * @throws ClassCastException if the object is invalid
 */
public int[] getPartialValues(ReadablePartial fieldSource, Object object, Chronology chrono) {
    ReadablePartial input = (ReadablePartial) object;
    int size = fieldSource.size();
    int[] values = new int[size];
    for (int i = 0; i < size; i++) {
        values[i] = input.get(fieldSource.getFieldType(i));
    }
    chrono.validate(fieldSource, values);
    return values;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:ReadablePartialConverter.java


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