/**********************************************************************/
/*                                                                    */
/* Copyright (c) 2003 by Sun Microsystems, Inc.                       */
/* All rights reserved.                                               */
/*                                                                    */
/**********************************************************************/

package scouser;

/*
	Memory contained database of NameAlias objects.
	Provides an implementation of the GetAlias interface.
*/
public class GetAliasInMemoryStore implements scouser.GetAlias
{
	static NameAlias DataBase[] = {
	  new NameAlias("George Herman Ruth","The BABE"),
	  new NameAlias("Frank Sinatra", "Old Blue Eyes"),
	  new NameAlias("Daffy Duck","A Fine Feathered Friend"),
	  new NameAlias("Davey Jones", "Soggy Sailor"),
	  new NameAlias("Humpty Dumpty Smith", "Crazy Egghead"),
	  new NameAlias("Kemo Sabe", "The Lone Ranger"),
	  new NameAlias("Clark Kent", "Superman"),
	  new NameAlias("Don Diego de laVega", "Zorro"),
	  new NameAlias("Elfego Baca", "The Dude with Nine Lives"),
	  new NameAlias("Randy Johnson", "The Big Unit"),
	  new NameAlias("Sugar Daddy", "Uncle Sam"),
	  new NameAlias(null, "Couldn't match name")
	};

	//	implementation of the GetAlias interface
	public String LookupAlias(String Name)
	{
		int i = 0;

		while (DataBase[i].getName() != null) {
			if (DataBase[i].getName().equals(Name)) {
				break;
			}
			i++;
		}
		return DataBase[i].getAlias();
	}
}
