public void TestCompareToMethodWithIntParam() { var firstWeight = new Weight(36); var secondWeight = 25; var thirdWeight = 77; var fourthWeight = 36; Assert.AreEqual(1, firstWeight.CompareTo(secondWeight), "CompareTo method (with integer param) of Weight class does not work properly"); Assert.AreEqual(-1, firstWeight.CompareTo(thirdWeight), "CompareTo method (with integer param) of Weight class does not work properly"); Assert.AreEqual(0, firstWeight.CompareTo(fourthWeight), "CompareTo method (with integer param) of Weight class does not work properly"); }
public void TestCompareToMethodWithWeightParam() { var firstWeight = new Weight(36); var secondWeight = new Weight(25); var thirdWeight = new Weight(77); var fourthWeight = new Weight(36); Assert.AreEqual(1, firstWeight.CompareTo(secondWeight), "CompareTo method (with Weight param) of Weight class does not work properly"); Assert.AreEqual(-1, firstWeight.CompareTo(thirdWeight), "CompareTo method (with Weight param) of Weight class does not work properly"); Assert.AreEqual(0, firstWeight.CompareTo(fourthWeight), "CompareTo method (with Weight param) of Weight class does not work properly"); }
public void CompareTo() { Weight d1 = new Weight(35, Weight.UnitType.Kg); Weight d2 = new Weight(3300, Weight.UnitType.G); Assert.AreEqual(d1.CompareTo(d2), 1); }
public int CompareTo(WeightedValue <TValue> other) { var valueComparer = Comparer <TValue> .Default; var result = valueComparer.Compare(Value, other.Value); return(result == 0 ? Weight.CompareTo(other.Weight) : result); }
public int CompareTo(Edge other) { if (Weight == other.Weight) { return(id.CompareTo(other.id)); } return(Weight.CompareTo(other.Weight)); }
public int CompareTo(HuffmanNode <T> other) { if (other is null) { return(1); } return(Weight.CompareTo(other.Weight)); }
public int CompareTo(Job other) { if (_invariant == other._invariant) { return(-Weight.CompareTo(other.Weight)); } if (_invariant > other._invariant) { return(-1); } return(1); }
public int CompareTo(Snippet <T> other) { if (other == null) { return(-1); } if (this.AnnotationMetadata != other.AnnotationMetadata) { return(0); } return(Weight.CompareTo(other.Weight)); }
public int CompareTo(Carriage other) { var result = string.Compare(Cargo, other.Cargo, StringComparison.Ordinal); if (result == 0) { result = Weight.CompareTo(other.Weight); if (result == 0) { result = Length.CompareTo(other.Length); } } return(result); }
public int CompareTo(IEdge <TVertex> other) { if (other == null) { return(-1); } bool areNodesEqual = Source.IsEqualTo <TVertex>(other.Source) && Destination.IsEqualTo <TVertex>(other.Destination); if (!areNodesEqual) { return(-1); } return(Weight.CompareTo(other.Weight)); }
public int CompareTo(object Obj) { int ReturnInt; Element el = Obj as Element; ReturnInt = Weight.CompareTo(el.Weight); if (ReturnInt == 0) { ReturnInt = Value.CompareTo(el.Value); } if (ReturnInt == 0) { ReturnInt = Value.CompareTo(el.Value); } return(ReturnInt); }
public int CompareTo(TermPart other) { if (other.Path == this.Path) { var weight = Weight.CompareTo(other.Weight); if (weight != 0) { return(weight); } // if same weight, compare by name return(this.Name.CompareTo(other.Name)); } return(FullPath.CompareTo(other.FullPath)); }
public virtual int CompareTo(object obj) { EbmlGeneric m = (EbmlGeneric)obj; int res = Weight.CompareTo(m.Weight); if (res != 0) { return(res); } if (Weight == -1) { return(InputOffset.CompareTo(m.InputOffset)); } res = Id.CompareTo(m.Id); if (res != 0) { return(res); } return(InputOffset.CompareTo(m.InputOffset)); }
public int CompareTo(Plane other) { if (other == null) { return(1); } if (MaxSpeed != other.MaxSpeed) { return(MaxSpeed.CompareTo(other.MaxSpeed)); } if (MaxCountBomb != other.MaxCountBomb) { return(MaxCountBomb.CompareTo(other.MaxCountBomb)); } if (Weight != other.Weight) { return(Weight.CompareTo(other.Weight)); } if (ColorBody != other.ColorBody) { ColorBody.Name.CompareTo(other.ColorBody.Name); } return(0); }
public int CompareTo(Shark other) { if (other == null) { return(1); } if (MaxNumberOfVictims != other.MaxNumberOfVictims) { return(MaxNumberOfVictims.CompareTo(other.MaxNumberOfVictims)); } if (HoursNeededToSleep != other.HoursNeededToSleep) { return(HoursNeededToSleep.CompareTo(other.HoursNeededToSleep)); } if (Weight != other.Weight) { return(Weight.CompareTo(other.Weight)); } if (BodyPattern != other.BodyPattern) { return(BodyPattern.Name.CompareTo(other.BodyPattern.Name)); } return(0); }
public int CompareTo(KruskalEdge other) { return(_isMin ? -1 * Weight.CompareTo(other.Weight) : Weight.CompareTo(other.Weight)); }
public virtual int CompareTo(Path _Other) { return(Weight.CompareTo(_Other.Weight)); }
public int CompareByWeight(Rule other) { return(Weight.CompareTo(other.Weight)); }
public int CompareTo(object obj) { return(Weight.CompareTo((obj as node).Weight)); }
public int CompareTo(Edge e) { return(Weight.CompareTo(e.Weight)); }
public Int32 CompareTo(T otherWeight) { return(WeightComparer == null?Weight.CompareTo(otherWeight) : WeightComparer.Compare(Weight, otherWeight)); }
public int CompareTo(BoardState other) { return(Weight.CompareTo(other.Weight)); }
public int CompareTo(Edge <T> other) { return(other == null ? 1 : Weight.CompareTo(other.Weight)); }
public int CompareTo(Edge <TE, TW> other) { return(Weight.CompareTo(other.Weight)); }
public int CompareTo(Item other) { return(Weight.CompareTo(other.Weight)); }
int IComparable <AuxNode <TKey, TItem> > .CompareTo(AuxNode <TKey, TItem> other) { return(Weight.CompareTo(other.Weight)); }
public int CompareTo(Coin other) { var weight = Weight.CompareTo(other.Weight); return(weight == 0 ? weight : Value.CompareTo(other.Value)); }