From 55091d3cd12f3d98aa50eb8c700406cb1aa6325f Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 21 Jul 2024 17:35:56 +0200 Subject: [PATCH] Override getString() method in vector types --- .../sosengine/base/types/vectors/Vec2.java | 13 +++++++++++++ .../sosengine/base/types/vectors/Vec2i.java | 13 +++++++++++++ .../sosengine/base/types/vectors/Vec3.java | 13 +++++++++++++ .../sosengine/base/types/vectors/Vec3i.java | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2.java b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2.java index aca4a5d..d8e3481 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2.java +++ b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2.java @@ -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 + ")"; + } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2i.java b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2i.java index 4f4eeb1..bf5816b 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2i.java +++ b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec2i.java @@ -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 + ")"; + } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3.java b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3.java index b332df4..882c32f 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3.java +++ b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3.java @@ -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 + ")"; + } } diff --git a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3i.java b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3i.java index 465f8b9..e0102e1 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3i.java +++ b/base/src/main/java/de/staropensource/sosengine/base/types/vectors/Vec3i.java @@ -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 + ")"; + } }