|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectworld.World
The main object - the world. It contains all other objects belonging to it.
Field Summary | |
private java.util.ArrayList |
airports
A set of airports on this world. |
private java.util.ArrayList |
busStops
A set of bus stops on this world. |
private java.util.ArrayList |
cities
A set of cities on this world. |
private java.util.ArrayList |
connections
A list of connections. |
private java.util.ArrayList |
harbours
A set of harbours on this world. |
private int |
nextAirConnectionNumber
A number assigned to the next air connection being added to the world. |
private int |
nextBusConnectionNumber
A number assigned to the next bus connection being added to the world. |
private int |
nextRailroadConnectionNumber
A number assigned to the next railroad connection being added to the world. |
private int |
nextSeaConnectionNumber
A number assigned to the next sea connection being added to the world. |
private java.util.ArrayList |
trainStations
A set of train stations on this world. |
private static World |
world
The one and only instance of this class. |
Constructor Summary | |
private |
World()
Constructor. |
Method Summary | |
void |
AddAirport(Airport airport)
Adds a single airport to the list of airports on this world. |
void |
AddBusStop(BusStop busStop)
Adds a single bus stop to the list of bus stops on this world. |
void |
AddCity(City city)
Adds a single city to the list of cities on this world. |
void |
AddConnection(Connection connection)
Add a new connection to this world. |
void |
AddHarbour(Harbour harbour)
Adds a single harbour to the list of harbours on this world. |
void |
AddTrainStation(TrainStation trainStation)
Adds a single train station to the list of train stations on this world. |
static void |
Clear()
Clears the world. |
java.util.Iterator |
GetAirports()
Gets an iterator to the airports on this world. |
java.util.Iterator |
GetBusStops()
Gets an iterator to the bus stops on this world. |
java.util.Iterator |
GetCities()
Gets an iterator to the cities on this world. |
java.util.Iterator |
GetConnections()
Gets an iterator for the connections. |
java.util.Iterator |
GetHarbours()
Gets an iterator to the harbours on this world. |
static World |
GetInstance()
Gets the one and only instance of this class. |
java.lang.String |
GetNextConnectionName(int meanOfTransportation)
Gets a unique name for the connection for the given mean of transportation. |
java.util.Iterator |
GetTrainStations()
Gets an iterator to the train stations on this world. |
void |
RemoveAirport(Airport airport)
Removes a given airport from this world. |
void |
RemoveBusStop(BusStop busStop)
Removes a given bus stop from this world. |
void |
RemoveCity(City city)
Removes a given city from this world. |
void |
RemoveConnection(Connection connection)
Removes a given connection from this world. |
private void |
RemoveConnectionsWithStation(Station station)
Removes all the connections that contain the given station. |
void |
RemoveHarbour(Harbour harbour)
Removes a given harbour from this world. |
void |
RemoveTrainStation(TrainStation trainStation)
Removes a given train station from this world. |
void |
SaveAs(java.lang.String fileName)
Saves this world to the given file. |
private static void |
SaveLocationTag(java.io.FileWriter fileWriter,
Location location,
java.lang.String linePrefix)
Stores a location tag for the given location object to the given file writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static World world
private int nextAirConnectionNumber
private int nextRailroadConnectionNumber
private int nextBusConnectionNumber
private int nextSeaConnectionNumber
private java.util.ArrayList cities
private java.util.ArrayList airports
private java.util.ArrayList trainStations
private java.util.ArrayList busStops
private java.util.ArrayList harbours
private java.util.ArrayList connections
Constructor Detail |
private World()
Method Detail |
public static World GetInstance()
public static void Clear()
public void AddCity(City city)
city
- A city to be added.public void RemoveCity(City city)
city
- A city to be removed.public java.util.Iterator GetCities()
public void AddAirport(Airport airport)
airport
- An airport to be added.public void RemoveAirport(Airport airport)
airport
- An airport to be removed.public java.util.Iterator GetAirports()
public void AddTrainStation(TrainStation trainStation)
trainStation
- A train station to be added.public void RemoveTrainStation(TrainStation trainStation)
trainStation
- A train station to be removed.public java.util.Iterator GetTrainStations()
public void AddBusStop(BusStop busStop)
busStop
- A bus stop to be added.public void RemoveBusStop(BusStop busStop)
busStop
- A bus stop to be removed.public java.util.Iterator GetBusStops()
public void AddHarbour(Harbour harbour)
harbour
- A harbour to be added.public void RemoveHarbour(Harbour harbour)
harbour
- A harbour to be removed.public java.util.Iterator GetHarbours()
private void RemoveConnectionsWithStation(Station station)
station
- All the connections containing this station will be removed.public void AddConnection(Connection connection)
connection
- public void RemoveConnection(Connection connection)
connection
- A connection to be removed.public java.util.Iterator GetConnections()
public void SaveAs(java.lang.String fileName)
fileName
- A name of the file to save the world to.private static void SaveLocationTag(java.io.FileWriter fileWriter, Location location, java.lang.String linePrefix) throws java.io.IOException
fileWriter
- A file writer to write to.location
- A location to be serialised.linePrefix
- A string added to each line (Spaces).
java.io.IOException
- Thrown in case of error.public java.lang.String GetNextConnectionName(int meanOfTransportation)
meanOfTransportation
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |