Class SimpleTimePeriod

    • Constructor Detail

      • SimpleTimePeriod

        public SimpleTimePeriod​(long start,
                                long end)
        Creates a new time allocation.
        Parameters:
        start - the start date/time in milliseconds.
        end - the end date/time in milliseconds.
      • SimpleTimePeriod

        public SimpleTimePeriod​(Date start,
                                Date end)
        Creates a new time allocation.
        Parameters:
        start - the start date/time (null not permitted).
        end - the end date/time (null not permitted).
    • Method Detail

      • getStart

        public Date getStart()
        Returns the start date/time.
        Specified by:
        getStart in interface TimePeriod
        Returns:
        The start date/time (never null).
      • getStartMillis

        public long getStartMillis()
        Returns the start date/time in milliseconds.
        Returns:
        The start.
        Since:
        1.0.10.
      • getEnd

        public Date getEnd()
        Returns the end date/time.
        Specified by:
        getEnd in interface TimePeriod
        Returns:
        The end date/time (never null).
      • getEndMillis

        public long getEndMillis()
        Returns the end date/time in milliseconds.
        Returns:
        The end.
        Since:
        1.0.10.
      • equals

        public boolean equals​(Object obj)
        Tests this time period instance for equality with an arbitrary object. The object is considered equal if it is an instance of TimePeriod and it has the same start and end dates.
        Overrides:
        equals in class Object
        Parameters:
        obj - the other object (null permitted).
        Returns:
        A boolean.
      • compareTo

        public int compareTo​(Object obj)
        Returns an integer that indicates the relative ordering of two time periods.
        Specified by:
        compareTo in interface Comparable
        Parameters:
        obj - the object (null not permitted).
        Returns:
        An integer.
        Throws:
        ClassCastException - if obj is not an instance of TimePeriod.
      • hashCode

        public int hashCode()
        Returns a hash code for this object instance. The approach described by Joshua Bloch in "Effective Java" has been used here - see:

        http://developer.java.sun.com/ developer/Books/effectivejava/Chapter3.pdf

        Overrides:
        hashCode in class Object
        Returns:
        A hash code.