Class Date

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<java.lang.Object>, ID
    Direct Known Subclasses:
    EresseaDate, SimpleDate

    public abstract class Date
    extends java.lang.Object
    implements ID
    This class represents a Magellan Date.
    Author:
    Sebastian
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int AUTUMN
      a constant representing the season autumn
      protected int iDate  
      static int SPRING
      a constant representing the season spring
      static int SUMMER
      a constant representing the season summer
      static int TYPE_LONG
      Long format
      static int TYPE_PHRASE
      Phrase format
      static int TYPE_PHRASE_AND_SEASON
      Phrase and season format
      static int TYPE_SHORT
      Short format
      static int UNKNOWN
      a constant representing the season "unknown"
      static int WINTER
      a constant representing the season winter
    • Constructor Summary

      Constructors 
      Constructor Description
      Date​(int iInitDate)
      Creates new Date
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      Date clone()
      Creates a copy of this Date object.
      int compareTo​(java.lang.Object o)
      Imposes a natural ordering on date objects based on the numeric ordering of the integer date value.
      boolean equals​(java.lang.Object o)
      Compares this object to the specified object.
      int getDate()
      Returns the round.
      abstract int getSeason()
      Returns the season of this date.
      int hashCode()
      Returns a hashcode for this ID.
      void setDate​(int newDate)
      Sets the round.
      java.lang.String toString()
      Returns a String representation of the ID formatted in a user friendly manner.
      abstract java.lang.String toString​(int iDateType)  
      java.lang.String toString​(java.lang.String delim)
      Returns a String representation of the ID formatted in a user friendly manner with a given separator.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • iDate

        protected int iDate
      • TYPE_PHRASE_AND_SEASON

        public static final int TYPE_PHRASE_AND_SEASON
        Phrase and season format
        See Also:
        Constant Field Values
      • UNKNOWN

        public static final int UNKNOWN
        a constant representing the season "unknown"
        See Also:
        Constant Field Values
      • SPRING

        public static final int SPRING
        a constant representing the season spring
        See Also:
        Constant Field Values
      • SUMMER

        public static final int SUMMER
        a constant representing the season summer
        See Also:
        Constant Field Values
      • AUTUMN

        public static final int AUTUMN
        a constant representing the season autumn
        See Also:
        Constant Field Values
      • WINTER

        public static final int WINTER
        a constant representing the season winter
        See Also:
        Constant Field Values
    • Constructor Detail

      • Date

        public Date​(int iInitDate)
        Creates new Date
    • Method Detail

      • getDate

        public int getDate()
        Returns the round.
      • setDate

        public void setDate​(int newDate)
        Sets the round.
      • equals

        public boolean equals​(java.lang.Object o)
        Description copied from interface: ID
        Compares this object to the specified object. The result is true if and only if the argument is not null and is an object of the same class implementing this interface and contains the same unique value.
        Specified by:
        equals in interface ID
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - the date to compare this date to
        Returns:
        true if this date equals o, false otherwise
      • hashCode

        public int hashCode()
        Description copied from interface: ID
        Returns a hashcode for this ID.
        Specified by:
        hashCode in interface ID
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this object.
      • toString

        public java.lang.String toString()
        Description copied from interface: ID
        Returns a String representation of the ID formatted in a user friendly manner.
        Specified by:
        toString in interface ID
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of the ID formatted in a user friendly manner.
        See Also:
        Object.toString()
      • toString

        public java.lang.String toString​(java.lang.String delim)
        Description copied from interface: ID
        Returns a String representation of the ID formatted in a user friendly manner with a given separator. Right now only Coordinate should implement this, all others should invoke toString()!
        Specified by:
        toString in interface ID
        Returns:
        a String representation of the ID formatted in a user friendly manner.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Imposes a natural ordering on date objects based on the numeric ordering of the integer date value.
        Specified by:
        compareTo in interface java.lang.Comparable<java.lang.Object>
        Specified by:
        compareTo in interface ID
        Parameters:
        o - the date to compare this date to
        Returns:
        > 0 if this date is greater than o,
        < 0 if this date is smaller, 0 if the dates are equal
      • clone

        public Date clone()
        Creates a copy of this Date object.
        Specified by:
        clone in interface ID
        Overrides:
        clone in class java.lang.Object
      • toString

        public abstract java.lang.String toString​(int iDateType)