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.Direction
The field for thedirection
record component.private final MazeGraph.MazeVertex
The field for thedst
record component.private final MazeGraph.MazeVertex
The field for thesrc
record component.private final double
The field for theweight
record component. -
Constructor Summary
ConstructorsConstructorDescriptionMazeEdge
(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight) Creates an instance of aMazeEdge
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirection
record component.dst()
Returns the value of thedst
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
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 thesrc
record component.final String
toString()
Returns a string representation of this record class.double
weight()
Returns the value of theweight
record component.
-
Field Details
-
src
The field for thesrc
record component. -
dst
The field for thedst
record component. -
direction
The field for thedirection
record component. -
weight
private final double weightThe field for theweight
record component.
-
-
Constructor Details
-
MazeEdge
public MazeEdge(MazeGraph.MazeVertex src, MazeGraph.MazeVertex dst, MazeGraph.Direction direction, double weight) Creates an instance of aMazeEdge
record class.- Parameters:
src
- the value for thesrc
record componentdst
- the value for thedst
record componentdirection
- the value for thedirection
record componentweight
- the value for theweight
record 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 thesrc
record component.- Specified by:
src
in interfaceEdge<MazeGraph.MazeVertex>
- Returns:
- the value of the
src
record component
-
dst
Returns the value of thedst
record component.- Specified by:
dst
in interfaceEdge<MazeGraph.MazeVertex>
- Returns:
- the value of the
dst
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
weight
public double weight()Returns the value of theweight
record component.- Specified by:
weight
in interfaceEdge<MazeGraph.MazeVertex>
- Returns:
- the value of the
weight
record component
-