Package model

Record Class MazeGraph.MazeEdge

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

public static record MazeGraph.MazeEdge(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight) extends Record implements Edge<MazeGraph.MazeVertex>
Represents a directed edge from `src` to `dst` with weight `weight`, which points in direction `direction` on the tile grid.
  • Field Details

    • src

      private final MazeGraph.MazeVertex src
      The field for the src record component.
    • dst

      private final MazeGraph.MazeVertex dst
      The field for the dst record component.
    • direction

      private final MazeGraph.Direction direction
      The field for the direction record component.
    • weight

      private final double weight
      The field for the weight record component.
  • Constructor Details

    • MazeEdge

      public MazeEdge(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight)
      Creates an instance of a MazeEdge record class.
      Parameters:
      src - the value for the src record component
      dst - the value for the dst record component
      direction - the value for the direction record component
      weight - the value for the weight record component
  • Method Details

    • reverse

      public MazeGraph.MazeEdge reverse()
      Return the edge pointing from `dst` to `src` in the maze graph. Requires that the maze graph has been fully constructed.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • src

      public MazeGraph.MazeVertex src()
      Returns the value of the src record component.
      Specified by:
      src in interface Edge<MazeGraph.MazeVertex>
      Returns:
      the value of the src record component
    • dst

      public MazeGraph.MazeVertex dst()
      Returns the value of the dst record component.
      Specified by:
      dst in interface Edge<MazeGraph.MazeVertex>
      Returns:
      the value of the dst record component
    • direction

      public MazeGraph.Direction direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • weight

      public double weight()
      Returns the value of the weight record component.
      Specified by:
      weight in interface Edge<MazeGraph.MazeVertex>
      Returns:
      the value of the weight record component