本文整理汇总了Java中org.joda.time.DateTimeField.set方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeField.set方法的具体用法?Java DateTimeField.set怎么用?Java DateTimeField.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTimeField
的用法示例。
在下文中一共展示了DateTimeField.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaximumValue
import org.joda.time.DateTimeField; //导入方法依赖的package包/类
public int getMaximumValue(ReadablePartial partial, int[] values) {
Chronology chrono = GJChronology.getInstanceUTC();
long instant = 0L;
for (int i = 0, isize = partial.size(); i < isize; i++) {
DateTimeField field = partial.getFieldType(i).getField(chrono);
if (values[i] <= field.getMaximumValue(instant)) {
instant = field.set(instant, values[i]);
}
}
return getMaximumValue(instant);
}
示例2: setValue
import org.joda.time.DateTimeField; //导入方法依赖的package包/类
/**
* Sets the value of the field at the specified index.
* <p>
* In version 2.0 and later, this method copies the array into the original.
* This is because the instance variable has been changed to be final to satisfy the Java Memory Model.
* This only impacts subclasses that are mutable.
*
* @param index the index
* @param value the value to set
* @throws IndexOutOfBoundsException if the index is invalid
*/
protected void setValue(int index, int value) {
DateTimeField field = getField(index);
int[] values = field.set(this, index, iValues, value);
System.arraycopy(values, 0, iValues, 0, iValues.length);
}