Package org.lukashian

Class Instant

java.lang.Object
org.lukashian.Instant
All Implemented Interfaces:
Serializable, Comparable<Instant>

public final class Instant extends Object implements Comparable<Instant>, Serializable
Represents a unique millisecond on the timeline. This means that the very first millisecond on the timeline is millisecond 1. This is consistent with the numbering of Days and Years, that also start at 1.

This class is also used to handle the concept of "time of day". In the Lukashian Calendar, the time of day is simply a BigFraction that expresses the proportion of the day that has passed. This BigFraction can then be represented as, for example, Basis Points.

The fact that an Instant is used to represent a unique millisecond on the timeline, as well as the proportion of the day that has passed, means that we need to specify how to translate between those two:

  • From a proportion (as BigFraction) to a specific millisecond: The thing to consider here is that a specific proportion (for example 0.12345th of the day), may not actually lead to a whole number of milliseconds to have passed on that day. The millisecond that is chosen as the result of the translation is the millisecond that the proportion "points to". The best way to visualize this is a wheel of fortune: the arrow is the proportion and the segments on the wheel are the milliseconds. It does not matter at which part of a segment the arrow points. If a certain proportion means that, for example, 120.01 milliseconds have passed on a certain day, then millisecond 121 of that day is chosen.

    If a certain proportion points exactly at a boundary between milliseconds, then the millisecond after the boundary is chosen. For example, if a certain proportion means that exactly 120 milliseconds have fully passed (and hence we are at the start of millisecond 121), then millisecond 121 of that day is chosen.

    This effectively means that an Instant represents a specific millisecond including its start, but excluding its end, or in mathematical notation:

    [m>
    . This also effectively means that the calendar does have a start, but does not have an end, which is as expected.
  • From a specific millisecond to a proportion (as BigFraction): This is not a problem, because a BigFraction has exact precision for any rational number, so for a specific millisecond, we can always exactly calculate the proportion of the day that has passed. The only questions is: is the millisecond itself considered to have fully passed?

    The answer is "no", the millisecond for which we calculate the proportion of the day that has passed, is itself not considered to have fully passed. In fact, this millisecond is considered to not have passed at all, meaning that we calculate the proportion of the day from the start of the day until the start of this millisecond. This means that the first millisecond of the day results in a proportion of 0 and the final millisecond of the day results in a proportion smaller than 1. This corresponds to the fact that a Day runs from its start (inclusive) to its end (exclusive).

Internally, an Instant stores its Day and the BigFraction that represents the proportion of its day that has passed. It does *not* store the unique millisecond on the timeline that this Instant represents.

When creating an Instant using one of the constructors or methods that specifies the proportion of the day, the Instant stores the proportion with which it was created.

When creating an Instant using one of the constructors or methods that specifies the unique millisecond on the timeline, the translation to the corresponding proportion is done as outlined above, after which the resulting Day and proportion (as BigFraction) will be stored.

The standard Java methods equals(Object), hashCode() and compareTo(Instant) look at the unique millisecond on the timeline that this Instant represents, not the exact proportion of the day.

So, why not store the unique millisecond on the timeline that this Instant represents, instead of the Day and the proportion as a BigFraction? Remember the translations: if we create an Instant at, say, 5000 beeps of a certain day, this proportion will "point" to a certain millisecond. It is unlikely that this proportion will point exactly to a boundary between milliseconds. If we would then store said millisecond as the representation of the Instant, then what would happen if we then calculate the number of beeps that have passed?

First, we would have to translate back to the proportion of the day that has passed. The millisecond itself is not considered to have passed at all (see the explanation of the translations above), meaning that we won't get 0.5, but something like 0.499999999....... If this then gets truncated to beeps, we get 4999 instead of the original 5000 (rounding cannot solve the problem, see getBeeps() for details).

By storing the Day and the proportion with which the Instant was created, we do not have this problem.

The other way around is not a problem either. BigFraction has exact precision for any rational number, so translating a unique millisecond on the timeline to a proportion, and then back again, is guaranteed to yield the original value.

Instant is an immutable object. New instances are always created when calling one of the mutation methods.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The amount of beeps per day, see Basis Points.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a new Instant that represents the passed proportion of this instant's day on the next day, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the next day.
    Returns a new Instant that represents the passed proportion of this instant's day on the previous day, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the previous day.
    int
     
    int
    Returns the amount of beeps between this instant and the given non-null Instant, directionally.
    long
    Returns the amount of milliseconds between this instant and the given non-null Instant, directionally.
    boolean
    equals(Object object)
     
    int
    Gets the getProportionOfDay(), represented as beeps.
    Returns the Day of this instant.
    long
    Gets the unique millisecond on the timeline that this Instant represents.
    long
    Gets the unique millisecond on the timeline that this Instant represents.
    org.apache.commons.numbers.fraction.BigFraction
    Returns the proportion of the Day of this instant that has passed.
    long
    Gets the total number of milliseconds from the UNIX Epoch, up to the final point of the millisecond represented by this instant.
    Returns the year that this instant is in.
    int
     
    boolean
    Returns whether this instant is after the given non-null Instant.
    boolean
    Returns whether this instant is before the given non-null Instant.
    boolean
    isIn(Day day)
    Returns whether this instant is in the given non-null Day.
    boolean
    isIn(Year year)
    Returns whether this instant is in the given non-null Year.
    boolean
    isNotIn(Day day)
    Returns whether this instant is not in the given non-null Day.
    boolean
    isNotIn(Year year)
    Returns whether this instant is not in the given non-null Year.
    boolean
    Returns whether this instant is the same or after the given non-null Instant.
    boolean
    Returns whether this instant is the same or before the given non-null Instant.
    minusBeeps(int beepsToSubtract)
    Returns a new Instant that represents this instant minus the given amount of beeps.
    minusDays(int daysToSubtract)
    Returns a new Instant that represents the passed proportion of this instant's day on this instant's day minus the given amount of days, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.
    minusMilliseconds(long millisecondsToSubtract)
    Returns a new Instant that represents this instant minus the given amount of milliseconds.
    minusProportionOfDay(org.apache.commons.numbers.fraction.BigFraction proportionToSubtract)
    Returns a new Instant that represents this instant minus the given proportion of a Day.
    minusSeconds(long secondsToSubtract)
    Returns a new Instant that represents this instant minus the given amount of seconds.
    minusYears(int yearsToSubtract)
    Returns a new Instant that represents the passed proportion of this instant's day on this instant's day minus the given amount of years, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.
    static Instant
    now()
    Returns the current Instant.
    static Instant
    of(int year, int day, int beeps)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    of(int year, int day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    of(long epochMilliseconds)
    Creates a new Instant representing the given number of milliseconds since the start of the Lukashian Calendar.
    static Instant
    of(Day day, int beeps)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    of(Day day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    of(Year year, int day, int beeps)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    of(Year year, int day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
    Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
    static Instant
    ofJavaInstant(Instant javaInstant)
    Creates a new Instant representing the same point in time as the given Java Instant.
    static Instant
    ofUnixEpochMilliseconds(long unixEpochMilliseconds)
    Creates a new Instant representing the amount of milliseconds since the UNIX Epoch.
    plusBeeps(int beepsToAdd)
    Returns a new Instant that represents this instant plus the given amount of beeps.
    plusDays(int daysToAdd)
    Returns a new Instant that represents the passed proportion of this instant's day on this instant's day plus the given amount of days, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.
    plusMilliseconds(long millisecondsToAdd)
    Returns a new Instant that represents this instant plus the given amount of milliseconds.
    plusProportionOfDay(org.apache.commons.numbers.fraction.BigFraction proportionToAdd)
    Returns a new Instant that represents this instant plus the given proportion of a Day.
    plusSeconds(long secondsToAdd)
    Returns a new Instant that represents this instant plus the given amount of seconds.
    plusYears(int yearsToAdd)
    Returns a new Instant that represents the passed proportion of this instant's day on this instant's day plus the given amount of years, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.
    Gets the Java Instant that represents the same point in time as this Instant.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Method Details

    • minusYears

      public Instant minusYears(int yearsToSubtract)
      Returns a new Instant that represents the passed proportion of this instant's day on this instant's day minus the given amount of years, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.

      To see what the resulting day will be, see Day.minusYears(int), which will be applied to this instant's day.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar or when the resulting year does not have a day with this instant's day's number
    • plusYears

      public Instant plusYears(int yearsToAdd)
      Returns a new Instant that represents the passed proportion of this instant's day on this instant's day plus the given amount of years, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.

      To see what the resulting day will be, see Day.plusYears(int), which will be applied to this instant's day.

      Throws:
      LukashianException - when the resulting year does not have a day with this instant's day's number
    • minusDays

      public Instant minusDays(int daysToSubtract)
      Returns a new Instant that represents the passed proportion of this instant's day on this instant's day minus the given amount of days, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.

      Calling this method might result in a Instant that is in a different year.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • plusDays

      public Instant plusDays(int daysToAdd)
      Returns a new Instant that represents the passed proportion of this instant's day on this instant's day plus the given amount of days, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the resulting day.

      Calling this method might result in a Instant that is in a different year.

    • atPreviousDay

      public Instant atPreviousDay()
      Returns a new Instant that represents the passed proportion of this instant's day on the previous day, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the previous day.

      Calling this method might result in a Instant that is in a different year.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • atNextDay

      public Instant atNextDay()
      Returns a new Instant that represents the passed proportion of this instant's day on the next day, for example, if this instant represents a point at one third of its day, then calling this method will return an instant that represents one third of the next day.

      Calling this method might result in a Instant that is in a different year.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • minusMilliseconds

      public Instant minusMilliseconds(long millisecondsToSubtract)
      Returns a new Instant that represents this instant minus the given amount of milliseconds. This might result in an Instant that is in a different day or year.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • minusSeconds

      public Instant minusSeconds(long secondsToSubtract)
      Returns a new Instant that represents this instant minus the given amount of seconds. This might result in an Instant that is in a different day or year.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • plusMilliseconds

      public Instant plusMilliseconds(long millisecondsToAdd)
      Returns a new Instant that represents this instant plus the given amount of milliseconds. This might result in an Instant that is in a different day or year.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

    • plusSeconds

      public Instant plusSeconds(long secondsToAdd)
      Returns a new Instant that represents this instant plus the given amount of seconds. This might result in an Instant that is in a different day or year.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

    • minusProportionOfDay

      public Instant minusProportionOfDay(org.apache.commons.numbers.fraction.BigFraction proportionToSubtract)
      Returns a new Instant that represents this instant minus the given proportion of a Day. This might result in an Instant that is in a different day or year. The value of the passed BigFraction will be interpreted in such a way that 1 is a full day. So 0.5 will represent half a day and 2.5 will represent two and a half days.

      Please note that since the duration of a day is not constant, the durations of the various parts of the proportion that are subtracted may vary if subtracting that proportion will lead to an Instant that is on a different day. For example, if this Instant is at 0.2 of the current day and 0.4 is subtracted, this will lead to an Instant that is at 0.8 of the previous day. This means that the first 0.2 day that was subtracted has the duration of 20% of the current day and the last 0.2 day that was subtracted has the duration of 20% of the previous day.

      The same principle applies if more than 1 day is subtracted.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • minusBeeps

      public Instant minusBeeps(int beepsToSubtract)
      Returns a new Instant that represents this instant minus the given amount of beeps. This might result in an Instant that is in a different day or year.

      Please note that the duration of a beep is 1/10000th of a day. Since the duration of a day is not constant, the duration of the beeps that are subtracted may vary if subtracting those beeps will lead to an Instant that is on a different day. For example, if this Instant is at 2000 beeps of the current day and 4000 beeps are subtracted, this will lead to an Instant that is at 8000 beeps of the previous day. This means that the first 2000 beeps that were subtracted have the duration of 2000/10000th of the current day and the last 2000 beeps that were subtracted have the duration of 2000/10000th of the previous day.

      The same principle applies if more than 1 day's worth of beeps are subtracted.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

      Throws:
      LukashianException - when the result would be before the start of the Lukashian Calendar
    • plusProportionOfDay

      public Instant plusProportionOfDay(org.apache.commons.numbers.fraction.BigFraction proportionToAdd)
      Returns a new Instant that represents this instant plus the given proportion of a Day. This might result in an Instant that is in a different day or year. The value of the passed BigFraction will be interpreted in such a way that 1 is a full day. So 0.5 will represent half a day and 2.5 will represent two and a half days.

      Please note that since the duration of a day is not constant, the durations of the various parts of the proportion that are added may vary if adding that proportion will lead to an Instant that is on a different day. For example, if this Instant is at 0.8 of the current day and 0.4 is added, this will lead to an Instant that is at 0.2 of the next day. This means that the first 0.2 day that was added has the duration of 20% of the current day and the last 0.2 day that was added has the duration of 20% of the next day.

      The same principle applies if more than 1 day is added.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

    • plusBeeps

      public Instant plusBeeps(int beepsToAdd)
      Returns a new Instant that represents this instant plus the given amount of beeps. This might result in an Instant that is in a different day or year.

      Please note that the duration of a beep is 1/10000th of a day. Since the duration of a day is not constant, the duration of the beeps that are added may vary if adding those beeps will lead to an Instant that is on a different day. For example, if this Instant is at 8000 beeps of the current day and 4000 beeps are added, this will lead to an Instant that is at 2000 beeps of the next day. This means that the first 2000 beeps that were added have the duration of 2000/10000th of the current day and the last 2000 beeps that were added have the duration of 2000/10000th of the next day.

      The same principle applies if more than 1 day's worth of beeps are added.

      Please note that if the resulting Instant is formatted with the default options in Formatter, it may look the same as the original if the change is less than 1 beep.

    • isBefore

      public boolean isBefore(Instant other)
      Returns whether this instant is before the given non-null Instant. This will compare the unique milliseconds on the timeline that the Instants represent. It will not compare the proportions of the respective days that the Instants represent.
    • isSameOrBefore

      public boolean isSameOrBefore(Instant other)
      Returns whether this instant is the same or before the given non-null Instant. This will compare the unique milliseconds on the timeline that the Instants represent. It will not compare the proportions of the respective days that the Instants represent.
    • isAfter

      public boolean isAfter(Instant other)
      Returns whether this instant is after the given non-null Instant. This will compare the unique milliseconds on the timeline that the Instants represent. It will not compare the proportions of the respective days that the Instants represent.
    • isSameOrAfter

      public boolean isSameOrAfter(Instant other)
      Returns whether this instant is the same or after the given non-null Instant. This will compare the unique milliseconds on the timeline that the Instants represent. It will not compare the proportions of the respective days that the Instants represent.
    • isIn

      public boolean isIn(Year year)
      Returns whether this instant is in the given non-null Year.
    • isNotIn

      public boolean isNotIn(Year year)
      Returns whether this instant is not in the given non-null Year.
    • isIn

      public boolean isIn(Day day)
      Returns whether this instant is in the given non-null Day.
    • isNotIn

      public boolean isNotIn(Day day)
      Returns whether this instant is not in the given non-null Day.
    • getEpochMilliseconds

      public long getEpochMilliseconds()
      Gets the unique millisecond on the timeline that this Instant represents. This is essentially the how-manieth millisecond on the entire calendar this Instant represents. See the javadoc of Instant for an explanation of how a proportion of a day is translated to a specific millisecond.

      This method returns the same result as getMillisecond().

    • getMillisecond

      public long getMillisecond()
      Gets the unique millisecond on the timeline that this Instant represents. This is essentially the how-manieth millisecond on the entire calendar this Instant represents. See the javadoc of Instant for an explanation of how a proportion of a day is translated to a specific millisecond.

      This method returns the same result as getEpochMilliseconds().

    • getProportionOfDay

      public org.apache.commons.numbers.fraction.BigFraction getProportionOfDay()
      Returns the proportion of the Day of this instant that has passed.
    • getDay

      public Day getDay()
      Returns the Day of this instant.
    • getYear

      public Year getYear()
      Returns the year that this instant is in. Note that this might be different from the year that the Day of this instant is in, because a Day is part of the Year in which it starts, but it does not necessarily end in that year. If the year of the day of this instant is needed, please call getDay().getYear().
    • getBeeps

      public int getBeeps()
      Gets the getProportionOfDay(), represented as beeps. This will result in an int between 0 (inclusive) and 9999 (inclusive). Please see the javadoc of Instant for an explanation.

      Rounding is not performed here, because that would require a correction to prevent overflowing into the next day, which in turn will lead to the first beep of a day lasting for only half a beep and the last one lasting for one and a half (because the last half would otherwise be rounded to the first beep of the following day).

      As a result, the amount of beeps that is returned by this method is the amount of beeps that have fully passed at the time of the start of this instant. This means that everything after the first 4 significant digits of the proportion of the day that this instant represents, will be truncated.

    • getUnixEpochMilliseconds

      public long getUnixEpochMilliseconds()
      Gets the total number of milliseconds from the UNIX Epoch, up to the final point of the millisecond represented by this instant. For instants that occurred before the UNIX Epoch, a negative number is returned.
    • toJavaInstant

      public Instant toJavaInstant()
      Gets the Java Instant that represents the same point in time as this Instant.
    • differenceWith

      public long differenceWith(Instant other)
      Returns the amount of milliseconds between this instant and the given non-null Instant, directionally. Therefore, if this instant is after the other instant, the result will be a positive number. If this instant is before the other instant, the result will be a negative number. If they represent the same Instant on the timeline, the result will be 0.
    • differenceInBeepsWith

      public int differenceInBeepsWith(Instant other)
      Returns the amount of beeps between this instant and the given non-null Instant, directionally. Therefore, if this instant is after the other instant, the result will be a positive number. If this instant is before the other instant, the result will be a negative number. If they represent the same Instant on the timeline, the result will be 0.

      Please note that the duration of a beep is 1/10000th of a day. Since the duration of a day is not constant, the duration of the beeps that constitute the returned difference may vary if this instant is compared to an Instant that is on a different day. For example, if this Instant is at 2000 beeps of the current day and it is compared to an Instant that is at 8000 beeps of the previous day, the result will be 4000. 2000 of these beeps have the duration of 2000/10000th of the current day and the other 2000 beeps have the duration of 2000/10000th of the previous day.

      The same principle applies if there is more than 1 day between the compared Instants.

      If the difference in beeps between the the compared Instants is not a whole number, then the decimal part of the result will be truncated.

      If the exact difference between 2 Instants is needed, please use differenceWith(Instant).

    • of

      public static Instant of(long epochMilliseconds)
      Creates a new Instant representing the given number of milliseconds since the start of the Lukashian Calendar. See the javadoc of Instant for an explanation of how a millisecond is translated to a proportion of a day.
      Throws:
      LukashianException - when the given number of milliseconds is lower than 0
    • of

      public static Instant of(Day day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed. For more information on how this mechanism works, see the javadoc of Instant.
      Throws:
      LukashianException - when the given proportion is not between 0 (inclusive) and 1 (exclusive)
    • of

      public static Instant of(Year year, int day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
      Throws:
      LukashianException - when the given day does not exist for the given year or when the given proportion is not between 0 (inclusive) and 1 (exclusive)
    • of

      public static Instant of(int year, int day, org.apache.commons.numbers.fraction.BigFraction proportionOfDay)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
      Throws:
      LukashianException - when the given year is 0 or lower or when the given day does not exist for the given year or when the given proportion is not between 0 (inclusive) and 1 (exclusive)
    • of

      public static Instant of(Day day, int beeps)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
      Throws:
      LukashianException - when the given proportion is not between 0 (inclusive) and 9999 (inclusive)
    • of

      public static Instant of(Year year, int day, int beeps)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
      Throws:
      LukashianException - when the given day does not exist for the given year or when the given proportion is not between 0 (inclusive) and 9999 (inclusive)
    • of

      public static Instant of(int year, int day, int beeps)
      Creates a new Instant that represents the millisecond at the point in time when the given proportion of the given day has passed.
      Throws:
      LukashianException - when the given year is 0 or lower or when the given day does not exist for the given year or when the given proportion is not between 0 (inclusive) and 9999 (inclusive)
    • ofUnixEpochMilliseconds

      public static Instant ofUnixEpochMilliseconds(long unixEpochMilliseconds)
      Creates a new Instant representing the amount of milliseconds since the UNIX Epoch. Negative numbers are allowed.
      Throws:
      LukashianException - when the given value would result in a point before the start of the Lukashian Calendar
    • ofJavaInstant

      public static Instant ofJavaInstant(Instant javaInstant)
      Creates a new Instant representing the same point in time as the given Java Instant.
      Throws:
      LukashianException - when the given value would result in a point before the start of the Lukashian Calendar
    • now

      public static Instant now()
      Returns the current Instant.
    • compareTo

      public int compareTo(Instant other)
      Specified by:
      compareTo in interface Comparable<Instant>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object