import java.awt.*;
import java.lang.*;
import java.util.*;

/**
  *Encapsulates the information about a collision
  *It is handled as an exception
  *Since collisions ar rare this is more efficient
  */
public class Collision extends Exception{
	protected MovablePiece mPiece;
	protected ArcadeGamePiece aPiece;
	protected Point location;
	protected Vector vector;

	/**
	  *Constructor stores the information from the collision
	  *@param movablePiece - Piece that initiates the collision
	  *@param arcadeGamePiece - Piece that was hit
	  *@param point - location of the collision
	  */
	public Collision(MovablePiece movablePiece,ArcadeGamePiece arcadeGamePiece, Point point){
		location = point;
		mPiece = movablePiece;
		aPiece = arcadeGamePiece;
	}

	/**
	  *Behavior that encapsulates what to do when the collision occurs
	  *post: results of the collision have been computed
	  */ 
	public void occur(){
		mPiece.collideWith(aPiece,location);

	}

}