FileDocCategorySizeDatePackage
CDCategory.javaAPI DocExample2293Thu Oct 13 14:57:50 BST 2005com.samscdrental.model

CDCategory

public class CDCategory extends Object implements Serializable

Title: Sams CD Rental Store

Description:

Copyright: Copyright (c) 2004

Company:

author
Ken Pugh
version
1.0

Fields Summary
private static final long
serialVersionUID
static final int
NEW_RELEASE_CD
static final int
GOLDIE_OLDIE_CD
static final int
REGULAR_CD
static final int
INVALID_CATEGORY
private static final String[]
theStringValues
private static final int[]
theCorrespondingValues
private int
theValue
private static final String
ERROR_CD_CATEGORY_VALUE
Constructors Summary
public CDCategory()

	 
	

	
public CDCategory(int value)

		if ( value >= NEW_RELEASE_CD && value < INVALID_CATEGORY )
		{
			theValue = value;
		}
		else
		{
			throw new IllegalArgumentException( ERROR_CD_CATEGORY_VALUE + value );
		}
	
Methods Summary
public booleanequals(com.samscdrental.model.CDCategory aCDCategory)
Indicates whether some other object is "equal to" this one.

param
obj the reference object with which to compare.
return
true if this object is the same as the obj argument; false otherwise.
todo
Implement this java.lang.Object method

		return ( theValue == aCDCategory.theValue );
	
public booleanequals(java.lang.Object obj)

		return this.equals( ( CDCategory ) obj );
	
private voidfromString(java.lang.String aString)

		for ( int i = 0; i < theStringValues.length; i++ )
		{
			if ( aString.equals( theStringValues[i] ) )
			{
				theValue = theCorrespondingValues[i];
				return;
			}
		}
		throw new CDCategoryFormatDeviation( ERROR_CD_CATEGORY_VALUE );
	
public static com.samscdrental.model.CDCategoryparseString(java.lang.String aString)

		CDCategory aCDCategory = new CDCategory();
		aCDCategory.fromString( aString );
		return aCDCategory;
	
public java.lang.StringtoString()

		return theStringValues[theValue];