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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this shape contains the specified point.end()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the smallest possible rectangular bounding box that can fit this shape.final inthashCode()Returns a hash code value for this object.reposition(Point2D offset) Returns a newShapeinstance that is repositioned by the specified offset.start()Returns the value of thestartrecord component.toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 aLinerecord class.- Parameters:
start- the value for thestartrecord componentend- the value for theendrecord component
-
-
Method Details
-
contains
Description copied from interface:ShapeReturns whether this shape contains the specified point. -
getBoundingBox
Description copied from interface:ShapeReturns the smallest possible rectangular bounding box that can fit this shape.- Specified by:
getBoundingBoxin interfaceShape
-
getCenter
-
reposition
Description copied from interface:ShapeReturns a newShapeinstance that is repositioned by the specified offset.- Specified by:
repositionin 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 thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-