Class Location

java.lang.Object
  extended by Location

public class Location
extends java.lang.Object

This class represents a Solar System within our game


Field Summary
private  java.lang.String appearance
          The appearance of this Location -- 'sunny', 'boring', etc.
private  Market market
          The Location's market
private  java.lang.String name
          The name of this Location
private  double posX
          x pos of location in 2d array universe
private  double posY
          y pos of location in 2d array universe
 
Constructor Summary
Location()
          This constructor creates a default location with some set of initial values
Location(java.lang.String theName, java.lang.String theAppearance, double thePosX, double thePosY)
          This constructor creates a location according to the passed values and leaves the market as null
Location(java.lang.String theName, java.lang.String theAppearance, double thePosX, double thePosY, Market theMarket)
          This constructor creates a location according to the passed values
 
Method Summary
 java.lang.String getAppearance()
          Get the Appearance value.
 double getDistance(Location other)
          Calculates and returns the distance between this location and the one passed
 Market getMarket()
          Get the Market value.
 java.lang.String getName()
          Get the Name value.
 double getPosX()
          Get the PosX value.
 double getPosY()
          Get the PosY value.
 void setAppearance(java.lang.String newAppearance)
          Set the Appearance value.
 void setMarket(Market newMarket)
          Set the Market value.
 void setName(java.lang.String newName)
          Set the Name value.
 void setPosX(double newPosX)
          Set the PosX value.
 void setPosY(double newPosY)
          Set the PosY value.
 java.lang.String toString()
          Returns a String representation of the location (its name)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

appearance

private java.lang.String appearance
The appearance of this Location -- 'sunny', 'boring', etc.


market

private Market market
The Location's market


name

private java.lang.String name
The name of this Location


posX

private double posX
x pos of location in 2d array universe


posY

private double posY
y pos of location in 2d array universe

Constructor Detail

Location

public Location()
This constructor creates a default location with some set of initial values


Location

public Location(java.lang.String theName,
                java.lang.String theAppearance,
                double thePosX,
                double thePosY)
This constructor creates a location according to the passed values and leaves the market as null

Parameters:
theName - The name of the location
theAppearance - The appearance of the location
thePosX - The x position of location in the 2d array universe
thePosY - The y position of location in the 2d array universe

Location

public Location(java.lang.String theName,
                java.lang.String theAppearance,
                double thePosX,
                double thePosY,
                Market theMarket)
This constructor creates a location according to the passed values

Parameters:
theName - The name of the location
theAppearance - The appearance of the location
thePosX - The x position of location in the 2d array universe
thePosY - The y position of location in the 2d array universe
theMarket - The value for the market at this location
Method Detail

getAppearance

public java.lang.String getAppearance()
Get the Appearance value.

Returns:
the Appearance value.

setAppearance

public void setAppearance(java.lang.String newAppearance)
Set the Appearance value.

Parameters:
newAppearance - The new Appearance value.

getMarket

public Market getMarket()
Get the Market value.

Returns:
the Market value.

setMarket

public void setMarket(Market newMarket)
Set the Market value.

Parameters:
newMarket - The new Market value.

getName

public java.lang.String getName()
Get the Name value.

Returns:
the Name value.

setName

public void setName(java.lang.String newName)
Set the Name value.

Parameters:
newName - The new Name value.

getPosX

public double getPosX()
Get the PosX value.

Returns:
the PosX value.

setPosX

public void setPosX(double newPosX)
Set the PosX value.

Parameters:
newPosX - The new PosX value.

getPosY

public double getPosY()
Get the PosY value.

Returns:
the PosY value.

setPosY

public void setPosY(double newPosY)
Set the PosY value.

Parameters:
newPosY - The new PosY value.

getDistance

public double getDistance(Location other)
Calculates and returns the distance between this location and the one passed

Parameters:
other - The location to find the distance to from this location
Returns:
the distance between this location and the other location

toString

public java.lang.String toString()
Returns a String representation of the location (its name)

Overrides:
toString in class java.lang.Object
Returns:
the name of the location