/*
 * @(#)ShapeFactory.java	1.0 11-Apr-07
 *
 * IIT Bombay, 
 * Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.
 */

package classes.shapes;

import interfaces.ICommandMediator;
import interfaces.IShape;
import interfaces.IShapeFactory;
import types.ShapeCoordinates;

/**
 * Factory class for the shape objects
 *
 * @author  Prathab, Mukesh
 * @version 1.0, 06-Apr-07
 */
public class ShapeFactory implements IShapeFactory{
	
	/**
	 * Creates the Shape object  
	 * 
	 * @param shapeName name of the shape
	 * @param shapeCoordinates default coordinates of the shape
	 * @param commandMediator command meditor to interact with other classes
	 * @return returns the <tt>IShape</tt> object
	 * @see types.ShapeCoordinates
	 * @see interfaces.ICommandMediator
	 */
	public IShape getShape(String shapeName, ShapeCoordinates shapeCoordinates, 
			ICommandMediator commandMediator) {
		if(shapeName.equals("Rectangle")) return new RectangleShape(shapeCoordinates,commandMediator);
	   	 else if(shapeName.equals("Circle")) return new CircleShape(shapeCoordinates,commandMediator);
	   	 else if(shapeName.equals("Triangle")) return new TriangleShape(shapeCoordinates,commandMediator);
	   	 return null;
	}
}
