package jp.ac.nii.icpc2010.recorder;

import jp.ac.nii.icpc2010.playfield.FieldDirection;



public enum PlayerEvent {
	 MoveUp, MoveDown, MoveLeft, MoveRight, Timeout;
	 
	 public FieldDirection toFieldDirection() {
		 switch(this) {
		 case MoveUp: 
			 return FieldDirection.Up;
		 case MoveDown:
			 return FieldDirection.Down;
		 case MoveLeft:
			 return FieldDirection.Left;
		 case MoveRight:
			 return FieldDirection.Right;
		 case Timeout:
			 return null;			 
		 }
		 return null;
	 }
	 
	 public static PlayerEvent fromFieldDirection(FieldDirection dir) {
		 switch(dir) {
		 case Up:
			 return MoveUp;
		 case Down:
			 return MoveDown;
		 case Left:
			 return MoveLeft;
		 default:
			 return MoveRight;
		 }		 
	 }
	  
}
