Record Class Int2
java.lang.Object
java.lang.Record
com.end0katz.blobj.vec.Int2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_createNew
(Integer x, Integer y) This is an internal method. override in Vec2 subclasses, but DO NOT CALL YOURSELF.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
Calculate and return the magnitude of this vector.int
Calculate and return the taxicab magnitude of this vector.final String
toString()
Returns a string representation of this record class.x()
Returns the value of thex
record component.y()
Returns the value of they
record component.
-
Field Details
-
x
-
y
-
-
Constructor Details
-
Int2
-
-
Method Details
-
_createNew
Description copied from interface:Vec2
This is an internal method. override in Vec2 subclasses, but DO NOT CALL YOURSELF.- Specified by:
_createNew
in interfaceVec2<Integer,
Int2> - Parameters:
x
- the x component.y
- the y component.- Returns:
new <thisType>(x, y);
-
magnitude
public double magnitude()Calculate and return the magnitude of this vector.- Returns:
- the calculated magnitude.
-
taxicab_magnitude
public int taxicab_magnitude()Calculate and return the taxicab magnitude of this vector.- Returns:
- the calculated magnitude.
- See Also:
-
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 withObjects::equals(Object,Object)
. -
x
-
y
-