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


Java ReadablePartial.getValue方法代码示例

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


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

示例1: equals

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Compares this ReadablePartial with another returning true if the chronology,
 * field types and values are equal.
 *
 * @param partial  an object to check against
 * @return true if fields and values are equal
 */
public boolean equals(Object partial) {
    if (this == partial) {
        return true;
    }
    if (partial instanceof ReadablePartial == false) {
        return false;
    }
    ReadablePartial other = (ReadablePartial) partial;
    if (size() != other.size()) {
        return false;
    }
    for (int i = 0, isize = size(); i < isize; i++) {
        if (getValue(i) != other.getValue(i) || getFieldType(i) != other.getFieldType(i)) {
            return false;
        }
    }
    return FieldUtils.equals(getChronology(), other.getChronology());
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:26,代码来源:AbstractPartial.java

示例2: compareTo

import org.joda.time.ReadablePartial; //导入方法依赖的package包/类
/**
 * Compares this partial with another returning an integer
 * indicating the order.
 * <p>
 * The fields are compared in order, from largest to smallest.
 * The first field that is non-equal is used to determine the result.
 * <p>
 * The specified object must be a partial instance whose field types
 * match those of this partial.
 * <p>
 * NOTE: Prior to v2.0, the {@code Comparable} interface was only implemented
 * in this class and not in the {@code ReadablePartial} interface.
 *
 * @param other  an object to check against
 * @return negative if this is less, zero if equal, positive if greater
 * @throws ClassCastException if the partial is the wrong class
 *  or if it has field types that don't match
 * @throws NullPointerException if the partial is null
 * @since 1.1
 */
public int compareTo(ReadablePartial other) {
    if (this == other) {
        return 0;
    }
    if (size() != other.size()) {
        throw new ClassCastException("ReadablePartial objects must have matching field types");
    }
    for (int i = 0, isize = size(); i < isize; i++) {
        if (getFieldType(i) != other.getFieldType(i)) {
            throw new ClassCastException("ReadablePartial objects must have matching field types");
        }
    }
    // fields are ordered largest first
    for (int i = 0, isize = size(); i < isize; i++) {
        if (getValue(i) > other.getValue(i)) {
            return 1;
        }
        if (getValue(i) < other.getValue(i)) {
            return -1;
        }
    }
    return 0;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:44,代码来源:AbstractPartial.java


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