Package nl.colorize.multimedialib.math
Record Class Line
java.lang.Object
java.lang.Record
nl.colorize.multimedialib.math.Line
- All Implemented Interfaces:
Shape
Describes a straight line between two points within a two-dimensional space.
Line
instances can only be used to describe simple, straight lines.
Use SegmentedLine
to describe more complex line shapes.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this shape contains the specified point.end()
Returns the value of theend
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the smallest possible rectangular bounding box that can fit this shape.final int
hashCode()
Returns a hash code value for this object.reposition
(Point2D offset) Returns a newShape
instance that is repositioned by the specified X and Y offset.start()
Returns the value of thestart
record component.toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nl.colorize.multimedialib.math.Shape
reposition
-
Constructor Details
-
Line
public Line(float startX, float startY, float endX, float endY) -
Line
Creates an instance of aLine
record class.- Parameters:
start
- the value for thestart
record componentend
- the value for theend
record component
-
-
Method Details
-
contains
Description copied from interface:Shape
Returns whether this shape contains the specified point. -
getBoundingBox
Description copied from interface:Shape
Returns the smallest possible rectangular bounding box that can fit this shape.- Specified by:
getBoundingBox
in interfaceShape
-
reposition
Description copied from interface:Shape
Returns a newShape
instance that is repositioned by the specified X and Y offset.- Specified by:
reposition
in interfaceShape
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
start
Returns the value of thestart
record component.- Returns:
- the value of the
start
record component
-
end
Returns the value of theend
record component.- Returns:
- the value of the
end
record component
-