本文整理了Java中org.joda.time.Partial.getValues()
方法的一些代码示例,展示了Partial.getValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partial.getValues()
方法的具体详情如下:
包路径:org.joda.time.Partial
类名称:Partial
方法名:getValues
[英]Gets an array of the value of each of the fields that this partial supports.
The fields are returned largest to smallest. Each value corresponds to the same array index as getFieldTypes()
[中]获取此部分支持的每个字段的值的数组。
这些字段从最大值返回到最小值。每个值对应于与getFieldTypes()
相同的数组索引
代码示例来源:origin: joda-time/joda-time
/**
* Sets this field in a copy of the Partial.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param value the value to set the field in the copy to
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial setCopy(int value) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, value);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Sets this field in a copy of the Partial to a parsed text value.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param text the text value to set
* @param locale optional locale to use for selecting a text symbol
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the text value isn't valid
*/
public Partial setCopy(String text, Locale locale) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, text, locale);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Sets this field in a copy of the Partial.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param value the value to set the field in the copy to
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial setCopy(int value) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, value);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Sets this field in a copy of the Partial to a parsed text value.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param text the text value to set
* @param locale optional locale to use for selecting a text symbol
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the text value isn't valid
*/
public Partial setCopy(String text, Locale locale) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, text, locale);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Adds to the value of this field in a copy of this Partial.
* <p>
* The value will be added to this field. If the value is too large to be
* added solely to this field then it will affect larger fields.
* Smaller fields are unaffected.
* <p>
* If the result would be too large, beyond the maximum year, then an
* IllegalArgumentException is thrown.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param valueToAdd the value to add to the field in the copy
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial addToCopy(int valueToAdd) {
int[] newValues = iPartial.getValues();
newValues = getField().add(iPartial, iFieldIndex, newValues, valueToAdd);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Adds to the value of this field in a copy of this Partial wrapping
* within this field if the maximum value is reached.
* <p>
* The value will be added to this field. If the value is too large to be
* added solely to this field then it wraps within this field.
* Other fields are unaffected.
* <p>
* For example,
* <code>2004-12-20</code> addWrapField one month returns <code>2004-01-20</code>.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param valueToAdd the value to add to the field in the copy
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial addWrapFieldToCopy(int valueToAdd) {
int[] newValues = iPartial.getValues();
newValues = getField().addWrapField(iPartial, iFieldIndex, newValues, valueToAdd);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Adds to the value of this field in a copy of this Partial.
* <p>
* The value will be added to this field. If the value is too large to be
* added solely to this field then it will affect larger fields.
* Smaller fields are unaffected.
* <p>
* If the result would be too large, beyond the maximum year, then an
* IllegalArgumentException is thrown.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param valueToAdd the value to add to the field in the copy
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial addToCopy(int valueToAdd) {
int[] newValues = iPartial.getValues();
newValues = getField().add(iPartial, iFieldIndex, newValues, valueToAdd);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Adds to the value of this field in a copy of this Partial wrapping
* within this field if the maximum value is reached.
* <p>
* The value will be added to this field. If the value is too large to be
* added solely to this field then it wraps within this field.
* Other fields are unaffected.
* <p>
* For example,
* <code>2004-12-20</code> addWrapField one month returns <code>2004-01-20</code>.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param valueToAdd the value to add to the field in the copy
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial addWrapFieldToCopy(int valueToAdd) {
int[] newValues = iPartial.getValues();
newValues = getField().addWrapField(iPartial, iFieldIndex, newValues, valueToAdd);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* However, it will not wrap around if the top maximum is reached.
*
* @param fieldType the field type to add to, not null
* @param amount the amount to add
* @return a copy of this instance with the field updated
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAdded(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).add(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* If the maximum is reached, the addition will wrap.
*
* @param fieldType the field type to add to, not null
* @param amount the amount to add
* @return a copy of this instance with the field updated
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* However, it will not wrap around if the top maximum is reached.
*
* @param fieldType the field type to add to, not null
* @param amount the amount to add
* @return a copy of this instance with the field updated
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAdded(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).add(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the value of the specified field increased.
* If this partial does not support the field, an exception is thrown.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* The addition will overflow into larger fields (eg. minute to hour).
* If the maximum is reached, the addition will wrap.
*
* @param fieldType the field type to add to, not null
* @param amount the amount to add
* @return a copy of this instance with the field updated
* @throws IllegalArgumentException if the value is null or invalid
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withFieldAddWrapped(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the specified field set to a new value.
* <p>
* If this partial does not support the field, an exception is thrown.
* Contrast this behaviour with {@link #with(DateTimeFieldType, int)}.
* <p>
* For example, if the field type is <code>dayOfMonth</code> then the day
* would be changed in the returned instance if supported.
*
* @param fieldType the field type to set, not null
* @param value the value to set
* @return a copy of this instance with the field set
* @throws IllegalArgumentException if the value is null or invalid
*/
public Partial withField(DateTimeFieldType fieldType, int value) {
int index = indexOfSupported(fieldType);
if (value == getValue(index)) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the specified field set to a new value.
* <p>
* If this partial does not support the field, an exception is thrown.
* Contrast this behaviour with {@link #with(DateTimeFieldType, int)}.
* <p>
* For example, if the field type is <code>dayOfMonth</code> then the day
* would be changed in the returned instance if supported.
*
* @param fieldType the field type to set, not null
* @param value the value to set
* @return a copy of this instance with the field set
* @throws IllegalArgumentException if the value is null or invalid
*/
public Partial withField(DateTimeFieldType fieldType, int value) {
int index = indexOfSupported(fieldType);
if (value == getValue(index)) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
/**
* Gets a copy of this Partial with the specified period added.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* Fields in the period that aren't present in the partial are ignored.
* <p>
* This method is typically used to add multiple copies of complex
* period instances. Adding one field is best achieved using the method
* {@link #withFieldAdded(DurationFieldType, int)}.
*
* @param period the period to add to this one, null means zero
* @param scalar the amount of times to add, such as -1 to subtract once
* @return a copy of this instance with the period added
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withPeriodAdded(ReadablePeriod period, int scalar) {
if (period == null || scalar == 0) {
return this;
}
int[] newValues = getValues();
for (int i = 0; i < period.size(); i++) {
DurationFieldType fieldType = period.getFieldType(i);
int index = indexOf(fieldType);
if (index >= 0) {
newValues = getField(index).add(this, index, newValues,
FieldUtils.safeMultiply(period.getValue(i), scalar));
}
}
return new Partial(this, newValues);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Gets a copy of this Partial with the specified period added.
* <p>
* If the addition is zero, then <code>this</code> is returned.
* Fields in the period that aren't present in the partial are ignored.
* <p>
* This method is typically used to add multiple copies of complex
* period instances. Adding one field is best achieved using the method
* {@link #withFieldAdded(DurationFieldType, int)}.
*
* @param period the period to add to this one, null means zero
* @param scalar the amount of times to add, such as -1 to subtract once
* @return a copy of this instance with the period added
* @throws ArithmeticException if the new datetime exceeds the capacity
*/
public Partial withPeriodAdded(ReadablePeriod period, int scalar) {
if (period == null || scalar == 0) {
return this;
}
int[] newValues = getValues();
for (int i = 0; i < period.size(); i++) {
DurationFieldType fieldType = period.getFieldType(i);
int index = indexOf(fieldType);
if (index >= 0) {
newValues = getField(index).add(this, index, newValues,
FieldUtils.safeMultiply(period.getValue(i), scalar));
}
}
return new Partial(this, newValues);
}
代码示例来源:origin: joda-time/joda-time
return this;
int[] newValues = getValues();
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
代码示例来源:origin: JodaOrg/joda-time
return this;
int[] newValues = getValues();
newValues = getField(index).set(this, index, newValues, value);
return new Partial(this, newValues);
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Sets this field in a copy of the Partial.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param value the value to set the field in the copy to
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public Partial setCopy(int value) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, value);
return new Partial(iPartial, newValues);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Sets this field in a copy of the Partial to a parsed text value.
* <p>
* The Partial attached to this property is unchanged by this call.
* Instead, a new instance is returned.
*
* @param text the text value to set
* @param locale optional locale to use for selecting a text symbol
* @return a copy of the Partial with the field value changed
* @throws IllegalArgumentException if the text value isn't valid
*/
public Partial setCopy(String text, Locale locale) {
int[] newValues = iPartial.getValues();
newValues = getField().set(iPartial, iFieldIndex, newValues, text, locale);
return new Partial(iPartial, newValues);
}
内容来源于网络,如有侵权,请联系作者删除!