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 Summary
FieldsModifier and TypeFieldDescriptionprivate final MazeGraph.DirectionThe field for thedirectionrecord component.private final MazeGraph.MazeVertexThe field for thedstrecord component.private final MazeGraph.MazeVertexThe field for thesrcrecord component.private final doubleThe field for theweightrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionMazeEdge(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight) Creates an instance of aMazeEdgerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirectionrecord component.dst()Returns the value of thedstrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.reverse()Return the edge pointing from `dst` to `src` in the maze graph.src()Returns the value of thesrcrecord component.final StringtoString()Returns a string representation of this record class.doubleweight()Returns the value of theweightrecord component.
-
Field Details
-
Constructor Details
-
MazeEdge
public MazeEdge(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight) Creates an instance of aMazeEdgerecord class.- Parameters:
src- the value for thesrcrecord componentdst- the value for thedstrecord componentdirection- the value for thedirectionrecord componentweight- the value for theweightrecord component
-
-
Method Details
-
reverse
Return the edge pointing from `dst` to `src` in the maze graph. Requires that the maze graph has been fully constructed. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
src
Returns the value of thesrcrecord component.- Specified by:
srcin interfaceEdge<MazeGraph.MazeVertex>- Returns:
- the value of the
srcrecord component
-
dst
Returns the value of thedstrecord component.- Specified by:
dstin interfaceEdge<MazeGraph.MazeVertex>- Returns:
- the value of the
dstrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
weight
public double weight()Returns the value of theweightrecord component.- Specified by:
weightin interfaceEdge<MazeGraph.MazeVertex>- Returns:
- the value of the
weightrecord component
-