/// <summary> /// Removes the entry at the given index position. /// If the index is out-of-range of the current contents collection, an exception occurs. /// </summary> /// <param name="index">The index.</param> public virtual void RemoveEntry(int index) { IRDSObject entry = mcontents[index]; entry.rdsTable = null; mcontents.RemoveAt(index); }
/// <summary> /// Adds a new entry to the contents collection and allows directly assigning of a probability and drop flags for it. /// Use this signature if (for whatever reason) the base classes constructor does not support all /// constructors of RDSObject or if you implemented IRDSObject directly in your class and you need /// to (re)apply a new probability and flags at the moment you add it to a RDSTable. /// NOTE: The probability, unique, always and enabled flags given are written back to the given instance "entry". /// </summary> /// <param name="entry">The entry.</param> /// <param name="probability">The probability.</param> /// <param name="unique">if set to <c>true</c> this object can only occur once per result.</param> /// <param name="always">if set to <c>true</c> [always] this object will appear always in the result.</param> /// <param name="enabled">if set to <c>false</c> [enabled] this object will never be part of the result (even if it is set to always=true!).</param> public virtual void AddEntry(IRDSObject entry, double probability, bool unique, bool always, bool enabled) { mcontents.Add(entry); entry.rdsProbability = probability; entry.rdsUnique = unique; entry.rdsAlways = always; entry.rdsEnabled = enabled; entry.rdsTable = this; }
private void AddToResult(List <IRDSObject> rv, IRDSObject o) { if (!o.rdsUnique || !uniquedrops.Contains(o)) { if (o.rdsUnique) { uniquedrops.Add(o); } if (!(o is RDSNullValue)) { if (o is IRDSTable) { rv.AddRange(((IRDSTable)o).rdsResult); } else { // INSTANCECHECK // Check if the object to add implements IRDSObjectCreator. // If it does, call the CreateInstance() method and add its return value // to the result set. If it does not, add the object o directly. IRDSObject adder = o; if (o is IRDSObjectCreator) { adder = ((IRDSObjectCreator)o).rdsCreateInstance(); } rv.Add(adder); o.OnRDSHit(EventArgs.Empty); } } else { o.OnRDSHit(EventArgs.Empty); } } }
/// <summary> /// Removes the given entry from the contents. If it is not part of the contents, an exception occurs. /// </summary> /// <param name="entry">The entry.</param> public virtual void RemoveEntry(IRDSObject entry) { mcontents.Remove(entry); entry.rdsTable = null; }
/// <summary> /// Adds the given entry to contents collection. /// </summary> /// <param name="entry">The entry.</param> public virtual void AddEntry(IRDSObject entry) { mcontents.Add(entry); entry.rdsTable = this; }
/// <summary> /// Adds a new entry to the contents collection and allows directly assigning of a probability for it. /// Use this signature if (for whatever reason) the base classes constructor does not support all /// constructors of RDSObject or if you implemented IRDSObject directly in your class and you need /// to (re)apply a new probability at the moment you add it to a RDSTable. /// NOTE: The probability given is written back to the given instance "entry". /// </summary> /// <param name="entry">The entry.</param> /// <param name="probability">The probability.</param> public virtual void AddEntry(IRDSObject entry, double probability) { mcontents.Add(entry); entry.rdsProbability = probability; entry.rdsTable = this; }
private void AddToResult(List<IRDSObject> rv, IRDSObject o) { if (!o.rdsUnique || !uniquedrops.Contains(o)) { if (o.rdsUnique) uniquedrops.Add(o); if (!(o is RDSNullValue)) { if (o is IRDSTable) { rv.AddRange(((IRDSTable)o).rdsResult); } else { // INSTANCECHECK // Check if the object to add implements IRDSObjectCreator. // If it does, call the CreateInstance() method and add its return value // to the result set. If it does not, add the object o directly. IRDSObject adder = o; if (o is IRDSObjectCreator) adder = ((IRDSObjectCreator)o).rdsCreateInstance(); rv.Add(adder); o.OnRDSHit(EventArgs.Empty); } } else o.OnRDSHit(EventArgs.Empty); } }