From 725d9b1ed8a95ae2326ba741786bfbb96099c522 Mon Sep 17 00:00:00 2001 From: Roman Korostinskiy <70313618+c71n93@users.noreply.github.com> Date: Mon, 15 Apr 2024 18:45:08 +0300 Subject: [PATCH] #2863 rollback to current master --- .../src/main/java/org/eolang/PhLocated.java | 19 +++++++++++++++-- .../src/main/java/org/eolang/PhLogged.java | 19 +++++++++++++++-- .../src/main/java/org/eolang/PhNamed.java | 21 ++++++++++++++++--- .../src/main/java/org/eolang/PhSafe.java | 20 ++++++++++++++++-- 4 files changed, 70 insertions(+), 9 deletions(-) diff --git a/eo-runtime/src/main/java/org/eolang/PhLocated.java b/eo-runtime/src/main/java/org/eolang/PhLocated.java index ac227f5e8e..33458ae922 100644 --- a/eo-runtime/src/main/java/org/eolang/PhLocated.java +++ b/eo-runtime/src/main/java/org/eolang/PhLocated.java @@ -30,7 +30,12 @@ * @since 0.21 */ @Versionized -public final class PhLocated extends PhDecorator { +public final class PhLocated implements Phi { + + /** + * The original. + */ + private final Phi origin; /** * The line number. @@ -68,12 +73,22 @@ public PhLocated(final Phi phi, final int lne, final int pos) { * @checkstyle ParameterNumberCheck (5 lines) */ public PhLocated(final Phi phi, final int lne, final int pos, final String loc) { - super(phi); + this.origin = phi; this.line = lne; this.position = pos; this.location = loc; } + @Override + public boolean equals(final Object obj) { + return this.origin.equals(obj); + } + + @Override + public int hashCode() { + return this.origin.hashCode(); + } + @Override public String toString() { return String.format( diff --git a/eo-runtime/src/main/java/org/eolang/PhLogged.java b/eo-runtime/src/main/java/org/eolang/PhLogged.java index 18cb0026e8..27356f0f29 100644 --- a/eo-runtime/src/main/java/org/eolang/PhLogged.java +++ b/eo-runtime/src/main/java/org/eolang/PhLogged.java @@ -34,14 +34,19 @@ * @since 0.24 */ @Versionized -public final class PhLogged extends PhDecorator { +public final class PhLogged implements Phi { + + /** + * The origin being turned into a const. + */ + private final Phi origin; /** * Ctor. * @param phi The origin */ public PhLogged(final Phi phi) { - super(phi); + this.origin = phi; } @Override @@ -91,6 +96,16 @@ public String forma() { return this.origin.forma(); } + @Override + public boolean equals(final Object obj) { + return this.origin.equals(obj); + } + + @Override + public int hashCode() { + return this.origin.hashCode(); + } + @Override public String toString() { return this.origin.toString(); diff --git a/eo-runtime/src/main/java/org/eolang/PhNamed.java b/eo-runtime/src/main/java/org/eolang/PhNamed.java index 3efb3bd0c3..e577a05c26 100644 --- a/eo-runtime/src/main/java/org/eolang/PhNamed.java +++ b/eo-runtime/src/main/java/org/eolang/PhNamed.java @@ -30,7 +30,12 @@ * @since 0.17 */ @Versionized -final class PhNamed extends PhDecorator { +final class PhNamed implements Phi { + + /** + * The original. + */ + private final Phi origin; /** * The name. @@ -44,10 +49,20 @@ final class PhNamed extends PhDecorator { * @param txt The name */ PhNamed(final Phi phi, final String txt) { - super(phi); + this.origin = phi; this.name = txt; } + @Override + public boolean equals(final Object obj) { + return this.origin.equals(obj); + } + + @Override + public int hashCode() { + return this.origin.hashCode(); + } + @Override public String toString() { return String.format("%s≡%s", this.name, this.origin.toString()); @@ -97,4 +112,4 @@ public void attach(final byte[] data) { public byte[] delta() { return this.origin.delta(); } -} +} \ No newline at end of file diff --git a/eo-runtime/src/main/java/org/eolang/PhSafe.java b/eo-runtime/src/main/java/org/eolang/PhSafe.java index c174e17197..3d3b716e5b 100644 --- a/eo-runtime/src/main/java/org/eolang/PhSafe.java +++ b/eo-runtime/src/main/java/org/eolang/PhSafe.java @@ -33,13 +33,29 @@ * @since 0.26 */ @Versionized -public final class PhSafe extends PhDecorator { +public final class PhSafe implements Phi { + + /** + * The original. + */ + private final Phi origin; + /** * Ctor. * @param phi The object */ public PhSafe(final Phi phi) { - super(phi); + this.origin = phi; + } + + @Override + public boolean equals(final Object obj) { + return this.origin.equals(obj); + } + + @Override + public int hashCode() { + return this.origin.hashCode(); } @Override