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

x33g5p2x  于2022-01-20 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(169)

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

Instant.withDurationAdded介绍

[英]Gets a copy of this instant with the specified duration added.

If the addition is zero, then this is returned.
[中]获取添加了指定持续时间的此瞬间的副本。
如果加法为零,则返回this

代码示例

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one, null means zero
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(ReadableDuration duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(ReadableDuration duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(long duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(long duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(long duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(ReadableDuration duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(long duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one, null means zero
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(ReadableDuration duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration 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 instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) {
  if (durationToAdd == null || scalar == 0) {
    return this;
  }
  return withDurationAdded(durationToAdd.getMillis(), scalar);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration 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 instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) {
  if (durationToAdd == null || scalar == 0) {
    return this;
  }
  return withDurationAdded(durationToAdd.getMillis(), scalar);
}

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

public static Partial addForce(Partial p, Period d, int scalar)
{
 Instant t = getInstant(p);
 t = t.withDurationAdded(d.toDurationFrom(INSTANT_ZERO), scalar);
 return getPartial(t, p);
}

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

@Override
public Time add(Duration offset) {
 Period p = offset.getJodaTimePeriod();
 GroundedTime g = new GroundedTime(base.toInstant().withDurationAdded(p.toDurationFrom(base), 1));
 g.approx = this.approx;
 g.mod = this.mod;
 return g;
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(long duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one, null means zero
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(ReadableDuration duration) {
  return withDurationAdded(duration, 1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(long duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(ReadableDuration duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * 
 * @param durationToAdd  the duration 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 instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant withDurationAdded(ReadableDuration durationToAdd, int scalar) {
  if (durationToAdd == null || scalar == 0) {
    return this;
  }
  return withDurationAdded(durationToAdd.getMillis(), scalar);
}

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

/**
 * Gets a copy of this instant with the specified duration taken away.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to reduce this instant by
 * @return a copy of this instant with the duration taken away
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant minus(ReadableDuration duration) {
  return withDurationAdded(duration, -1);
}

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

/**
 * Gets a copy of this instant with the specified duration added.
 * <p>
 * If the amount is zero or null, then <code>this</code> is returned.
 * 
 * @param duration  the duration to add to this one, null means zero
 * @return a copy of this instant with the duration added
 * @throws ArithmeticException if the new instant exceeds the capacity of a long
 */
public Instant plus(ReadableDuration duration) {
  return withDurationAdded(duration, 1);
}

代码示例来源:origin: edu.stanford.nlp/corenlp

public static Partial addForce(Partial p, Period d, int scalar)
{
 Instant t = getInstant(p);
 t = t.withDurationAdded(d.toDurationFrom(INSTANT_ZERO), scalar);
 return getPartial(t, p);
}

相关文章