- remove unneeded instanceof and casting in Material

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8821 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 212b57ecc6
commit 4e66dddc95
  1. 13
      engine/src/core/com/jme3/material/Material.java

@ -202,6 +202,14 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
return m.getSortId() - getSortId(); 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. * Clones this material. The result is returned.
*/ */
@ -331,10 +339,7 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
*/ */
public MatParam getParam(String name) { public MatParam getParam(String name) {
MatParam param = paramValues.get(name); MatParam param = paramValues.get(name);
if (param instanceof MatParam) { return param;
return (MatParam) param;
}
return null;
} }
/** /**

Loading…
Cancel
Save