org.joda.time.Partial.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.joda.time.Partial.getValue()方法的一些代码示例,展示了Partial.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partial.getValue()方法的具体详情如下:
包路径:org.joda.time.Partial
类名称:Partial
方法名:getValue

Partial.getValue介绍

[英]Gets the value of the field at the specifed index.
[中]获取指定索引处字段的值。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源: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: JodaOrg/joda-time

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源:origin: joda-time/joda-time

return newPartial;
if (value == getValue(index)) {
  return this;

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial withWeekYear(Partial p)
{
 Partial res = new Partial();
 for (int i = 0; i < p.size(); i++) {
  DateTimeFieldType fieldType = p.getFieldType(i);
  if (fieldType == DateTimeFieldType.year()) {
   res = res.with(DateTimeFieldType.weekyear(), p.getValue(i));
  } else {
   res = res.with(fieldType, p.getValue(i));
  }
 }
 return res;
}

代码示例来源:origin: JodaOrg/joda-time

return newPartial;
if (value == getValue(index)) {
  return this;

代码示例来源:origin: stanfordnlp/CoreNLP

public static boolean isCompatible(Partial p1, Partial p2) {
 if (p1 == null) return true;
 if (p2 == null) return true;
 for (int i = 0; i < p1.size(); i++) {
  DateTimeFieldType type = p1.getFieldType(i);
  int v = p1.getValue(i);
  if (JodaTimeUtils.hasField(p2,type)) {
   if (v != p2.get(type)) {
    return false;
   }
  }
 }
 return true;
}
// Uses p2 to resolve dow for p1

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * 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: stanfordnlp/CoreNLP

public static Partial discardMoreSpecificFields(Partial p, DurationFieldType dft)
{
 DurationField df = dft.getField(p.getChronology());
 Partial res = new Partial();
 for (int i = 0; i < p.size(); i++) {
  DateTimeFieldType fieldType = p.getFieldType(i);
  DurationField f = fieldType.getDurationType().getField(p.getChronology());
  int cmp = df.compareTo(f);
  if (cmp <= 0) {
   res = res.with(fieldType, p.getValue(i));
  }
 }
 return res;
}

代码示例来源:origin: camunda/camunda-bpm-platform

return newPartial;
if (value == getValue(index)) {
  return this;

代码示例来源:origin: stanfordnlp/CoreNLP

public static Partial discardMoreSpecificFields(Partial p, DateTimeFieldType d)
{
 Partial res = new Partial();
 for (int i = 0; i < p.size(); i++) {
  DateTimeFieldType fieldType = p.getFieldType(i);
  if (fieldType.equals(d) || isMoreGeneral(fieldType, d, p.getChronology())) {
   res = res.with(fieldType, p.getValue(i));
  }
 }
 if (res.isSupported(JodaTimeUtils.DecadeOfCentury) && !res.isSupported(DateTimeFieldType.centuryOfEra())) {
  if (p.isSupported(DateTimeFieldType.year())) {
   res = res.with(DateTimeFieldType.centuryOfEra(), p.get(DateTimeFieldType.year()) / 100);
  }
 }
 return res;
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源:origin: stanfordnlp/CoreNLP

if (!p.isSupported(DateTimeFieldType.centuryOfEra())) {
 int yoc = p.get(DateTimeFieldType.yearOfCentury());
 int refYear = p2.getValue(i);
 int century = refYear / 100;
 int y2 = yoc + century*100;
if (!p.isSupported(DateTimeFieldType.centuryOfEra())) {
 int decade = p.get(JodaTimeUtils.DecadeOfCentury);
 int refYear = p2.getValue(i);
 int century = refYear / 100;
 int y2 = decade*10 + century*100;
p = p.with(fieldType, p2.getValue(i));

代码示例来源:origin: stanfordnlp/CoreNLP

if (!p.isSupported(DateTimeFieldType.centuryOfEra())) {
  int yoc = p.get(DateTimeFieldType.yearOfCentury());
  int refYear = p2.getValue(i);
  int century = refYear / 100;
  int y2 = yoc + century*100;
p = p.with(fieldType, p2.getValue(i));

代码示例来源:origin: stanfordnlp/CoreNLP

p = p.with(fieldType, p2.getValue(i));

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/**
 * Gets the value of this field.
 * 
 * @return the field value
 */
public int get() {
  return iPartial.getValue(iFieldIndex);
}

代码示例来源:origin: org.opencds.cqf/cql-engine

public static boolean isUncertain(Time t, String precision) {
  try {
    t.getPartial().getValue(Time.getFieldIndex(precision));
  } catch (IndexOutOfBoundsException e) {
    return true;
  }
  return false;
}

相关文章