FileDocCategorySizeDatePackage
CDDiscDataAccess.javaAPI DocExample1984Thu Oct 13 14:58:00 BST 2005com.samscdrental.dataaccess

CDDiscDataAccess

public class CDDiscDataAccess 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 Collection
theCollection
Constructors Summary
Methods Summary
public voidadd(CDDisc aCDDisc)
add

param
aCDDisc CDDisc

 

	    	 
	     
	
		theCollection.add( aCDDisc );
	
public CDDisc[]findAll()
findAll

		int size = theCollection.size();
		CDDisc[] cddiscs = new CDDisc[size];
		Iterator iterator = theCollection.iterator();

		for ( int i = 0; i < cddiscs.length; i++ )
		{
			cddiscs[i] = ( CDDisc ) iterator.next();

		}
		return cddiscs;
	
public CDDisc[]findByCDRelease(CDRelease aCDRelease)
findByCDRelease

return
CDDisc

		Iterator iterator = theCollection.iterator();
		Vector cdDiscs = new Vector();
		while ( iterator.hasNext() )
		{
			CDDisc cdDisc = ( CDDisc ) iterator.next();
			if ( cdDisc.getCdRelease().equals( aCDRelease ) )
			{
				cdDiscs.add( cdDisc );
			}
		}
		return ( CDDisc[] ) cdDiscs.toArray();
	
public CDDiscfindByPhysicalID(PhysicalID aPhysicalID)
findByCDRelease

return
CDDisc

		Iterator iterator = theCollection.iterator();
		while ( iterator.hasNext() )
		{
			CDDisc cdDisc = ( CDDisc ) iterator.next();
			if ( cdDisc.getPhysicalID().equals( aPhysicalID ) )
			{
				return cdDisc;
			}
		}
		return null;
	
public voidremove(CDDisc aCDDisc)
remove

param
aCDDisc CDDisc

		theCollection.remove( aCDDisc );
	
public voidremoveAll_TestingOnly()
removeAll

		theCollection.clear();