29 using System.Collections;
30 using System.Collections.Generic;
32 using OpenSim.Framework;
33 using OpenSim.Region.Framework.Scenes;
36 namespace OpenSim.
Region.OptionalModules.Scripting.Minimodule.
Object
41 Dictionary<UUID, IInventoryItem> m_publicInventory;
46 m_rootScene = rootScene;
47 m_privateInventory = taskInventory;
48 m_publicInventory =
new Dictionary<UUID, IInventoryItem>();
58 private void SynchronizeDictionaries()
61 if (!m_publicInventory.ContainsKey(privateItem.
ItemID))
65 #region IDictionary<UUID, IInventoryItem> implementation
68 m_publicInventory.Add(
key, value);
69 m_privateInventory.Add(
key, InventoryItem.FromInterface(value).ToTaskInventoryItem());
74 return m_privateInventory.ContainsKey(
key);
79 m_publicInventory.Remove(
key);
80 return m_privateInventory.Remove(
key);
88 if (!m_publicInventory.TryGetValue(key, out value))
93 result = m_privateInventory.TryGetValue(
key, out privateItem);
97 m_publicInventory.Add(
key, value);
105 public ICollection<UUID> Keys {
107 return m_privateInventory.Keys;
111 public ICollection<IInventoryItem> Values {
113 SynchronizeDictionaries();
114 return m_publicInventory.Values;
119 #region IEnumerable<KeyValuePair<UUID, IInventoryItem>> implementation
122 SynchronizeDictionaries();
123 return m_publicInventory.GetEnumerator();
128 #region IEnumerable implementation
129 IEnumerator IEnumerable.GetEnumerator ()
131 SynchronizeDictionaries();
132 return m_publicInventory.GetEnumerator();
137 #region ICollection<KeyValuePair<UUID, IInventoryItem>> implementation
138 public void Add (KeyValuePair<UUID, IInventoryItem> item)
140 Add(item.Key, item.Value);
145 m_publicInventory.Clear();
146 m_privateInventory.Clear();
149 public bool Contains (KeyValuePair<UUID, IInventoryItem> item)
151 return m_privateInventory.ContainsKey(item.Key);
154 public void CopyTo (KeyValuePair<UUID, IInventoryItem>[] array,
int arrayIndex)
156 throw new NotImplementedException();
159 public bool Remove (KeyValuePair<UUID, IInventoryItem> item)
161 return Remove(item.Key);
166 return m_privateInventory.Count;
170 public bool IsReadOnly {
177 #region Explicit implementations
182 if (TryGetValue(
key, out result))
185 throw new KeyNotFoundException(
"[MRM] The requrested item ID could not be found");
188 m_publicInventory[
key] = value;
189 m_privateInventory[
key] = InventoryItem.FromInterface(value).ToTaskInventoryItem();
193 void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<UUID, IInventoryItem>>.CopyTo(System.Collections.Generic.KeyValuePair<UUID,IInventoryItem>[] array,
int offset)
195 throw new NotImplementedException();
199 public IInventoryItem
this[
string name]
205 if (!m_publicInventory.ContainsKey(i.
ItemID))
208 return m_publicInventory[i.ItemID];
210 throw new KeyNotFoundException();
void Add(KeyValuePair< UUID, IInventoryItem > item)
bool TryGetValue(UUID key, out IInventoryItem value)
bool Remove(KeyValuePair< UUID, IInventoryItem > item)
IEnumerator< KeyValuePair< UUID, IInventoryItem > > GetEnumerator()
void CopyTo(KeyValuePair< UUID, IInventoryItem >[] array, int arrayIndex)
A dictionary containing task inventory items. Indexed by item UUID.
Represents an item in a task inventory
bool ContainsKey(UUID key)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
This implements the methods needed to operate on individual inventory items.
SOPObjectInventory(Scene rootScene, TaskInventoryDictionary taskInventory)
bool Contains(KeyValuePair< UUID, IInventoryItem > item)
This implements the methods neccesary to operate on the inventory of an object
void Add(UUID key, IInventoryItem value)