Override getString() method in vector types

This commit is contained in:
JeremyStar™ 2024-07-21 17:35:56 +02:00
parent 09b244ef74
commit 55091d3cd1
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
4 changed files with 52 additions and 0 deletions

View file

@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
/**
* Represents a 2D float Vector.
@ -80,4 +81,16 @@ public class Vec2 {
this.x = x;
this.y = y;
}
/**
* Returns a string representation of this vector.
*
* @return string representation
* @since v1-alpha2
*/
@NotNull
@Override
public String toString() {
return getClass().getName() + "(x=" + x + " y=" + y + ")";
}
}

View file

@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
/**
* Represents a 2D integer Vector.
@ -80,4 +81,16 @@ public class Vec2i {
this.x = x;
this.y = y;
}
/**
* Returns a string representation of this vector.
*
* @return string representation
* @since v1-alpha2
*/
@NotNull
@Override
public String toString() {
return getClass().getName() + "(x=" + x + " y=" + y + ")";
}
}

View file

@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
/**
* Represents a 3D float Vector.
@ -101,4 +102,16 @@ public class Vec3 {
this.y = y;
this.z = z;
}
/**
* Returns a string representation of this vector.
*
* @return string representation
* @since v1-alpha2
*/
@NotNull
@Override
public String toString() {
return getClass().getName() + "(x=" + x + " y=" + y + " z=" + z + ")";
}
}

View file

@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.types.vectors;
import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
/**
* Represents a 3D integer Vector.
@ -101,4 +102,16 @@ public class Vec3i {
this.y = y;
this.z = z;
}
/**
* Returns a string representation of this vector.
*
* @return string representation
* @since v1-alpha2
*/
@NotNull
@Override
public String toString() {
return getClass().getName() + "(x=" + x + " y=" + y + " z=" + z + ")";
}
}