// Path: src/main/java/com/scheible/risingempire/game/common/command/Command.java
// public abstract class Command {
//     
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/common/command/FleetDispatchCommand.java
// public class FleetDispatchCommand extends Command {
//     
//     private final int fleetId;
//     private final String destinationStar;
// 
// 	public FleetDispatchCommand(int fleetId, String destinationStar) {
// 		this.fleetId = fleetId;
// 		this.destinationStar = destinationStar;
// 	}
// 
// 	public int getFleetId() {
// 		return fleetId;
// 	}
// 
// 	public String getDestinationStar() {
// 		return destinationStar;
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/Leader.java
// public class Leader {
// 
// 	private final String name;
// 	private final String nation;
// 	private final String homeStar;
// 
// 	public Leader(String name, String nation, String homeStar) {
// 		this.name = name;
// 		this.nation = nation;
// 		this.homeStar = homeStar;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public String getNation() {
// 		return nation;
// 	}
// 
// 	public String getHomeStar() {
// 		return homeStar;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return Objects.hash(name, nation);
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (obj == this) {
// 			return true;
// 		} else if (obj instanceof Leader) {
// 			Leader other = (Leader) obj;
// 			return Objects.equals(name, other.name) && Objects.equals(nation, other.nation);
// 		} else {
// 			return false;
// 		}
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/star/Star.java
// public class Star {
// 	
// 	public static class Prototype {
// 
// 		private String name;
// 		private Vector2D location;
// 
// 		public Prototype(String name, int x, int y) {
// 			this.name = name;
// 			this.location = new Vector2D(x, y);
// 		}	
// 
// 		public String getName() {
// 			return name;
// 		}
// 
// 		public Vector2D getLocation() {
// 			return location;
// 		}
// 	}
// 	
// 	private final String name;
// 	private Vector2D location;
// 	
// 	private Optional<Colony> colony;
// 
// 	public Star(String name, Vector2D location, Optional<Colony> colony) {
// 		this.name = name;
// 		this.location = location;
// 		
// 		this.colony = colony;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public Vector2D getLocation() {
// 		return location;
// 	}
// 
// 	public Optional<Colony> getColony() {
// 		return colony;
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/star/Stars.java
// public class Stars extends ArrayList<Star> {
// 	
// 	public Star getByName(String star) {
// 		for(Star currentStar : this) {
// 			if(currentStar.getName().equals(star)) {
// 				return currentStar;
// 			}
// 		}
// 		
// 		throw new IllegalStateException("The star '" + star + "' is unknown!");
// 	}
// }


import com.scheible.risingempire.game.common.command.Command;
import com.scheible.risingempire.game.common.command.FleetDispatchCommand;
import com.scheible.risingempire.game.core.Leader;
import com.scheible.risingempire.game.core.star.Star;
import com.scheible.risingempire.game.core.star.Stars;
import java.util.List;
import java.util.Optional;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
package com.scheible.risingempire.game.core.fleet;


/**
 *
 * @author sj
 */
public class Fleet {
	
	private final double SPEED = 30.0f;
	
	private final int id;
	private final Leader leader;
	
	private Star star;
	
	private Optional<Star> destinationStar;
	
	private Optional<Vector2D> location;

	public Fleet(int id, Leader leader, Star star) {
		this.id = id;
		this.leader = leader;
		
		this.star = star;
		destinationStar = Optional.empty();
		location = Optional.empty();
	}
	
	public void turn(Stars stars, List<Command> commands) {
		for(Command command : commands) {
			if(command instanceof FleetDispatchCommand) {
				FleetDispatchCommand fleetDispatchCommand = (FleetDispatchCommand) command;
				if(fleetDispatchCommand.getFleetId() == id) {
					this.destinationStar = Optional.of(stars.getByName(fleetDispatchCommand.getDestinationStar()));
					location = Optional.of(star.getLocation());

					move();
					return;
				}
			}
		}
		
		if(destinationStar.isPresent()) {
// Path: src/main/java/com/scheible/risingempire/game/common/command/Command.java
// public abstract class Command {
//     
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/common/command/FleetDispatchCommand.java
// public class FleetDispatchCommand extends Command {
//     
//     private final int fleetId;
//     private final String destinationStar;
// 
// 	public FleetDispatchCommand(int fleetId, String destinationStar) {
// 		this.fleetId = fleetId;
// 		this.destinationStar = destinationStar;
// 	}
// 
// 	public int getFleetId() {
// 		return fleetId;
// 	}
// 
// 	public String getDestinationStar() {
// 		return destinationStar;
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/Leader.java
// public class Leader {
// 
// 	private final String name;
// 	private final String nation;
// 	private final String homeStar;
// 
// 	public Leader(String name, String nation, String homeStar) {
// 		this.name = name;
// 		this.nation = nation;
// 		this.homeStar = homeStar;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public String getNation() {
// 		return nation;
// 	}
// 
// 	public String getHomeStar() {
// 		return homeStar;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		return Objects.hash(name, nation);
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (obj == this) {
// 			return true;
// 		} else if (obj instanceof Leader) {
// 			Leader other = (Leader) obj;
// 			return Objects.equals(name, other.name) && Objects.equals(nation, other.nation);
// 		} else {
// 			return false;
// 		}
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/star/Star.java
// public class Star {
// 	
// 	public static class Prototype {
// 
// 		private String name;
// 		private Vector2D location;
// 
// 		public Prototype(String name, int x, int y) {
// 			this.name = name;
// 			this.location = new Vector2D(x, y);
// 		}	
// 
// 		public String getName() {
// 			return name;
// 		}
// 
// 		public Vector2D getLocation() {
// 			return location;
// 		}
// 	}
// 	
// 	private final String name;
// 	private Vector2D location;
// 	
// 	private Optional<Colony> colony;
// 
// 	public Star(String name, Vector2D location, Optional<Colony> colony) {
// 		this.name = name;
// 		this.location = location;
// 		
// 		this.colony = colony;
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public Vector2D getLocation() {
// 		return location;
// 	}
// 
// 	public Optional<Colony> getColony() {
// 		return colony;
// 	}
// }
// 
// Path: src/main/java/com/scheible/risingempire/game/core/star/Stars.java
// public class Stars extends ArrayList<Star> {
// 	
// 	public Star getByName(String star) {
// 		for(Star currentStar : this) {
// 			if(currentStar.getName().equals(star)) {
// 				return currentStar;
// 			}
// 		}
// 		
// 		throw new IllegalStateException("The star '" + star + "' is unknown!");
// 	}
// }


// Path: src/main/java/com/scheible/risingempire/game/core/fleet/Fleet.java
import com.scheible.risingempire.game.common.command.Command;
import com.scheible.risingempire.game.common.command.FleetDispatchCommand;
import com.scheible.risingempire.game.core.Leader;
import com.scheible.risingempire.game.core.star.Star;
import com.scheible.risingempire.game.core.star.Stars;
import java.util.List;
import java.util.Optional;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;

package com.scheible.risingempire.game.core.fleet;


/**
 *
 * @author sj
 */
public class Fleet {
	
	private final double SPEED = 30.0f;
	
	private final int id;
	private final Leader leader;
	
	private Star star;
	
	private Optional<Star> destinationStar;
	
	private Optional<Vector2D> location;

	public Fleet(int id, Leader leader, Star star) {
		this.id = id;
		this.leader = leader;
		
		this.star = star;
		destinationStar = Optional.empty();
		location = Optional.empty();
	}
	
	public void turn(Stars stars, List<Command> commands) {
		for(Command command : commands) {
			if(command instanceof FleetDispatchCommand) {
				FleetDispatchCommand fleetDispatchCommand = (FleetDispatchCommand) command;
				if(fleetDispatchCommand.getFleetId() == id) {
					this.destinationStar = Optional.of(stars.getByName(fleetDispatchCommand.getDestinationStar()));
					location = Optional.of(star.getLocation());

					move();
					return;
				}
			}
		}
		
		if(destinationStar.isPresent()) {
			move();