/**
 * ThisTime 2.0 (2008-03-30)
 * Copyright 2007 Zach Scrivena
 * zachscrivena@gmail.com
 * http://thistime.sourceforge.net/
 *
 * Simple clock and timer program.
 *
 * TERMS AND CONDITIONS:
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package thistime;


/**
 * Represent a clock value for display.
 */
class ClockValue
{
    /** true for 24-hour time format; false for 12-hour time format */
    boolean hour24;

    /** true for AM; false for PM (used only for 12-hour time format) */
    boolean am;

    /** number of hours (0 <= x <= 23, or 1 <= x <= 12) */
    int h;

    /** number of minutes (0 <= x <= 59) */
    int m;

    /** number of seconds (0 <= x <= 59) */
    int s;


    @Override
    public boolean equals(
            Object obj)
    {
        if (obj instanceof ClockValue)
        {
            final ClockValue o = (ClockValue) obj;

            return ((hour24 == o.hour24) &&
                    (am == o.am) &&
                    (h == o.h) &&
                    (m == o.m) &&
                    (s == o.s));
        }
        else
        {
            return false;
        }
    }


    @Override
    public int hashCode()
    {
        int hash = 7;
        hash = 31 * hash + (hour24 ? 1 : 0);
        hash = 31 * hash + (am ? 1 : 0);
        hash = 31 * hash + h;
        hash = 31 * hash + m;
        hash = 31 * hash + s;
        return hash;
    }
}