class Interval extends AnyRef
Each instance of the class Interval
represents an interval --- an inclusive range ---
on a time scale. An interval has a "start moment" and an "end moment", represented
as Moment
objects. An interval always contains at least a single moment.
An interval object may be used to represent a range of years, a range of months, etc., as desired
An Interval
object is immutable after it has been created. That is, its state
can not be changed in any way.
- See also
- Alphabetic
- By Inheritance
- Interval
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def contains(another: Interval): Boolean
Determines whether this interval contains the given interval.
Determines whether this interval contains the given interval. This is the case if and only if all moments within the other interval are contained within this interval.
- def contains(moment: Moment): Boolean
Determines whether the given moment is inside this interval.
Determines whether the given moment is inside this interval. (An interval also includes its start and end moments.)
- val end: Moment
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def intersection(another: Interval): Option[Interval]
Creates, and returns a reference to, a new
Interval
object that represents the intersection of this interval with the given interval.Creates, and returns a reference to, a new
Interval
object that represents the intersection of this interval with the given interval. That is, the starting moment of the new interval is the starting moment of one of the two original intervals, whichever is later. Similarly, the end moment of the new interval is the earlier of the two original end moments.However, this method only produces a new interval in case the two original intervals overlap. In that case, the new interval is wrapped inside a
Some
object. If no intersection exists, ̀ the method returnsNone
instead.Examples: The intersection of the interval from 1995 to 2003 with the interval from 2000 to 2013 is a new interval from 2000 to 2003. The intersection of the interval from 2000 to 2001 with the interval from 1995 to 1997 does not exist.
- See also
overlaps
union
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLaterThan(another: Interval): Boolean
Determines whether this interval is later than the given interval.
Determines whether this interval is later than the given interval. This is only deemed to be the case if this entire interval comes after the given interval on the time scale. That is, no overlap is allowed.
- def isLaterThan(moment: Moment): Boolean
Determines whether this interval is later than the given moment.
Determines whether this interval is later than the given moment. This is only deemed to be the case if the entire interval comes after the given moment on the time scale.
- def length: Int
Returns the length of the interval.
Returns the length of the interval. For instance, if the interval represents the range of years from 2000 to 2013, returns 13. The length of an interval will always be at least 0 (which is the case if
start
equalsend
). - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def overlaps(another: Interval): Boolean
Determines whether this interval overlaps (intersects) the given interval.
Determines whether this interval overlaps (intersects) the given interval. This is the case if (and only if) one or more of the moments within the other interval are contained within this interval.
Note: If one interval is entirely contained within the other, it counts as overlapping, as does the case where one interval ends exactly where the other one begins.
- val start: Moment
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
Returns a textual description of the interval.
Returns a textual description of the interval. This is a string whose length depends on the length of the interval as follows.
If the length of the interval is 0, returns a string containing just the single moment contained in the interval. E.g., the interval from 2013 to 2013 is represented by the string
"2013"
.If the length of the interval is above 0 but no more than 50, returns a string consisting of the start moment and the end moment separated by a number of hyphens equal to the length of the interval. For instance, the interval from 2013 to 2014 is represented by the string
"2013-2014"
and the interval from 2000 to 2013 is represented by the string"2000-------------2013"
.If the length of the interval is more than 50, uses three dots instead of hyphens. For instance, the interval from 1900 to 2013 is represented by the string
"1900...2013"
.- Definition Classes
- Interval → AnyRef → Any
- def union(another: Interval): Interval
Creates, and returns a reference to, a new
Interval
object that represents the union of this interval with the given interval.Creates, and returns a reference to, a new
Interval
object that represents the union of this interval with the given interval. That is, the starting moment of the new interval is the starting moment of one of the two original intervals, whichever is earlier. Similarly, the end moment of the new interval is the later of the two original end moments.The two original intervals may overlap, but are not required to do so.
Examples: The union of the interval from 1995 to 2003 with the interval from 2000 to 2013 is a new interval from 1995 to 2013. The union of the interval from 2000 to 2001 with the interval from 1995 to 1997 is a new interval from 1995 to 2001.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.