Example #1
0
File: List.cs Project: codehaus/boo
        override public bool Equals(object other)
        {
            if (other == this)
            {
                return(true);
            }

            List rhs = other as List;

            if (null == rhs)
            {
                return(false);
            }

            if (_count != rhs.Count)
            {
                return(false);
            }

            for (int i = 0; i < _count; ++i)
            {
                if (!RuntimeServices.EqualityOperator(_items[i], rhs[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #2
0
        public bool Equals(Hash other)
        {
            if (null == other)
            {
                return(false);
            }
            if (this == other)
            {
                return(true);
            }
            if (Count != other.Count)
            {
                return(false);
            }

            foreach (DictionaryEntry entry in other)
            {
                if (!ContainsKey(entry.Key))
                {
                    return(false);
                }
                if (!RuntimeServices.EqualityOperator(entry.Value, this[entry.Key]))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #3
0
        public bool Equals(List <T> other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (_count != other.Count)
            {
                return(false);
            }

            for (var i = 0; i < _count; ++i)
            {
                if (!RuntimeServices.EqualityOperator(_items[i], other[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #4
0
        public bool Equals(Hash other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(other, this))
            {
                return(true);
            }
            if (Count != other.Count)
            {
                return(false);
            }

            foreach (var entry in other)
            {
                if (!ContainsKey(entry.Key))
                {
                    return(false);
                }
                if (!RuntimeServices.EqualityOperator(entry.Value, this[entry.Key]))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #5
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }

            Hash other = (Hash)obj;

            if (Count != other.Count)
            {
                return(false);
            }

            foreach (DictionaryEntry entry in other)
            {
                if (!ContainsKey(entry.Key))
                {
                    return(false);
                }
                if (!RuntimeServices.EqualityOperator(entry.Value, this[entry.Key]))
                {
                    return(false);
                }
            }
            return(true);
        }
Example #6
0
File: List.cs Project: codehaus/boo
 public int IndexOf(object item)
 {
     for (int i = 0; i < _count; ++i)
     {
         if (RuntimeServices.EqualityOperator(_items[i], item))
         {
             return(i);
         }
     }
     return(-1);
 }
Example #7
0
        public bool Equals(List <T> other)
        {
            if (null == other)
            {
                return(false);
            }
            if (this == other)
            {
                return(true);
            }
            if (_count != other.Count)
            {
                return(false);
            }

            for (int i = 0; i < _count; ++i)
            {
                if (!RuntimeServices.EqualityOperator(_items[i], other[i]))
                {
                    return(false);
                }
            }
            return(true);
        }