/// <inheritdoc/> public void Set(MemoryProperty property, DataObject value) { if (ContainsKey(property)) { GetGroupFor(property).Set(property, value); } else { throw new MemoryException($"Attempted to set the value of property {property.Key} which does not exist in this LinkedMemoryGroup."); } }
/// <inheritdoc/> public void Set(MemoryProperty property, DataObject value) { if (ContainsKey(property)) { Items.First(i => i.Property == property).Set(value); } else { throw new MemoryException($"Attempted to set the value of property {property.Key} which does not exist in this MemoryGroup."); } }
/// <inheritdoc/> public MemoryItem Get(MemoryProperty property) { return(GetGroupFor(property).Get(property)); }
/// <summary> /// Internal - gets the group in <see cref="LinkedGroups"/> that contains the specified key. /// </summary> /// <param name="property">The <see cref="MemoryProperty"/> identifying the memory item.</param> private IMemoryGroup GetGroupFor(MemoryProperty property) { return(LinkedGroups.First(g => g.ContainsKey(property))); }
/// <inheritdoc/> public bool ContainsKey(MemoryProperty property) { return(LinkedGroups.SelectMany(g => g.GetKeys()).Contains(property)); }
/// <summary> /// Internal - gets the group in <see cref="Layers"/> that contains the specified key. /// </summary> /// <param name="property">The <see cref="MemoryProperty"/> identifying the memory item.</param> private IMemoryGroup GetGroupFor(MemoryProperty property) { return(Layers.First(l => l.ContainsKey(property))); }
/// <inheritdoc/> public bool ContainsKey(MemoryProperty property) { return(GetKeys().Contains(property)); }
/// <inheritdoc/> public MemoryItem Get(MemoryProperty property) { return(Items.First(i => i.Property == property)); }
/// <inheritdoc/> public bool ContainsKey(MemoryProperty property) { return(Items.Any(i => i.Property == property)); }
/// <summary> /// Creates a new memory item with given property information. /// </summary> /// <param name="property">Specifies information regarding the key and type of the <see cref="MemoryItem"/>, as well as setting various <see cref="PropertyFlags"/>.</param> public MemoryItem(MemoryProperty property) { Property = property; }