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); }
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); }
public MetaList <V> GetValues(MetaList <K> keys) { MetaList <V> result = new MetaList <V>(); foreach (K key in keys) { result.Add(this[key]); } return(result); }
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); }
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); }