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

x33g5p2x  于2022-01-30 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(128)

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

Seconds.getValue介绍

暂无

代码示例

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

/**
 * Is this seconds instance less than the specified number of seconds.
 *
 * @param other  the other period, null means zero
 * @return true if this seconds instance is less than the specified one
 */
public boolean isLessThan(Seconds other) {
  if (other == null) {
    return getValue() < 0;
  }
  return getValue() < other.getValue();
}

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

/**
 * Gets the number of seconds that this period represents.
 *
 * @return the number of seconds in the period
 */
public int getSeconds() {
  return getValue();
}

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

/**
 * Is this seconds instance greater than the specified number of seconds.
 *
 * @param other  the other period, null means zero
 * @return true if this seconds instance is greater than the specified one
 */
public boolean isGreaterThan(Seconds other) {
  if (other == null) {
    return getValue() > 0;
  }
  return getValue() > other.getValue();
}

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

/**
 * Gets the number of seconds that this period represents.
 *
 * @return the number of seconds in the period
 */
public int getSeconds() {
  return getValue();
}

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

/**
 * Is this seconds instance greater than the specified number of seconds.
 *
 * @param other  the other period, null means zero
 * @return true if this seconds instance is greater than the specified one
 */
public boolean isGreaterThan(Seconds other) {
  if (other == null) {
    return getValue() > 0;
  }
  return getValue() > other.getValue();
}

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

/**
 * Is this seconds instance less than the specified number of seconds.
 *
 * @param other  the other period, null means zero
 * @return true if this seconds instance is less than the specified one
 */
public boolean isLessThan(Seconds other) {
  if (other == null) {
    return getValue() < 0;
  }
  return getValue() < other.getValue();
}

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

/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT4S" represents 4 seconds.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
  return "PT" + String.valueOf(getValue()) + "S";
}

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

/**
 * Resolves singletons.
 * 
 * @return the singleton instance
 */
private Object readResolve() {
  return Seconds.seconds(getValue());
}

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

/**
 * Gets this instance as a String in the ISO8601 duration format.
 * <p>
 * For example, "PT4S" represents 4 seconds.
 *
 * @return the value as an ISO8601 string
 */
@ToString
public String toString() {
  return "PT" + String.valueOf(getValue()) + "S";
}

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

/**
 * Resolves singletons.
 * 
 * @return the singleton instance
 */
private Object readResolve() {
  return Seconds.seconds(getValue());
}

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

/**
 * Returns a new instance with the specified number of seconds added.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the amount of seconds to add, may be negative, null means zero
 * @return the new period plus the specified number of seconds
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds plus(Seconds seconds) {
  if (seconds == null) {
    return this;
  }
  return plus(seconds.getValue());
}

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

/**
 * Returns a new instance with the specified number of seconds taken away.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the amount of seconds to take away, may be negative, null means zero
 * @return the new period minus the specified number of seconds
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds minus(Seconds seconds) {
  if (seconds == null) {
    return this;
  }
  return minus(seconds.getValue());
}

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

/**
 * Converts this period in seconds to a period in minutes assuming a
 * 60 second minute.
 * <p>
 * This method allows you to convert between different types of period.
 * However to achieve this it makes the assumption that all minutes are
 * 60 seconds long.
 * This may not be true for some unusual chronologies. However, it is included
 * as it is a useful operation for many applications and business rules.
 * 
 * @return a period representing the number of minutes for this number of seconds
 */
public Minutes toStandardMinutes() {
  return Minutes.minutes(getValue() / DateTimeConstants.SECONDS_PER_MINUTE);
}

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

/**
 * Converts this period in seconds to a period in hours assuming a
 * 60 minute hour and 60 second minute.
 * <p>
 * This method allows you to convert between different types of period.
 * However to achieve this it makes the assumption that all hours are
 * 60 minutes long and all minutes are 60 seconds long.
 * This may not be true for some unusual chronologies. However, it is included
 * as it is a useful operation for many applications and business rules.
 * 
 * @return a period representing the number of hours for this number of seconds
 */
public Hours toStandardHours() {
  return Hours.hours(getValue() / DateTimeConstants.SECONDS_PER_HOUR);
}

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

/**
 * Returns a new instance with the specified number of seconds taken away.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the amount of seconds to take away, may be negative, null means zero
 * @return the new period minus the specified number of seconds
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds minus(Seconds seconds) {
  if (seconds == null) {
    return this;
  }
  return minus(seconds.getValue());
}

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

/**
 * Returns a new instance with the seconds multiplied by the specified scalar.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param scalar  the amount to multiply by, may be negative
 * @return the new period multiplied by the specified scalar
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds multipliedBy(int scalar) {
  return Seconds.seconds(FieldUtils.safeMultiply(getValue(), scalar));
}

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

/**
 * Returns a new instance with the seconds value negated.
 *
 * @return the new period with a negated value
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds negated() {
  return Seconds.seconds(FieldUtils.safeNegate(getValue()));
}

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

/**
 * Returns a new instance with the seconds value negated.
 *
 * @return the new period with a negated value
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds negated() {
  return Seconds.seconds(FieldUtils.safeNegate(getValue()));
}

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

/**
 * Returns a new instance with the seconds multiplied by the specified scalar.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param scalar  the amount to multiply by, may be negative
 * @return the new period multiplied by the specified scalar
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds multipliedBy(int scalar) {
  return Seconds.seconds(FieldUtils.safeMultiply(getValue(), scalar));
}

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

/**
 * Returns a new instance with the specified number of seconds added.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @param seconds  the amount of seconds to add, may be negative
 * @return the new period plus the specified number of seconds
 * @throws ArithmeticException if the result overflows an int
 */
public Seconds plus(int seconds) {
  if (seconds == 0) {
    return this;
  }
  return Seconds.seconds(FieldUtils.safeAdd(getValue(), seconds));
}

相关文章