public class MapInstance
extends java.lang.Object
Constructor and Description |
---|
MapInstance()
Instantiates an empty map instance for the purpose of generating a map file
|
MapInstance(java.lang.String filepath)
Dynamically builds the map from a JSON file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addConnection(Connection connection)
Adds a single connection to the map
|
void |
addMapObj(MapObj obj)
Adds an object to the map
|
boolean |
changeNameMapping(MapObj mapObj,
java.lang.String newName) |
Connection[] |
connectionList() |
void |
generateFaults(Replay replay)
Randomly cause faults within stations on the map
|
java.lang.String |
generateJSON() |
Junction |
getJunctionWithName(java.lang.String name) |
Connection |
getReverseConnection(Connection connection) |
Station |
getStationWithName(java.lang.String name) |
Junction[] |
junctionList() |
MapObj[] |
mapObjList() |
void |
removeAllConnections(MapObj startPoint) |
void |
removeConnection(MapObj startPoint,
MapObj endPoint) |
void |
removeJunction(java.lang.String junction) |
void |
removeStation(java.lang.String station)
Removes station from MapInstance
|
void |
reset()
Resets the MapInstance to it's original state, used when you exit to the main menu
|
Station[] |
stationList() |
public MapInstance()
public MapInstance(java.lang.String filepath)
filepath
- provides the path to the JSON file representing the mappublic void reset()
public Station getStationWithName(java.lang.String name)
public Junction getJunctionWithName(java.lang.String name)
public Connection[] connectionList()
public Station[] stationList()
public Junction[] junctionList()
public MapObj[] mapObjList()
public void addMapObj(MapObj obj)
obj
- the MapObj to add to the mappublic boolean addConnection(Connection connection)
connection
- public void removeStation(java.lang.String station)
station
- the station to be removed from the mappublic void removeJunction(java.lang.String junction)
public void removeAllConnections(MapObj startPoint)
public java.lang.String generateJSON()
public void generateFaults(Replay replay)
public Connection getReverseConnection(Connection connection)
public boolean changeNameMapping(MapObj mapObj, java.lang.String newName)