Created
September 13, 2011 20:04
-
-
Save arturaz/1214962 to your computer and use it in GitHub Desktop.
Scala side
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Finder { | |
| def find( | |
| source: Locatable, | |
| sourceJumpgates: Set[SolarSystemPoint], | |
| sourceSs: Option[SolarSystem], | |
| sourceSsGalaxyCoords: Option[Coords], | |
| target: Locatable, | |
| targetJumpgates: Set[SolarSystemPoint], | |
| targetSs: Option[SolarSystem], | |
| targetSsGalaxyCoords: Option[Coords], | |
| avoidablePoints: Option[Seq[SolarSystemPoint]] | |
| ): Seq[ServerLocation] = { ... } | |
| } | |
| trait Locatable { | |
| def toServerLocation(timeMultiplier: Double): ServerLocation | |
| def toServerLocation: ServerLocation = toServerLocation(1.0) | |
| } | |
| case class SolarSystemPoint( | |
| solarSystem: SolarSystem, coords: Coords | |
| ) extends Locatable with InSolarSystem { | |
| def this(planet: Planet) = this(planet.solarSystem, planet.coords) | |
| def toServerLocation(timeMultiplier: Double) = | |
| ServerLocation(solarSystem.id, | |
| objects.Location.SolarSystem, | |
| Some(coords), | |
| timeMultiplier) | |
| def solarSystemId = solarSystem.id | |
| def solarSystemPoint = this | |
| } | |
| case class SolarSystemPoint( | |
| solarSystem: SolarSystem, coords: Coords | |
| ) extends Locatable with InSolarSystem { | |
| def this(planet: Planet) = this(planet.solarSystem, planet.coords) | |
| def toServerLocation(timeMultiplier: Double) = | |
| ServerLocation(solarSystem.id, | |
| objects.Location.SolarSystem, | |
| Some(coords), | |
| timeMultiplier) | |
| def solarSystemId = solarSystem.id | |
| def solarSystemPoint = this | |
| } | |
| class Coords(initialX: Int, initialY: Int) extends WithCoords { | |
| x = initialX | |
| y = initialY | |
| override def toString = "<Coords %d,%d>".format(x, y) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment