Record Class Edge
java.lang.Object
java.lang.Record
es.urjc.etsii.grafo.graphs.model.Edge
- All Implemented Interfaces:
Comparable<Edge>
-
Constructor Summary
ConstructorsConstructorDescriptionEdge(int from, int to, double weight) Creates an instance of aEdgerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.intfrom()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.intto()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.doubleweight()Returns the value of theweightrecord component.
-
Constructor Details
-
Edge
public Edge(int from, int to, double weight) Creates an instance of aEdgerecord class.- Parameters:
from- the value for thefromrecord componentto- the value for thetorecord componentweight- the value for theweightrecord component
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Edge>
-
toString
-
hashCode
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
from
public int from()Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
to
public int to()Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
weight
public double weight()Returns the value of theweightrecord component.- Returns:
- the value of the
weightrecord component
-