private List <Pair <AttributeValue, double> > Proportions(Func <AttributeValue[], AttributeValue> Discriminator) { List <Pair <AttributeValue, double> > P = new List <Pair <AttributeValue, double> >(); List <AttributeValue> V = new List <AttributeValue>(); AttributeValue[] Current = new AttributeValue[_Values.Length]; for (int i = 0; i < _Values[0].Count; ++i) { for (int j = 0; j < _Values.Length; ++j) { Current[j] = _Values[j][i]; } V.Add(Discriminator.Invoke(Current)); } V.Sort(delegate(AttributeValue V1, AttributeValue V2) { return(V1.CompareTo(V2)); }); AttributeValue C = null; foreach (AttributeValue v in V) { if (C == null || C.CompareTo(v) != 0) { C = v; P.Add(new Pair <AttributeValue, double>(v, 1d / V.Count)); } else { P[P.Count - 1].Second += 1d / V.Count; } } return(P); }
public List <AttributeValue> SortedValues(Func <AttributeValue[], AttributeValue> Discriminator) { List <AttributeValue> R = new List <AttributeValue>(); AttributeValue[] Current = new AttributeValue[_Values.Length]; for (int i = 0; i < _Values[0].Count; ++i) { for (int j = 0; j < _Values.Length; ++j) { Current[j] = _Values[j][i]; } R.Add(Discriminator.Invoke(Current)); } R.Sort(delegate(AttributeValue V1, AttributeValue V2) { return(V1.CompareTo(V2)); }); List <AttributeValue> N = new List <AttributeValue>(); foreach (AttributeValue V in R) { if (N.Count == 0 || V.CompareTo(N[N.Count - 1]) != 0) { N.Add(V); } } return(N); }
public int CompareTo(Edge other) { var c = V0.CompareTo(other.V0); if (c != 0) { return(c); } return(V1.CompareTo(other.V1)); }
public int CompareTo(Pair <T1, T2> other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } var r = V1.CompareTo(other.V1); if (r == 0) { r = V2.CompareTo(other.V2); } return(r); }
static void Main(string[] args) { string V1, V2, V3; Console.WriteLine("Entrez trois noms : "); V1 = Console.ReadLine(); V2 = Console.ReadLine(); V3 = Console.ReadLine(); if (V1.CompareTo(V2) == 0 && V2.CompareTo(V3) == 0) { Console.WriteLine("Ces noms sont classés"); } else { Console.WriteLine("Ces noms ne sont pas classés"); } Console.ReadKey(); }
public int CompareTo(FaceIndexTriplet other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var v1Comparison = V1.CompareTo(other.V1); if (v1Comparison != 0) { return(v1Comparison); } var v2Comparison = V2.CompareTo(other.V2); if (v2Comparison != 0) { return(v2Comparison); } return(V3.CompareTo(other.V3)); }