package edu.agh.tunev.model.cellular.agent;

import java.awt.geom.Point2D;

import edu.agh.tunev.model.AbstractPerson;

public final class Person extends AbstractPerson {
	
	public enum Orientation{
		E, NE, N, NW, W, SW, S, SE	
	}

	public Person(Point2D.Double position) {
		super(position);
	}
	
	public static Double orientToAngle(Orientation orient) throws WrongOrientationException{	
		//starting at east
		Double angle = 0.0;
		Person.Orientation[] orientValues = Person.Orientation.values();
		
		//TODO: more sensible error handling
		for(int i = 0; i < orientValues.length && orient != orientValues[i]; ++i){
			angle += 45.0;
		}
		
		if(angle > 315)
			throw new WrongOrientationException();
		else 
			return angle;
	}

}

@@ -166,16 +166,146 @@
 son %7B%0A%09%0A
+%09public static final class WrongOrientationException extends Exception %7B%0A%0A%09%09private static final long serialVersionUID = 1L;%0A%0A%09%7D%0A%0A
 %09public 

Throw WrongOrientationException (resolving compile-time issues)