Package model
Class MazeGraph.MazeVertex
java.lang.Object
model.MazeGraph.MazeVertex
- All Implemented Interfaces:
Vertex<MazeGraph.MazeEdge>
- Enclosing class:
MazeGraph
A vertex in our graph, corresponding to a path tile in the tile grid.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashMap
<MazeGraph.Direction, MazeGraph.MazeEdge> This vertex's outgoing edges, each associated with the direction it points in.private final MazeGraph.IPair
The location of this vertex's tile within the tile grid. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new vertex at location `loc` with no outgoing edges. -
Method Summary
Modifier and TypeMethodDescription(package private) void
Add `edge` as an outgoing edge from this vertex.edgeInDirection
(MazeGraph.Direction direction) Return the edge leaving this vertex in the direction `direction`, or null if no such edge exists.loc()
Return the coordinates of this vertex's tile in the tile grid.Return an object supporting iteration over all the edges connecting this vertex to another vertex in the graph.
-
Field Details
-
loc
The location of this vertex's tile within the tile grid. -
edgeMap
This vertex's outgoing edges, each associated with the direction it points in.
-
-
Constructor Details
-
MazeVertex
Construct a new vertex at location `loc` with no outgoing edges.
-
-
Method Details
-
edgeInDirection
Return the edge leaving this vertex in the direction `direction`, or null if no such edge exists. The direction of a "tunnel" edge is from the source to the grid's nearest boundary (that is, an edge connecting a top tile to a bottom tile points "up"). -
loc
Return the coordinates of this vertex's tile in the tile grid. -
outgoingEdges
Description copied from interface:Vertex
Return an object supporting iteration over all the edges connecting this vertex to another vertex in the graph. This vertex serves as the "source" vertex for each such edge.- Specified by:
outgoingEdges
in interfaceVertex<MazeGraph.MazeEdge>
-
addOutgoingEdge
Add `edge` as an outgoing edge from this vertex. Requires that this vertex is the edge's source and that no outgoing edge has already been added in the same direction. This method has restricted visibility, as it is only meant to be called when constructing a `MazeGraph`.
-