/// <summary>
        /// Returns
        /// </summary>
        /// <param name="u"></param>
        /// <param name="v"></param>
        /// <returns></returns>
        public double this[IVertex u, IVertex v]
        {
            get
            {
                if (u == null)
                {
                    throw new ArgumentNullException("u");
                }
                if (v == null)
                {
                    throw new ArgumentNullException("v");
                }

                VertexPair vp = new VertexPair(u, v);
                return(this[vp]);
            }
            set
            {
                if (u == null)
                {
                    throw new ArgumentNullException("u");
                }
                if (v == null)
                {
                    throw new ArgumentNullException("v");
                }

                VertexPair vp = new VertexPair(u, v);
                this[vp] = value;
            }
        }
 /// <summary>
 /// Gets or sets the double associated with the given VertexPair
 /// </summary>
 /// <param name="key">
 /// The VertexPair whose value to get or set.
 /// </param>
 public double this[VertexPair key]
 {
     get
     {
         if (this.Dictionary.Contains(key))
             return (double) this.Dictionary[key];
         else
             return double.MaxValue;
     }
     set
     {
         this.Dictionary[key] = value;
     }
 }
 /// <summary>
 /// Gets or sets the double associated with the given VertexPair
 /// </summary>
 /// <param name="key">
 /// The VertexPair whose value to get or set.
 /// </param>
 public double this[VertexPair key]
 {
     get
     {
         if (this.Dictionary.Contains(key))
         {
             return((double)this.Dictionary[key]);
         }
         else
         {
             return(double.MaxValue);
         }
     }
     set
     {
         this.Dictionary[key] = value;
     }
 }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            if (!(obj is VertexPair))
            {
                throw new ArgumentException("obj is not of type VertexPair");
            }

            VertexPair vp = (VertexPair)obj;

            // comparing first and second
            int c = First.CompareTo(vp.First);

            if (c != 0)
            {
                return(c);
            }
            else
            {
                return(Second.CompareTo(vp.Second));
            }
        }
        /// <summary>
        /// Returns
        /// </summary>
        /// <param name="u"></param>
        /// <param name="v"></param>
        /// <returns></returns>
        public double this[IVertex u, IVertex v]
        {
            get
            {
                if (u==null)
                    throw new ArgumentNullException("u");
                if (v==null)
                    throw new ArgumentNullException("v");

                VertexPair vp = new VertexPair(u,v);
                return this[vp];
            }
            set
            {
                if (u==null)
                    throw new ArgumentNullException("u");
                if (v==null)
                    throw new ArgumentNullException("v");

                VertexPair vp = new VertexPair(u,v);
                this[vp]=value;
            }
        }
 /// <summary>
 /// Removes the element with the specified key from this VertexPairDoubleDictionary.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key of the element to remove.
 /// </param>
 public void Remove(VertexPair key)
 {
     this.Dictionary.Remove(key);
 }
 /// <summary>
 /// Determines whether this VertexPairDoubleDictionary contains a specific key.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key to locate in this VertexPairDoubleDictionary.
 /// </param>
 /// <returns>
 /// true if this VertexPairDoubleDictionary contains an element with the specified key;
 /// otherwise, false.
 /// </returns>
 public bool ContainsKey(VertexPair key)
 {
     return this.Dictionary.Contains(key);
 }
 /// <summary>
 /// Adds an element with the specified key and value to this VertexPairDoubleDictionary.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key of the element to add.
 /// </param>
 /// <param name="value">
 /// The double value of the element to add.
 /// </param>
 public void Add(VertexPair key, double value)
 {
     this.Dictionary.Add(key, value);
 }
 /// <summary>
 /// Removes the element with the specified key from this VertexPairDoubleDictionary.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key of the element to remove.
 /// </param>
 public void Remove(VertexPair key)
 {
     this.Dictionary.Remove(key);
 }
 /// <summary>
 /// Determines whether this VertexPairDoubleDictionary contains a specific key.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key to locate in this VertexPairDoubleDictionary.
 /// </param>
 /// <returns>
 /// true if this VertexPairDoubleDictionary contains an element with the specified key;
 /// otherwise, false.
 /// </returns>
 public bool ContainsKey(VertexPair key)
 {
     return(this.Dictionary.Contains(key));
 }
 /// <summary>
 /// Adds an element with the specified key and value to this VertexPairDoubleDictionary.
 /// </summary>
 /// <param name="key">
 /// The VertexPair key of the element to add.
 /// </param>
 /// <param name="value">
 /// The double value of the element to add.
 /// </param>
 public void Add(VertexPair key, double value)
 {
     this.Dictionary.Add(key, value);
 }