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
{
/**
* Dachshund smooth or curly
*/
DACHSHUND( "brown" ),
/**
* Dalmatian
*/
DALMATIAN( "spotted" )
{
/**
* 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;
}
},
/**
* Labrador all sizes
*/
LABRADOR( "black or tan" );
/**
* 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;
out.println( myDog );
}
/**
* additional method of every BreedI enum constant object
*
* @return typical colours of the breed
*/
public String getColours()
{
return colours;
}
}