From 29dfff223cfffe5567c0322bc729df9e240c218e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Re=CC=81my=20Bouquet?= Date: Sat, 14 May 2016 23:46:21 +0200 Subject: [PATCH] proper equal and hashcode for ShaderNodesVariables. --- .../java/com/jme3/shader/ShaderNodeVariable.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jme3-core/src/main/java/com/jme3/shader/ShaderNodeVariable.java b/jme3-core/src/main/java/com/jme3/shader/ShaderNodeVariable.java index 81dba4f52..5dd4a6d79 100644 --- a/jme3-core/src/main/java/com/jme3/shader/ShaderNodeVariable.java +++ b/jme3-core/src/main/java/com/jme3/shader/ShaderNodeVariable.java @@ -150,7 +150,12 @@ public class ShaderNodeVariable implements Savable, Cloneable { @Override public int hashCode() { - int hash = 5; + int hash = 7; + hash = 29 * hash + (name != null?name.hashCode():0); + hash = 29 * hash + (type != null?type.hashCode():0); + hash = 29 * hash + (nameSpace != null?nameSpace.hashCode():0); + hash = 29 * hash + (condition != null?condition.hashCode():0); + hash = 29 * hash + (multiplicity != null?multiplicity.hashCode():0); return hash; } @@ -172,6 +177,12 @@ public class ShaderNodeVariable implements Savable, Cloneable { if ((this.nameSpace == null) ? (other.nameSpace != null) : !this.nameSpace.equals(other.nameSpace)) { return false; } + if ((this.condition == null) ? (other.condition != null) : !this.condition.equals(other.condition)) { + return false; + } + if ((this.multiplicity == null) ? (other.multiplicity != null) : !this.multiplicity.equals(other.multiplicity)) { + return false; + } return true; }