Exemple #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.");
     }
 }
Exemple #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.");
     }
 }
Exemple #3
0
 /// <inheritdoc/>
 public MemoryItem Get(MemoryProperty property)
 {
     return(GetGroupFor(property).Get(property));
 }
Exemple #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)));
 }
Exemple #5
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(LinkedGroups.SelectMany(g => g.GetKeys()).Contains(property));
 }
Exemple #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)));
 }
Exemple #7
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(GetKeys().Contains(property));
 }
Exemple #8
0
 /// <inheritdoc/>
 public MemoryItem Get(MemoryProperty property)
 {
     return(Items.First(i => i.Property == property));
 }
Exemple #9
0
 /// <inheritdoc/>
 public bool ContainsKey(MemoryProperty property)
 {
     return(Items.Any(i => i.Property == property));
 }
Exemple #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;
 }