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 booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleCalculate and return the magnitude of this vector.intCalculate and return the taxicab magnitude of this vector.final StringtoString()Returns a string representation of this record class.x()Returns the value of thexrecord component.y()Returns the value of theyrecord component.
-
Field Details
-
x
-
y
-
-
Constructor Details
-
Int2
-
-
Method Details
-
_createNew
Description copied from interface:Vec2This is an internal method. override in Vec2 subclasses, but DO NOT CALL YOURSELF.- Specified by:
_createNewin 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
-