|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfreerails.controller.BuildTrackExplorer
public class BuildTrackExplorer
GraphExplorer that explorers possible track placements, the ints it returns are encoded PositionOnTrack objects.
Field Summary | |
---|---|
private boolean |
beforeFirst
|
private BuildTrackStrategy |
buildTrackStrategy
|
(package private) PositionOnTrack |
currentBranch
|
private PositionOnTrack |
currentPosition
|
private int |
directionInt
|
private FreerailsPrincipal |
principle
|
private ImPoint |
target
|
private static TrackConfiguration |
TILE_CENTER
|
private boolean |
usingExistingTrack
|
private ReadOnlyWorld |
world
|
Constructor Summary | |
---|---|
BuildTrackExplorer(ReadOnlyWorld w,
FreerailsPrincipal principle)
|
|
BuildTrackExplorer(ReadOnlyWorld w,
FreerailsPrincipal principle,
ImPoint start,
ImPoint target)
|
Method Summary | |
---|---|
private boolean |
canBuildTrack()
Tests whether we can build track in the direction specified by m_direction. |
private TrackRule |
getAppropriateTrackRule(int x,
int y)
|
int |
getEdgeCost()
Calculates a cost figure incorporating the distance and the cost of any new track. |
int |
getH()
|
int |
getPosition()
Return the current edge. |
int |
getVertexConnectedByEdge()
Returns the vertex that is connected to the current vertex by the current edge. |
boolean |
hasNextEdge()
|
void |
moveForward()
Moves this GraphExplorer from the current vertex to the vertex that is connected to the current vertex by the current edge. |
void |
nextEdge()
Sets the current edge to the current vertex's next edge. |
void |
setBuildTrackStrategy(BuildTrackStrategy trackStrategy)
|
void |
setPosition(int vertex)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final TrackConfiguration TILE_CENTER
private boolean beforeFirst
final PositionOnTrack currentBranch
private final PositionOnTrack currentPosition
private int directionInt
private final ImPoint target
private BuildTrackStrategy buildTrackStrategy
private boolean usingExistingTrack
private final ReadOnlyWorld world
private final FreerailsPrincipal principle
Constructor Detail |
---|
public BuildTrackExplorer(ReadOnlyWorld w, FreerailsPrincipal principle)
public BuildTrackExplorer(ReadOnlyWorld w, FreerailsPrincipal principle, ImPoint start, ImPoint target)
Method Detail |
---|
private boolean canBuildTrack()
Tests whether we can build track in the direction specified by m_direction.
If we enter a tile from a given direction, the tiles we can build track to depend on the following. (1) The terrain type of the surrounding tiles - track can only be built on certain terrain types. (2) The direction we entered the current tile from. (3) Any existing track on the current tile - limits possible track configurations. (4) The terrain type of the current tile - terrain type determines which track types and hence which track configurations can be built.
private TrackRule getAppropriateTrackRule(int x, int y)
public int getEdgeCost()
getEdgeCost
in interface GraphExplorer
public int getH()
getH
in interface GraphExplorer
public int getPosition()
GraphExplorer
getPosition
in interface GraphExplorer
public int getVertexConnectedByEdge()
GraphExplorer
getVertexConnectedByEdge
in interface GraphExplorer
public boolean hasNextEdge()
hasNextEdge
in interface GraphExplorer
public void moveForward()
GraphExplorer
moveForward
in interface GraphExplorer
public void nextEdge()
GraphExplorer
nextEdge
in interface GraphExplorer
public void setPosition(int vertex)
setPosition
in interface GraphExplorer
public void setBuildTrackStrategy(BuildTrackStrategy trackStrategy)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |