public int CompareTo(VBufferEqSort <T> other) { var enum1 = SparseValues().GetEnumerator(); var enum2 = other.SparseValues().GetEnumerator(); int r; while (true) { if (!enum2.MoveNext()) { return(enum1.MoveNext() ? -1 : 0); } if (!enum1.MoveNext()) { return(1); } if (enum1.Current.Key == enum2.Current.Key) { r = enum1.Current.Value.CompareTo(enum2.Current.Value); if (r != 0) { return(r); } } else { return(enum1.Current.Key > enum2.Current.Key ? -1 : 1); } } }
public bool Equals(VBufferEqSort <T> other) { if (Length != other.Length) { return(false); } if (Count != other.Count) { return(false); } int vi, vj; for (int i = 0; i < Count; ++i) { if (!Values[i].Equals(other.Values[i])) { return(false); } vi = data.Indices == null ? i : data.Indices[i]; vj = other.data.Indices == null ? i : other.data.Indices[i]; if (vi != vj) { return(false); } } return(true); }
public static void Copy(ref VBufferEqSort <T> src, ref VBufferEqSort <T> dst) { src.data.CopyTo(ref dst.data); }
public static void Copy(T[] src, int srcIndex, ref VBufferEqSort <T> dst, int length) { VBuffer <T> .Copy(src, srcIndex, ref dst.data, length); }