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


Java ReadableInstant.get方法代码示例

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


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

示例1: compareTo

import org.joda.time.ReadableInstant; //导入方法依赖的package包/类
/**
 * Compare this field to the same field on another 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 instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant 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 or the instant
 *  doesn't support the field of this property
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:28,代码来源:AbstractPartialFieldProperty.java

示例2: compareTo

import org.joda.time.ReadableInstant; //导入方法依赖的package包/类
/**
 * Compare this field to the same field on another 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 instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant 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
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:27,代码来源:AbstractReadableInstantFieldProperty.java


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