Package model

Class MazeGraph.MazeVertex

java.lang.Object
model.MazeGraph.MazeVertex
All Implemented Interfaces:
Vertex<MazeGraph.MazeEdge>
Enclosing class:
MazeGraph

public static class MazeGraph.MazeVertex extends Object implements Vertex<MazeGraph.MazeEdge>
A vertex in our graph, corresponding to a path tile in the tile grid.
  • Field Details

  • Constructor Details

    • MazeVertex

      public MazeVertex(MazeGraph.IPair loc)
      Construct a new vertex at location `loc` with no outgoing edges.
  • Method Details

    • edgeInDirection

      public MazeGraph.MazeEdge edgeInDirection(MazeGraph.Direction direction)
      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

      public MazeGraph.IPair loc()
      Return the coordinates of this vertex's tile in the tile grid.
    • outgoingEdges

      public Iterable<MazeGraph.MazeEdge> 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 interface Vertex<MazeGraph.MazeEdge>
    • addOutgoingEdge

      void addOutgoingEdge(MazeGraph.MazeEdge edge)
      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`.