FileDocCategorySizeDatePackage
PhysicalID.javaAPI DocExample2638Thu Oct 13 14:57:28 BST 2005com.samscdrental.model.adt

PhysicalID

public class PhysicalID 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
private String
theValue
private static final String
INVALID_ID
private static final int
LENGTH_OF_VALUE
private static final String
ERROR_PHYSICAL_ID_BAD_LENGTH
private static final String
ERROR_PHYSICAL_ID_BAD_CHARACTERS
Constructors Summary
public PhysicalID()

 

	 
	
	
public PhysicalID(String aString)
PhysicalID

param
aString String

		fromString( aString );

	
Methods Summary
public booleanequals(com.samscdrental.model.adt.PhysicalID aPhysicalID)
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 ( aPhysicalID.theValue.equals( this.theValue ) );

	
public booleanequals(java.lang.Object obj)
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 equals( ( PhysicalID ) obj );
	
private voidfromString(java.lang.String aString)
fromString

param
aString String
return
boolean

		if ( aString.length() == LENGTH_OF_VALUE )
		{
			if ( !StringHelper.containsOnlyNumerics( aString ) )
			{
				throw new PhysicalIDFormatDeviation(
					ERROR_PHYSICAL_ID_BAD_CHARACTERS );
			}
			theValue = aString;
		}
		else
		{
			throw new PhysicalIDFormatDeviation( ERROR_PHYSICAL_ID_BAD_LENGTH );
		}
	
booleanisInvalid()

		return theValue.equals( INVALID_ID );
	
public static com.samscdrental.model.adt.PhysicalIDparseString(java.lang.String aString)

		return new PhysicalID( aString );
	
public java.lang.StringtoString()

		return theValue;