Skip to content
Snippets Groups Projects
Commit 8d5cb5f0 authored by Thomas Oster's avatar Thomas Oster
Browse files

Missing equals and hashCode

parent 20facb37
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
package com.t_oster.liblasercut.drivers;
import com.t_oster.liblasercut.LaserProperty;
import com.t_oster.liblasercut.platform.Util;
/**
*
......@@ -147,4 +148,43 @@ public class IModelaProperty implements LaserProperty
return null;
}
@Override
public int hashCode()
{
int hash = 13;
for (String k : this.getPropertyKeys())
{
if (this.getProperty(k) != null)
{
hash = 97 * hash + k.hashCode() + this.getProperty(k).hashCode();
}
}
hash += super.hashCode();
return hash;
}
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
IModelaProperty other = (IModelaProperty) obj;
for (String k : this.getPropertyKeys())
{
if (Util.differ(this.getProperty(k), other.getProperty(k)))
{
return false;
}
}
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment