From faccbf4994801273af6359e3d83a5a15405d8273 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 29 Apr 2008 18:00:25 +0000 Subject: [PATCH] * Missed a file in previous commit. Sorry! --- OpenSim/Framework/Location.cs | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 OpenSim/Framework/Location.cs diff --git a/OpenSim/Framework/Location.cs b/OpenSim/Framework/Location.cs new file mode 100644 index 0000000000..24430c6712 --- /dev/null +++ b/OpenSim/Framework/Location.cs @@ -0,0 +1,65 @@ +using System; + +namespace OpenSim.Framework +{ + [Serializable] + public class Location : ICloneable + { + private readonly int m_x; + private readonly int m_y; + + public Location(int x, int y) + { + m_x = x; + m_y = y; + } + + public int X + { + get { return m_x; } + } + + public int Y + { + get { return m_y; } + } + + public override bool Equals(object obj) + { + if (ReferenceEquals(obj, this)) + return true; + + if (obj is Location) + { + return Equals((Location) obj); + } + + return base.Equals(obj); + } + + public bool Equals(Location loc) + { + return loc.X == X && loc.Y == Y; + } + + public bool Equals(int x, int y) + { + return X == x && y == Y; + } + + public UInt64 RegionHandle + { + get { return UInt64.MinValue; } + } + + public override int GetHashCode() + { + return X.GetHashCode() * 29 + Y.GetHashCode(); + } + + public object Clone() + { + return new Location(X, Y); + } + } +} \ No newline at end of file