aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/OSUUID.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-29 14:04:55 +0000
committerAdam Frisby2008-04-29 14:04:55 +0000
commit375163a6fece8b3a57c7555246abe8338223a599 (patch)
tree163001ca96a4b4d08589e9772f78510677d5d0dc /OpenSim/Framework/OSUUID.cs
parentPatch from Melanie: 0001087: Crash to bash de-linking objects. Thanks Melanie! (diff)
downloadopensim-SC-375163a6fece8b3a57c7555246abe8338223a599.zip
opensim-SC-375163a6fece8b3a57c7555246abe8338223a599.tar.gz
opensim-SC-375163a6fece8b3a57c7555246abe8338223a599.tar.bz2
opensim-SC-375163a6fece8b3a57c7555246abe8338223a599.tar.xz
* Spring cleaning.
* Added new generic "Location" class to handle 2D integer locations. Going to use it to replace all RegionHandle and X,Y coordinate references throughout the entire project. You have been warned.
Diffstat (limited to 'OpenSim/Framework/OSUUID.cs')
-rw-r--r--OpenSim/Framework/OSUUID.cs44
1 files changed, 25 insertions, 19 deletions
diff --git a/OpenSim/Framework/OSUUID.cs b/OpenSim/Framework/OSUUID.cs
index 90de347..cb83ff2 100644
--- a/OpenSim/Framework/OSUUID.cs
+++ b/OpenSim/Framework/OSUUID.cs
@@ -31,13 +31,17 @@ using libsecondlife;
31namespace OpenSim.Framework 31namespace OpenSim.Framework
32{ 32{
33 [Serializable] 33 [Serializable]
34 public class OSUUID: IComparable 34 public class OSUUID : IComparable
35 { 35 {
36 public static readonly OSUUID Zero = new OSUUID();
36 public Guid UUID; 37 public Guid UUID;
37 38
38 public OSUUID() {} 39 public OSUUID()
40 {
41 }
39 42
40 /* Constructors */ 43 /* Constructors */
44
41 public OSUUID(string s) 45 public OSUUID(string s)
42 { 46 {
43 if (s == null) 47 if (s == null)
@@ -61,6 +65,21 @@ namespace OpenSim.Framework
61 UUID = new Guid(0, 0, 0, BitConverter.GetBytes(u)); 65 UUID = new Guid(0, 0, 0, BitConverter.GetBytes(u));
62 } 66 }
63 67
68 #region IComparable Members
69
70 public int CompareTo(object obj)
71 {
72 if (obj is OSUUID)
73 {
74 OSUUID ID = (OSUUID) obj;
75 return UUID.CompareTo(ID.UUID);
76 }
77
78 throw new ArgumentException("object is not a OSUUID");
79 }
80
81 #endregion
82
64 // out conversion 83 // out conversion
65 public override string ToString() 84 public override string ToString()
66 { 85 {
@@ -81,20 +100,9 @@ namespace OpenSim.Framework
81 public override bool Equals(object o) 100 public override bool Equals(object o)
82 { 101 {
83 if (!(o is LLUUID)) return false; 102 if (!(o is LLUUID)) return false;
84
85 OSUUID uuid = (OSUUID)o;
86 return UUID == uuid.UUID;
87 }
88
89 public int CompareTo(object obj)
90 {
91 if (obj is OSUUID)
92 {
93 OSUUID ID = (OSUUID)obj;
94 return this.UUID.CompareTo(ID.UUID);
95 }
96 103
97 throw new ArgumentException("object is not a OSUUID"); 104 OSUUID uuid = (OSUUID) o;
105 return UUID == uuid.UUID;
98 } 106 }
99 107
100 // Static methods 108 // Static methods
@@ -102,7 +110,5 @@ namespace OpenSim.Framework
102 { 110 {
103 return new OSUUID(Guid.NewGuid()); 111 return new OSUUID(Guid.NewGuid());
104 } 112 }
105
106 public static readonly OSUUID Zero = new OSUUID();
107 } 113 }
108} 114} \ No newline at end of file