aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine/XMRInstQueue.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstQueue.cs (renamed from OpenSim/Region/ScriptEngine/XMREngine/XMRInstQueue.cs)82
1 files changed, 44 insertions, 38 deletions
diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMRInstQueue.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstQueue.cs
index 41acac8..549fab5 100644
--- a/OpenSim/Region/ScriptEngine/XMREngine/XMRInstQueue.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstQueue.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim.Region.ScriptEngine.XMREngine 30namespace OpenSim.Region.ScriptEngine.Yengine
31{ 31{
32 /** 32 /**
33 * @brief Implements a queue of XMRInstance's. 33 * @brief Implements a queue of XMRInstance's.
@@ -47,15 +47,15 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
47 */ 47 */
48 public void InsertHead(XMRInstance inst) 48 public void InsertHead(XMRInstance inst)
49 { 49 {
50 if ((inst.m_PrevInst != inst) || (inst.m_NextInst != inst)) { 50 if((inst.m_PrevInst != inst) || (inst.m_NextInst != inst))
51 throw new Exception("already in list"); 51 throw new Exception("already in list");
52 } 52
53 inst.m_PrevInst = null; 53 inst.m_PrevInst = null;
54 if ((inst.m_NextInst = m_Head) == null) { 54 if((inst.m_NextInst = m_Head) == null)
55 m_Tail = inst; 55 m_Tail = inst;
56 } else { 56 else
57 m_Head.m_PrevInst = inst; 57 m_Head.m_PrevInst = inst;
58 } 58
59 m_Head = inst; 59 m_Head = inst;
60 } 60 }
61 61
@@ -65,15 +65,15 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
65 */ 65 */
66 public void InsertTail(XMRInstance inst) 66 public void InsertTail(XMRInstance inst)
67 { 67 {
68 if ((inst.m_PrevInst != inst) || (inst.m_NextInst != inst)) { 68 if((inst.m_PrevInst != inst) || (inst.m_NextInst != inst))
69 throw new Exception("already in list"); 69 throw new Exception("already in list");
70 } 70
71 inst.m_NextInst = null; 71 inst.m_NextInst = null;
72 if ((inst.m_PrevInst = m_Tail) == null) { 72 if((inst.m_PrevInst = m_Tail) == null)
73 m_Head = inst; 73 m_Head = inst;
74 } else { 74 else
75 m_Tail.m_NextInst = inst; 75 m_Tail.m_NextInst = inst;
76 } 76
77 m_Tail = inst; 77 m_Tail = inst;
78 } 78 }
79 79
@@ -84,19 +84,19 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
84 */ 84 */
85 public void InsertBefore(XMRInstance inst, XMRInstance after) 85 public void InsertBefore(XMRInstance inst, XMRInstance after)
86 { 86 {
87 if ((inst.m_PrevInst != inst) || (inst.m_NextInst != inst)) { 87 if((inst.m_PrevInst != inst) || (inst.m_NextInst != inst))
88 throw new Exception("already in list"); 88 throw new Exception("already in list");
89 } 89
90 if (after == null) { 90 if(after == null)
91 InsertTail(inst); 91 InsertTail(inst);
92 } else { 92 else
93 {
93 inst.m_NextInst = after; 94 inst.m_NextInst = after;
94 inst.m_PrevInst = after.m_PrevInst; 95 inst.m_PrevInst = after.m_PrevInst;
95 if (inst.m_PrevInst == null) { 96 if(inst.m_PrevInst == null)
96 m_Head = inst; 97 m_Head = inst;
97 } else { 98 else
98 inst.m_PrevInst.m_NextInst = inst; 99 inst.m_PrevInst.m_NextInst = inst;
99 }
100 after.m_PrevInst = inst; 100 after.m_PrevInst = inst;
101 } 101 }
102 } 102 }
@@ -119,12 +119,13 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
119 public XMRInstance RemoveHead() 119 public XMRInstance RemoveHead()
120 { 120 {
121 XMRInstance inst = m_Head; 121 XMRInstance inst = m_Head;
122 if (inst != null) { 122 if(inst != null)
123 if ((m_Head = inst.m_NextInst) == null) { 123 {
124 if((m_Head = inst.m_NextInst) == null)
124 m_Tail = null; 125 m_Tail = null;
125 } else { 126 else
126 m_Head.m_PrevInst = null; 127 m_Head.m_PrevInst = null;
127 } 128
128 inst.m_NextInst = inst; 129 inst.m_NextInst = inst;
129 inst.m_PrevInst = inst; 130 inst.m_PrevInst = inst;
130 } 131 }
@@ -139,12 +140,13 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
139 public XMRInstance RemoveTail() 140 public XMRInstance RemoveTail()
140 { 141 {
141 XMRInstance inst = m_Tail; 142 XMRInstance inst = m_Tail;
142 if (inst != null) { 143 if(inst != null)
143 if ((m_Tail = inst.m_PrevInst) == null) { 144 {
145 if((m_Tail = inst.m_PrevInst) == null)
144 m_Head = null; 146 m_Head = null;
145 } else { 147 else
146 m_Tail.m_NextInst = null; 148 m_Tail.m_NextInst = null;
147 } 149
148 inst.m_NextInst = inst; 150 inst.m_NextInst = inst;
149 inst.m_PrevInst = inst; 151 inst.m_PrevInst = inst;
150 } 152 }
@@ -160,25 +162,29 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
160 { 162 {
161 XMRInstance next = inst.m_NextInst; 163 XMRInstance next = inst.m_NextInst;
162 XMRInstance prev = inst.m_PrevInst; 164 XMRInstance prev = inst.m_PrevInst;
163 if ((prev == inst) || (next == inst)) { 165 if((prev == inst) || (next == inst))
164 throw new Exception("not in a list"); 166 throw new Exception("not in a list");
165 } 167
166 if (next == null) { 168 if(next == null)
167 if (m_Tail != inst) { 169 {
170 if(m_Tail != inst)
168 throw new Exception("not in this list"); 171 throw new Exception("not in this list");
169 } 172
170 m_Tail = prev; 173 m_Tail = prev;
171 } else {
172 next.m_PrevInst = prev;
173 } 174 }
174 if (prev == null) { 175 else
175 if (m_Head != inst) { 176 next.m_PrevInst = prev;
177
178 if(prev == null)
179 {
180 if(m_Head != inst)
176 throw new Exception("not in this list"); 181 throw new Exception("not in this list");
177 } 182
178 m_Head = next; 183 m_Head = next;
179 } else {
180 prev.m_NextInst = next;
181 } 184 }
185 else
186 prev.m_NextInst = next;
187
182 inst.m_NextInst = inst; 188 inst.m_NextInst = inst;
183 inst.m_PrevInst = inst; 189 inst.m_PrevInst = inst;
184 } 190 }