diff options
author | Justin Clarke Casey | 2008-05-03 22:39:33 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-03 22:39:33 +0000 |
commit | 688940e8103f2b1f55bb48ebe2566d32f872b8f5 (patch) | |
tree | 979a633643581349471e3f91bf11bfa545191549 /OpenSim/Framework/Communications/Cache | |
parent | * Cleaned up code in Terrain, Tree and Map modules. (diff) | |
download | opensim-SC_OLD-688940e8103f2b1f55bb48ebe2566d32f872b8f5.zip opensim-SC_OLD-688940e8103f2b1f55bb48ebe2566d32f872b8f5.tar.gz opensim-SC_OLD-688940e8103f2b1f55bb48ebe2566d32f872b8f5.tar.bz2 opensim-SC_OLD-688940e8103f2b1f55bb48ebe2566d32f872b8f5.tar.xz |
* Refactor: Renaming item and folder tree search methods to have Find*() prefixes
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
3 files changed, 21 insertions, 22 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index ceca1a4..6a7b6b7 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -35,7 +35,8 @@ using log4net; | |||
35 | 35 | ||
36 | namespace OpenSim.Framework.Communications.Cache | 36 | namespace OpenSim.Framework.Communications.Cache |
37 | { | 37 | { |
38 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); | 38 | //internal delegate void DeleteItemDelegate( |
39 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); | ||
39 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); | 40 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); |
40 | internal delegate void PurgeFolderDelegate(LLUUID folderID); | 41 | internal delegate void PurgeFolderDelegate(LLUUID folderID); |
41 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); | 42 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); |
@@ -234,7 +235,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
234 | } | 235 | } |
235 | else | 236 | else |
236 | { | 237 | { |
237 | InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID); | 238 | InventoryFolderImpl folder = RootFolder.FindFolder(folderInfo.ParentID); |
238 | lock (folder.SubFolders) | 239 | lock (folder.SubFolders) |
239 | { | 240 | { |
240 | if (folder != null) | 241 | if (folder != null) |
@@ -275,7 +276,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
275 | { | 276 | { |
276 | if (!RootFolder.Items.ContainsKey(itemInfo.ID)) | 277 | if (!RootFolder.Items.ContainsKey(itemInfo.ID)) |
277 | { | 278 | { |
278 | |||
279 | RootFolder.Items.Add(itemInfo.ID, itemInfo); | 279 | RootFolder.Items.Add(itemInfo.ID, itemInfo); |
280 | } | 280 | } |
281 | else | 281 | else |
@@ -286,7 +286,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
286 | } | 286 | } |
287 | else | 287 | else |
288 | { | 288 | { |
289 | InventoryFolderImpl folder = RootFolder.GetDescendentFolder(itemInfo.Folder); | 289 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); |
290 | if (folder != null) | 290 | if (folder != null) |
291 | { | 291 | { |
292 | lock (folder.Items) | 292 | lock (folder.Items) |
@@ -346,7 +346,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | InventoryFolderImpl folder = RootFolder.GetDescendentFolder(parentID); | 349 | InventoryFolderImpl folder = RootFolder.FindFolder(parentID); |
350 | 350 | ||
351 | if (folder != null) | 351 | if (folder != null) |
352 | { | 352 | { |
@@ -479,7 +479,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
479 | 479 | ||
480 | if (HasInventory) | 480 | if (HasInventory) |
481 | { | 481 | { |
482 | InventoryFolderImpl purgedFolder = RootFolder.GetDescendentFolder(folderID); | 482 | InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID); |
483 | 483 | ||
484 | if (purgedFolder != null) | 484 | if (purgedFolder != null) |
485 | { | 485 | { |
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index f6accf6..39296eb 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs | |||
@@ -104,14 +104,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /// <summary> | 106 | /// <summary> |
107 | /// Does this folder or any of its subfolders contain the given item? | 107 | /// Returns the item if it exists in this folder or any of this folder's subfolders? |
108 | /// </summary> | 108 | /// </summary> |
109 | /// <param name="itemID"></param> | 109 | /// <param name="itemID"></param> |
110 | /// <returns></returns> | 110 | /// <returns>null if the item is not found</returns> |
111 | public InventoryItemBase HasItem(LLUUID itemID) | 111 | public InventoryItemBase FindItem(LLUUID itemID) |
112 | { | 112 | { |
113 | InventoryItemBase base2 = null; | ||
114 | |||
115 | lock (Items) | 113 | lock (Items) |
116 | { | 114 | { |
117 | if (Items.ContainsKey(itemID)) | 115 | if (Items.ContainsKey(itemID)) |
@@ -124,15 +122,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
124 | { | 122 | { |
125 | foreach (InventoryFolderImpl folder in SubFolders.Values) | 123 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
126 | { | 124 | { |
127 | base2 = folder.HasItem(itemID); | 125 | InventoryItemBase item = folder.FindItem(itemID); |
128 | if (base2 != null) | 126 | |
127 | if (item != null) | ||
129 | { | 128 | { |
130 | break; | 129 | return item; |
131 | } | 130 | } |
132 | } | 131 | } |
133 | } | 132 | } |
134 | 133 | ||
135 | return base2; | 134 | return null; |
136 | } | 135 | } |
137 | 136 | ||
138 | /// <summary> | 137 | /// <summary> |
@@ -171,7 +170,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
171 | /// Returns the folder requested if it exists as a descendent of this folder | 170 | /// Returns the folder requested if it exists as a descendent of this folder |
172 | /// </summary> | 171 | /// </summary> |
173 | /// <returns>The requested folder if it exists, null if it does not.</returns> | 172 | /// <returns>The requested folder if it exists, null if it does not.</returns> |
174 | public InventoryFolderImpl GetDescendentFolder(LLUUID folderID) | 173 | public InventoryFolderImpl FindFolder(LLUUID folderID) |
175 | { | 174 | { |
176 | InventoryFolderImpl returnFolder = null; | 175 | InventoryFolderImpl returnFolder = null; |
177 | 176 | ||
@@ -185,7 +184,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
185 | { | 184 | { |
186 | foreach (InventoryFolderImpl folder in SubFolders.Values) | 185 | foreach (InventoryFolderImpl folder in SubFolders.Values) |
187 | { | 186 | { |
188 | returnFolder = folder.GetDescendentFolder(folderID); | 187 | returnFolder = folder.FindFolder(folderID); |
189 | if (returnFolder != null) | 188 | if (returnFolder != null) |
190 | { | 189 | { |
191 | break; | 190 | break; |
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 0404477..92b08e5 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | 261 | ||
262 | if ((fold = libraryRoot.GetDescendentFolder(folderID)) != null) | 262 | if ((fold = libraryRoot.FindFolder(folderID)) != null) |
263 | { | 263 | { |
264 | remoteClient.SendInventoryFolderDetails( | 264 | remoteClient.SendInventoryFolderDetails( |
265 | libraryRoot.Owner, folderID, fold.RequestListOfItems(), | 265 | libraryRoot.Owner, folderID, fold.RequestListOfItems(), |
@@ -308,7 +308,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | if ((fold = userProfile.RootFolder.GetDescendentFolder(folderID)) != null) | 311 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) |
312 | { | 312 | { |
313 | // m_log.DebugFormat( | 313 | // m_log.DebugFormat( |
314 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", | 314 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", |
@@ -369,7 +369,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
369 | return libraryRoot.RequestListOfItems(); | 369 | return libraryRoot.RequestListOfItems(); |
370 | } | 370 | } |
371 | 371 | ||
372 | if ((fold = libraryRoot.GetDescendentFolder(folderID)) != null) | 372 | if ((fold = libraryRoot.FindFolder(folderID)) != null) |
373 | { | 373 | { |
374 | return fold.RequestListOfItems(); | 374 | return fold.RequestListOfItems(); |
375 | } | 375 | } |
@@ -410,7 +410,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
410 | } | 410 | } |
411 | else | 411 | else |
412 | { | 412 | { |
413 | if ((fold = userProfile.RootFolder.GetDescendentFolder(folderID)) != null) | 413 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) |
414 | { | 414 | { |
415 | return fold.RequestListOfItems(); | 415 | return fold.RequestListOfItems(); |
416 | } | 416 | } |
@@ -479,7 +479,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
479 | { | 479 | { |
480 | if (userProfile.HasInventory) | 480 | if (userProfile.HasInventory) |
481 | { | 481 | { |
482 | InventoryItemBase item = userProfile.RootFolder.HasItem(itemID); | 482 | InventoryItemBase item = userProfile.RootFolder.FindItem(itemID); |
483 | if (item != null) | 483 | if (item != null) |
484 | { | 484 | { |
485 | remoteClient.SendInventoryItemDetails(ownerID, item); | 485 | remoteClient.SendInventoryItemDetails(ownerID, item); |