/*
 * [BreedI.java]
 *
 * Summary: example use of Enum, with method implemented a different way for each enum constant.
 *
 * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
 *
 * Licence: This software may be copied and used freely for any purpose but military.
 *          http://mindprod.com/contact/nonmil.html
 *
 * Requires: JDK 1.8+
 *
 * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
 *
 * Version History:
 *  1.0 2006-03-02
 */
package com.mindprod.example;

import static java.lang.System.*;

/**
 * example use of Enum, with method implemented a different way for each enum constant.
 *
 * @author Roedy Green, Canadian Mind Products
 * @version 1.0 2006-03-02
 * @since 2006-03-02
 */
@SuppressWarnings( { "UnusedAssignment", "UnusedDeclaration", "WeakerAccess" } )
public enum BreedI
    {
    // Usually you list enum constants in alphabetical order.
    // Eclipse will put them in alphabetical order when you do
    // a Source Sort Members.
        /**
         * Dachshund smooth or curly
         */
        DACHSHUND( "brown" ),
        /**
         * Dalmatian
         */
        DALMATIAN( "spotted" )
                    {
                    // begin DALMATIAN inner class
                    /**
                     * typical spots on a Dalmatian
                     */
                    private static final int SPOTS = 50;

                    /**
                     * Method getSpotcount is Defined only for DALMATIAN. Get
                     * typical count of spots on a Dalmatian
                     * @return spot count
                     */
                    int getSpotCount()
                        {
                        return SPOTS;
                        }
                    // end DALMATIAN inner class
                    },
        /**
         * Labrador all sizes
         */
        LABRADOR( "black or tan" );
    // end of enum constant constructions

    /**
     * additional instance field of every BreedI enum constant object
     */
    private final String colours;

    /**
     * constructor
     *
     * @param colours typical colours of this breed
     */
    BreedI( String colours )
        {
        this.colours = colours;
        }

    /**
     * Test harness
     *
     * @param args not used
     */
    @SuppressWarnings( { "UnusedParameters" } )
    public static void main( String[] args )
        {
        Breed myDog = Breed.DALMATIAN;
        // since the DALMATIAN inner class of Breed is anonymous,
        // we have no way of getting at the getSpotCount method.
        // This won't work:
        //out.println( myDog.getSpotCount() );
        out.println( myDog );
        }

    /**
     * additional method of every BreedI enum constant object
     *
     * @return typical colours of the breed
     */
    public String getColours()
        {
        return colours;
        }
    }