Class

org.threeten.bp.chrono

ChronoPeriodImpl

Related Doc: package chrono

Permalink

final class ChronoPeriodImpl extends ChronoPeriod with Serializable

An implementation of ChronoPeriod.

Annotations
@SerialVersionUID()
Linear Supertypes
Serializable, ChronoPeriod, TemporalAmount, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChronoPeriodImpl
  2. Serializable
  3. ChronoPeriod
  4. TemporalAmount
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ChronoPeriodImpl(chronology: Chronology, years: Int, months: Int, days: Int)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addTo(temporal: Temporal): Temporal

    Permalink

    Adds this period to the specified temporal object.

    Adds this period to the specified temporal object.

    This returns a temporal object of the same observable type as the input with this period added.

    In most cases, it is clearer to reverse the calling pattern by using Temporal#plus(TemporalAmount).

    // these two lines are equivalent, but the second approach is recommended
    dateTime = thisPeriod.addTo(dateTime);
    dateTime = dateTime.plus(thisPeriod);
    

    The specified temporal must have the same chronology as this period. This returns a temporal with the non-zero supported units added.

    This instance is immutable and unaffected by this method call.

    temporal

    the temporal object to adjust, not null

    returns

    an object of the same type with the adjustment made, not null

    Definition Classes
    ChronoPeriodImplChronoPeriodTemporalAmount
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

    DateTimeException if unable to add

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(obj: Any): Boolean

    Permalink

    Checks if this period is equal to another period, including the chronology.

    Checks if this period is equal to another period, including the chronology.

    Compares this period with another ensuring that the type, each amount and the chronology are the same. Note that this means that a period of "15 Months" is not equal to a period of "1 Year and 3 Months".

    obj

    the object to check, null returns false

    returns

    true if this is equal to the other period

    Definition Classes
    ChronoPeriodImplChronoPeriod → AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def get(unit: TemporalUnit): Long

    Permalink

    Gets the value of the requested unit.

    Gets the value of the requested unit.

    The supported units are chronology specific. They will typically be YEARS, MONTHS and DAYS. Requesting an unsupported unit will throw an exception.

    unit

    the { @code TemporalUnit} for which to return the value

    returns

    the long value of the unit

    Definition Classes
    ChronoPeriodImplChronoPeriodTemporalAmount
    Exceptions thrown

    DateTimeException if the unit is not supported

    UnsupportedTemporalTypeException if the unit is not supported

  11. def getChronology: Chronology

    Permalink

    Gets the chronology that defines the meaning of the supported units.

    Gets the chronology that defines the meaning of the supported units.

    The period is defined by the chronology. It controls the supported units and restricts addition/subtraction to ChronoLocalDate instances of the same chronology.

    returns

    the chronology defining the period, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def getUnits: List[TemporalUnit]

    Permalink

    Gets the set of units supported by this period.

    Gets the set of units supported by this period.

    The supported units are chronology specific. They will typically be YEARS, MONTHS and DAYS. They are returned in order from largest to smallest.

    This set can be used in conjunction with #get(TemporalUnit) to access the entire state of the period.

    returns

    a list containing the supported units, not null

    Definition Classes
    ChronoPeriodImplChronoPeriodTemporalAmount
  14. def hashCode(): Int

    Permalink

    A hash code for this period.

    A hash code for this period.

    returns

    a suitable hash code

    Definition Classes
    ChronoPeriodImplChronoPeriod → AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def isNegative: Boolean

    Permalink

    Checks if any of the supported units of this period are negative.

    Checks if any of the supported units of this period are negative.

    returns

    true if any unit of this period is negative

    Definition Classes
    ChronoPeriod
  17. def isZero: Boolean

    Permalink

    Checks if all the supported units of this period are zero.

    Checks if all the supported units of this period are zero.

    returns

    true if this period is zero-length

    Definition Classes
    ChronoPeriod
  18. def minus(amountToSubtract: TemporalAmount): ChronoPeriod

    Permalink

    Returns a copy of this period with the specified period subtracted.

    Returns a copy of this period with the specified period subtracted.

    If the specified amount is a ChronoPeriod then it must have the same chronology as this period. Implementations may choose to accept or reject other TemporalAmount implementations.

    This instance is immutable and unaffected by this method call.

    amountToSubtract

    the period to subtract, not null

    returns

    a { @code ChronoPeriod} based on this period with the requested period subtracted, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

  19. def multipliedBy(scalar: Int): ChronoPeriod

    Permalink

    Returns a new instance with each amount in this period in this period multiplied by the specified scalar.

    Returns a new instance with each amount in this period in this period multiplied by the specified scalar.

    This returns a period with each supported unit individually multiplied. For example, a period of "2 years, -3 months and 4 days" multiplied by 3 will return "6 years, -9 months and 12 days". No normalization is performed.

    scalar

    the scalar to multiply by, not null

    returns

    a { @code ChronoPeriod} based on this period with the amounts multiplied by the scalar, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. def negated: ChronoPeriod

    Permalink

    Returns a new instance with each amount in this period negated.

    Returns a new instance with each amount in this period negated.

    This returns a period with each supported unit individually negated. For example, a period of "2 years, -3 months and 4 days" will be negated to "-2 years, 3 months and -4 days". No normalization is performed.

    returns

    a { @code ChronoPeriod} based on this period with the amounts negated, not null

    Definition Classes
    ChronoPeriod
    Exceptions thrown

    ArithmeticException if numeric overflow occurs, which only happens if one of the units has the value { @code Long.MIN_VALUE}

  22. def normalized: ChronoPeriod

    Permalink

    Returns a copy of this period with the amounts of each unit normalized.

    Returns a copy of this period with the amounts of each unit normalized.

    The process of normalization is specific to each calendar system. For example, in the ISO calendar system, the years and months are normalized but the days are not, such that "15 months" would be normalized to "1 year and 3 months".

    This instance is immutable and unaffected by this method call.

    returns

    a { @code ChronoPeriod} based on this period with the amounts of each unit normalized, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def plus(amountToAdd: TemporalAmount): ChronoPeriod

    Permalink

    Returns a copy of this period with the specified period added.

    Returns a copy of this period with the specified period added.

    If the specified amount is a ChronoPeriod then it must have the same chronology as this period. Implementations may choose to accept or reject other TemporalAmount implementations.

    This instance is immutable and unaffected by this method call.

    amountToAdd

    the period to add, not null

    returns

    a { @code ChronoPeriod} based on this period with the requested period added, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

  26. def subtractFrom(temporal: Temporal): Temporal

    Permalink

    Subtracts this period from the specified temporal object.

    Subtracts this period from the specified temporal object.

    This returns a temporal object of the same observable type as the input with this period subtracted.

    In most cases, it is clearer to reverse the calling pattern by using Temporal#minus(TemporalAmount).

    // these two lines are equivalent, but the second approach is recommended
    dateTime = thisPeriod.subtractFrom(dateTime);
    dateTime = dateTime.minus(thisPeriod);
    

    The specified temporal must have the same chronology as this period. This returns a temporal with the non-zero supported units subtracted.

    This instance is immutable and unaffected by this method call.

    temporal

    the temporal object to adjust, not null

    returns

    an object of the same type with the adjustment made, not null

    Definition Classes
    ChronoPeriodImplChronoPeriodTemporalAmount
    Exceptions thrown

    ArithmeticException if numeric overflow occurs

    DateTimeException if unable to subtract

  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink

    Outputs this period as a String.

    Outputs this period as a String.

    The output will include the period amounts and chronology.

    returns

    a string representation of this period, not null

    Definition Classes
    ChronoPeriodImplChronoPeriod → AnyRef → Any
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from ChronoPeriod

Inherited from TemporalAmount

Inherited from AnyRef

Inherited from Any

Ungrouped