Skip to content

Commit

Permalink
changed hashcode
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Aug 24, 2023
1 parent a12ff15 commit 5a7f1ef
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ SOFTWARE.
<xsl:value-of select="eo:class-name(@name, eo:suffix(@line, @pos))"/>
<xsl:text> extends PhDefault {</xsl:text>
<xsl:value-of select="eo:eol(0)"/>
<xsl:variable name="type" select="concat(//meta[head='package']/tail, '.', @name)"/>
<xsl:if test="$literal-objects[text()=$type]">
<xsl:value-of select="eo:tabs(1)"/>
<xs:text>private final AtomicBoolean initialized;</xs:text>
</xsl:if>
<xsl:apply-templates select="." mode="ctors"/>
<xsl:apply-templates select="." mode="equals-and-hashCode"/>
<xsl:if test="//meta[head='junit' or head='tests'] and not(@parent)">
Expand Down Expand Up @@ -200,7 +205,7 @@ SOFTWARE.
<xsl:variable name="type" select="concat(//meta[head='package']/tail, '.', @name)"/>
<xsl:if test="$literal-objects[text()=$type]">
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>this.add("Δ", new AtFree());</xsl:text>
<xsl:text>this.add("Δ", new AtFree(new AtSimple(), this.initialized));</xsl:text>
</xsl:if>
<xsl:if test="$type='org.eolang.tuple'">
<xsl:value-of select="eo:eol(2)"/>
Expand All @@ -224,6 +229,12 @@ SOFTWARE.
<xsl:value-of select="eo:eol(1)"/>
<xsl:text>public int hashCode() {</xsl:text>
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>if (this.initialized.get()) {</xsl:text>
<xsl:value-of select="eo:eol(3)"/>
<xsl:text>return this.attr("Δ").get().hashCode();</xsl:text>
<xsl:value-of select="eo:eol(2)"/>
<xsl:text>} else {</xsl:text>
<xsl:value-of select="eo:eol(3)"/>
<xsl:text>return this.attr("Δ").get().hashCode();</xsl:text>
<xsl:value-of select="eo:eol(1)"/>
<xsl:text>}</xsl:text>
Expand Down

0 comments on commit 5a7f1ef

Please sign in to comment.