Пример #1
0
 /// <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.");
     }
 }
Пример #2
0
 /// <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.");
     }
 }
Пример #3
0
 /// <inheritdoc/>
 public MemoryItem Get(MemoryProperty property)
 {
     return(GetGroupFor(property).Get(property));
 }
Пример #4
0
 /// <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)));
 }
Пример #5
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(LinkedGroups.SelectMany(g => g.GetKeys()).Contains(property));
 }
Пример #6
0
 /// <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)));
 }
Пример #7
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(GetKeys().Contains(property));
 }
Пример #8
0
 /// <inheritdoc/>
 public MemoryItem Get(MemoryProperty property)
 {
     return(Items.First(i => i.Property == property));
 }
Пример #9
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(Items.Any(i => i.Property == property));
 }
Пример #10
0
 /// <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;
 }