org.gjt.universe
Class Location

java.lang.Object
  |
  +--org.gjt.universe.Location
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class Location
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

The Location class represents a "location" in the universe. For example, this location might be a coordinate in space or orbiting a planet or docked at a space station. The class LocationType is an enumrated type for this class.

See Also:
LocationType, Serialized Form

Field Summary
(package private)  Coord coord
           
(package private)  GalaxyID galaxyid
           
(package private)  PlanetID planetid
           
(package private)  StationID stationid
           
(package private)  SystemID systemid
           
(package private)  LocationType type
           
 
Constructor Summary
Location()
          Default constructor - sets an undefined location object.
Location(Coord in_coord)
          Constructor that takes a Coord object.
Location(GalaxyID in_galaxy, Coord in_coord)
          Constructor that takes a Coord object.
Location(Location loc)
           
Location(PlanetID PID)
          Constructor that takes a PlanetID object representing orbiting the planet.
Location(PlanetID PID, boolean surface)
          Constructor that takes a PlanetID object and a boolean representing if the location is in orbit or on the surface.
Location(StationID BID)
          Constructor that takes a StationID object.
Location(SystemID SID)
          Constructor that takes a SystemID object.
 
Method Summary
 java.lang.Object clone()
           
 float distance(Location target)
           
 boolean equals(java.lang.Object ob)
           
 Index getContext()
           
 Coord getCoords()
           
 GalaxyID getGalaxy()
           
 PlanetID getPlanet()
           
 StationID getStation()
           
 SystemID getSystem()
           
 LocationType getType()
           
 void setCoords(Coord in_coord)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

LocationType type

coord

Coord coord

galaxyid

GalaxyID galaxyid

systemid

SystemID systemid

planetid

PlanetID planetid

stationid

StationID stationid
Constructor Detail

Location

public Location(Location loc)

Location

public Location()
Default constructor - sets an undefined location object.


Location

public Location(Coord in_coord)
Constructor that takes a Coord object.


Location

public Location(GalaxyID in_galaxy,
                Coord in_coord)
Constructor that takes a Coord object.


Location

public Location(PlanetID PID)
Constructor that takes a PlanetID object representing orbiting the planet.


Location

public Location(PlanetID PID,
                boolean surface)
Constructor that takes a PlanetID object and a boolean representing if the location is in orbit or on the surface.


Location

public Location(SystemID SID)
Constructor that takes a SystemID object. This location represents inside the system (orbiting the star.)


Location

public Location(StationID BID)
Constructor that takes a StationID object. This location represents a station docking.

Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getType

public LocationType getType()

getPlanet

public PlanetID getPlanet()

getSystem

public SystemID getSystem()

getGalaxy

public GalaxyID getGalaxy()

getStation

public StationID getStation()

getContext

public Index getContext()
Returns:
the Index of the DBItem containing this location.

getCoords

public Coord getCoords()

setCoords

public void setCoords(Coord in_coord)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object ob)
Overrides:
equals in class java.lang.Object

distance

public float distance(Location target)


Copyright © 2001 Universe Dev Team All Rights Reserved.