コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
 /// <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;
 }
コード例 #6
0
 /// <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;
 }
コード例 #7
0
		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);
			}
		}
コード例 #8
0
		/// <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;
		}
コード例 #9
0
		/// <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;
		}
コード例 #10
0
		/// <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;
		}
コード例 #11
0
		/// <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;
		}