Ejemplo n.º 1
0
        public bool Matches(MetaList <T> other)
        {
            if (this.Count != other.Count)
            {
                return(false);
            }
            bool found = false;

            for (int i = 0; i < this.Count; i++)
            {
                found = false;
                for (int j = 0; j < other.Count; j++)
                {
                    if (this[i].Equals(other[j]))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool Equals(MetaDictionary <K, V> other)
        {
            if (other == null)
            {
                return(false);
            }
            if (this.Count != other.Count)
            {
                return(false);
            }
            MetaList <K> thisKeys  = this.GetKeys();
            MetaList <K> otherKeys = other.GetKeys();

            if (!thisKeys.Matches(otherKeys))
            {
                return(false);
            }
            otherKeys = thisKeys.Align(otherKeys);
            for (int i = 0; i < this.Count; i++)
            {
                if (!this[thisKeys[i]].Equals(other[otherKeys[i]]))
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
        public MetaList <V> GetValues(MetaList <K> keys)
        {
            MetaList <V> result = new MetaList <V>();

            foreach (K key in keys)
            {
                result.Add(this[key]);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public MetaList <T> Align(MetaList <T> other)
        {
            MetaList <T> alignedList = new MetaList <T>();

            for (int i = 0; i < this.Count; i++)
            {
                for (int j = 0; j < other.Count; j++)
                {
                    if (this[i].Equals(other[j]))
                    {
                        alignedList.Add(other[j]);
                        break;
                    }
                }
            }
            return(alignedList);
        }
Ejemplo n.º 5
0
 public bool Equals(MetaList <T> other)
 {
     if (other == null)
     {
         return(false);
     }
     if (this.Count != other.Count)
     {
         return(false);
     }
     for (int i = 0; i < this.Count; i++)
     {
         if (!this[i].Equals(other[i]))
         {
             return(false);
         }
     }
     return(true);
 }