/** * Gets the number of minutes that this period represents. * * @return the number of minutes in the period */ public int getMinutes() { return getValue(); }
/** * Is this minutes instance greater than the specified number of minutes. * * @param other the other period, null means zero * @return true if this minutes instance is greater than the specified one */ public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); }
/** * Is this minutes instance less than the specified number of minutes. * * @param other the other period, null means zero * @return true if this minutes instance is less than the specified one */ public boolean isLessThan(Minutes other) { if (other == null) { return getValue() < 0; } return getValue() < other.getValue(); }
/** * Is this minutes instance greater than the specified number of minutes. * * @param other the other period, null means zero * @return true if this minutes instance is greater than the specified one */ public boolean isGreaterThan(Minutes other) { if (other == null) { return getValue() > 0; } return getValue() > other.getValue(); }
/** * Is this minutes instance less than the specified number of minutes. * * @param other the other period, null means zero * @return true if this minutes instance is less than the specified one */ public boolean isLessThan(Minutes other) { if (other == null) { return getValue() < 0; } return getValue() < other.getValue(); }
/** * Gets the number of minutes that this period represents. * * @return the number of minutes in the period */ public int getMinutes() { return getValue(); }
/** * Resolves singletons. * * @return the singleton instance */ private Object readResolve() { return Minutes.minutes(getValue()); }
/** * Gets this instance as a String in the ISO8601 duration format. * <p> * For example, "PT4M" represents 4 minutes. * * @return the value as an ISO8601 string */ @ToString public String toString() { return "PT" + String.valueOf(getValue()) + "M"; }
/** * Gets this instance as a String in the ISO8601 duration format. * <p> * For example, "PT4M" represents 4 minutes. * * @return the value as an ISO8601 string */ @ToString public String toString() { return "PT" + String.valueOf(getValue()) + "M"; }
/** * Resolves singletons. * * @return the singleton instance */ private Object readResolve() { return Minutes.minutes(getValue()); }
/** * Returns a new instance with the specified number of minutes added. * <p> * This instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to add, may be negative, null means zero * @return the new period plus the specified number of minutes * @throws ArithmeticException if the result overflows an int */ public Minutes plus(Minutes minutes) { if (minutes == null) { return this; } return plus(minutes.getValue()); }
/** * Returns a new instance with the specified number of minutes taken away. * <p> * This instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to take away, may be negative, null means zero * @return the new period minus the specified number of minutes * @throws ArithmeticException if the result overflows an int */ public Minutes minus(Minutes minutes) { if (minutes == null) { return this; } return minus(minutes.getValue()); }
/** * Converts this period in minutes to a period in hours assuming a * 60 minute hour. * <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. * 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 minutes */ public Hours toStandardHours() { return Hours.hours(getValue() / DateTimeConstants.MINUTES_PER_HOUR); }
/** * Converts this period in minutes to a period in weeks assuming a * 7 days week, 24 hour day and 60 minute hour. * <p> * This method allows you to convert between different types of period. * However to achieve this it makes the assumption that all weeks are * 7 days long, all days are 24 hours long and all hours are 60 minutes long. * This is not true when daylight savings is considered and may also 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 whole weeks for this number of minutes */ public Weeks toStandardWeeks() { return Weeks.weeks(getValue() / DateTimeConstants.MINUTES_PER_WEEK); }
/** * Returns a new instance with the minutes divided by the specified divisor. * The calculation uses integer division, thus 3 divided by 2 is 1. * <p> * This instance is immutable and unaffected by this method call. * * @param divisor the amount to divide by, may be negative * @return the new period divided by the specified divisor * @throws ArithmeticException if the divisor is zero */ public Minutes dividedBy(int divisor) { if (divisor == 1) { return this; } return Minutes.minutes(getValue() / divisor); }
/** * Returns a new instance with the minutes value negated. * * @return the new period with a negated value * @throws ArithmeticException if the result overflows an int */ public Minutes negated() { return Minutes.minutes(FieldUtils.safeNegate(getValue())); }
/** * Returns a new instance with the minutes 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 Minutes multipliedBy(int scalar) { return Minutes.minutes(FieldUtils.safeMultiply(getValue(), scalar)); }
/** * Returns a new instance with the minutes value negated. * * @return the new period with a negated value * @throws ArithmeticException if the result overflows an int */ public Minutes negated() { return Minutes.minutes(FieldUtils.safeNegate(getValue())); }
/** * Returns a new instance with the minutes 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 Minutes multipliedBy(int scalar) { return Minutes.minutes(FieldUtils.safeMultiply(getValue(), scalar)); }
/** * Returns a new instance with the specified number of minutes added. * <p> * This instance is immutable and unaffected by this method call. * * @param minutes the amount of minutes to add, may be negative * @return the new period plus the specified number of minutes * @throws ArithmeticException if the result overflows an int */ public Minutes plus(int minutes) { if (minutes == 0) { return this; } return Minutes.minutes(FieldUtils.safeAdd(getValue(), minutes)); }