runelite-api: add equals/hashCode to Triangle/Vertex
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package net.runelite.api.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Triangle
|
||||
{
|
||||
private final Vertex a;
|
||||
@@ -43,6 +45,43 @@ public class Triangle
|
||||
return "Triangle{" + "a=" + a + ", b=" + b + ", c=" + c + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 13 * hash + Objects.hashCode(this.a);
|
||||
hash = 13 * hash + Objects.hashCode(this.b);
|
||||
hash = 13 * hash + Objects.hashCode(this.c);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Triangle other = (Triangle) obj;
|
||||
if (!Objects.equals(this.a, other.a))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.b, other.b))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.c, other.c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vertex getA()
|
||||
{
|
||||
return a;
|
||||
|
||||
@@ -43,6 +43,43 @@ public class Vertex
|
||||
return "Vertex{" + "x=" + x + ", y=" + y + ", z=" + z + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 67 * hash + this.x;
|
||||
hash = 67 * hash + this.y;
|
||||
hash = 67 * hash + this.z;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Vertex other = (Vertex) obj;
|
||||
if (this.x != other.x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.y != other.y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.z != other.z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
|
||||
Reference in New Issue
Block a user