From 4e66dddc95fe1ae2f4e9fdfee1ec15c82bfcddd6 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Sun, 27 Nov 2011 13:46:51 +0000 Subject: [PATCH] - remove unneeded instanceof and casting in Material git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8821 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/material/Material.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/engine/src/core/com/jme3/material/Material.java b/engine/src/core/com/jme3/material/Material.java index a018a31bb..8dc5015c6 100644 --- a/engine/src/core/com/jme3/material/Material.java +++ b/engine/src/core/com/jme3/material/Material.java @@ -202,6 +202,14 @@ public class Material implements Asset, Cloneable, Savable, Comparable return m.getSortId() - getSortId(); } + @Override + public boolean equals(Object obj) { + if(obj instanceof Material){ + return ((Material)obj).compareTo(this) == 0; + } + return super.equals(obj); + } + /** * Clones this material. The result is returned. */ @@ -331,10 +339,7 @@ public class Material implements Asset, Cloneable, Savable, Comparable */ public MatParam getParam(String name) { MatParam param = paramValues.get(name); - if (param instanceof MatParam) { - return (MatParam) param; - } - return null; + return param; } /**