public int Compare(EditLogInputStream elis1, EditLogInputStream elis2) { // we want local logs to be ordered earlier in the collection, and true // is considered larger than false, so we want to invert the booleans here return(ComparisonChain.Start().Compare(!elis1.IsLocalLog(), !elis2.IsLocalLog()). Result()); }
public int Compare(AclEntry entry1, AclEntry entry2) { return(ComparisonChain.Start().Compare(entry1.GetScope(), entry2.GetScope(), Ordering .Explicit(AclEntryScope.Access, AclEntryScope.Default)).Compare(entry1.GetType() , entry2.GetType(), Ordering.Explicit(AclEntryType.User, AclEntryType.Group, AclEntryType .Mask, AclEntryType.Other)).Compare(entry1.GetName(), entry2.GetName(), Ordering .Natural().NullsFirst()).Result()); }
// // Comparable interface // public virtual int CompareTo(Org.Apache.Hadoop.Hdfs.Server.Namenode.CheckpointSignature o) { return(ComparisonChain.Start().Compare(layoutVersion, o.layoutVersion).Compare(namespaceID , o.namespaceID).Compare(cTime, o.cTime).Compare(mostRecentCheckpointTxId, o.mostRecentCheckpointTxId ).Compare(curSegmentTxId, o.curSegmentTxId).Compare(clusterID, o.clusterID).Compare (blockpoolID, o.blockpoolID).Result()); }
public static ComparisonChain <T> Then <T>(this Comparison <T> comparison, Comparison <T> anotherComparison) { var t = new ComparisonChain <T>(); t.Add(comparison); t.Add(anotherComparison); return(t); }
public int compareKey(PointSensitivity other) { if (other is ZeroRateSensitivity) { ZeroRateSensitivity otherZero = (ZeroRateSensitivity)other; return(ComparisonChain.start().compare(curveCurrency, otherZero.curveCurrency).compare(currency, otherZero.currency).compare(yearFraction, otherZero.yearFraction).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is IborCapletFloorletSabrSensitivity) { IborCapletFloorletSabrSensitivity otherSwpt = (IborCapletFloorletSabrSensitivity)other; return(ComparisonChain.start().compare(volatilitiesName, otherSwpt.volatilitiesName).compare(currency, otherSwpt.currency).compare(expiry, otherSwpt.expiry).compare(sensitivityType, otherSwpt.sensitivityType).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is FxIndexSensitivity) { FxIndexSensitivity otherFx = (FxIndexSensitivity)other; return(ComparisonChain.start().compare(Index.ToString(), otherFx.Index.ToString()).compare(currency, otherFx.currency).compare(referenceCurrency, otherFx.referenceCurrency).compare(observation.FixingDate, otherFx.observation.FixingDate).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is FxForwardSensitivity) { FxForwardSensitivity otherFx = (FxForwardSensitivity)other; return(ComparisonChain.start().compare(currencyPair.ToString(), otherFx.currencyPair.ToString()).compare(currency, otherFx.currency).compare(referenceCurrency, otherFx.referenceCurrency).compare(referenceDate, otherFx.referenceDate).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is BondFutureOptionSensitivity) { BondFutureOptionSensitivity otherOption = (BondFutureOptionSensitivity)other; return(ComparisonChain.start().compare(volatilitiesName.ToString(), otherOption.volatilitiesName.ToString()).compare(expiry, otherOption.expiry).compare(futureExpiryDate, otherOption.futureExpiryDate).compare(strikePrice, otherOption.strikePrice).compare(futurePrice, otherOption.futurePrice).compare(currency, otherOption.currency).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is SwaptionSensitivity) { SwaptionSensitivity otherSwpt = (SwaptionSensitivity)other; return(ComparisonChain.start().compare(volatilitiesName, otherSwpt.volatilitiesName).compare(currency, otherSwpt.currency).compare(expiry, otherSwpt.expiry).compare(tenor, otherSwpt.tenor).compare(strike, otherSwpt.strike).compare(forward, otherSwpt.forward).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is CreditCurveZeroRateSensitivity) { CreditCurveZeroRateSensitivity otherZero = (CreditCurveZeroRateSensitivity)other; return(ComparisonChain.start().compare(zeroRateSensitivity.YearFraction, otherZero.zeroRateSensitivity.YearFraction).compare(zeroRateSensitivity.Currency, otherZero.zeroRateSensitivity.Currency).compare(zeroRateSensitivity.CurveCurrency, otherZero.zeroRateSensitivity.CurveCurrency).compare(legalEntityId, otherZero.legalEntityId).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is FxOptionSensitivity) { FxOptionSensitivity otherOption = (FxOptionSensitivity)other; return(ComparisonChain.start().compare(volatilitiesName, otherOption.volatilitiesName).compare(currencyPair.ToString(), otherOption.currencyPair.ToString()).compare(expiry, otherOption.expiry).compare(strike, otherOption.strike).compare(forward, otherOption.forward).compare(currency, otherOption.currency).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is OvernightRateSensitivity) { OvernightRateSensitivity otherOn = (OvernightRateSensitivity)other; return(ComparisonChain.start().compare(Index.ToString(), otherOn.Index.ToString()).compare(currency, otherOn.currency).compare(observation.FixingDate, otherOn.observation.FixingDate).compare(endDate, otherOn.endDate).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is InflationRateSensitivity) { InflationRateSensitivity otherInflation = (InflationRateSensitivity)other; return(ComparisonChain.start().compare(Index.ToString(), otherInflation.Index.ToString()).compare(currency, otherInflation.currency).compare(observation.FixingMonth, otherInflation.observation.FixingMonth).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public int compareKey(PointSensitivity other) { if (other is DummyPointSensitivity) { DummyPointSensitivity otherZero = (DummyPointSensitivity)other; return(ComparisonChain.start().compare(curveCurrency, otherZero.curveCurrency).compare(currency, otherZero.currency).compare(date, otherZero.date).result()); } return(this.GetType().Name.CompareTo(other.GetType().Name)); }
public virtual int Compare(KeyValuePair <AsyncLogger, QJournalProtocolProtos.PrepareRecoveryResponseProto > a, KeyValuePair <AsyncLogger, QJournalProtocolProtos.PrepareRecoveryResponseProto > b) { QJournalProtocolProtos.PrepareRecoveryResponseProto r1 = a.Value; QJournalProtocolProtos.PrepareRecoveryResponseProto r2 = b.Value; // A response that has data for a segment is always better than one // that doesn't. if (r1.HasSegmentState() != r2.HasSegmentState()) { return(Booleans.Compare(r1.HasSegmentState(), r2.HasSegmentState())); } if (!r1.HasSegmentState()) { // Neither has a segment, so neither can be used for recover. // Call them equal. return(0); } // They both have a segment. QJournalProtocolProtos.SegmentStateProto r1Seg = r1.GetSegmentState(); QJournalProtocolProtos.SegmentStateProto r2Seg = r2.GetSegmentState(); Preconditions.CheckArgument(r1Seg.GetStartTxId() == r2Seg.GetStartTxId(), "Should only be called with responses for corresponding segments: " + "%s and %s do not have the same start txid.", r1, r2); // If one is in-progress but the other is finalized, // the finalized one is greater. if (r1Seg.GetIsInProgress() != r2Seg.GetIsInProgress()) { return(Booleans.Compare(!r1Seg.GetIsInProgress(), !r2Seg.GetIsInProgress())); } if (!r1Seg.GetIsInProgress()) { // If both are finalized, they should match lengths if (r1Seg.GetEndTxId() != r2Seg.GetEndTxId()) { throw new Exception("finalized segs with different lengths: " + r1 + ", " + r2); } return(0); } // Both are in-progress. long r1SeenEpoch = Math.Max(r1.GetAcceptedInEpoch(), r1.GetLastWriterEpoch()); long r2SeenEpoch = Math.Max(r2.GetAcceptedInEpoch(), r2.GetLastWriterEpoch()); return(ComparisonChain.Start().Compare(r1SeenEpoch, r2SeenEpoch).Compare(r1.GetSegmentState ().GetEndTxId(), r2.GetSegmentState().GetEndTxId()).Result()); }
public virtual int CompareTo(Org.Apache.Hadoop.Hdfs.Server.Protocol.RemoteEditLog log) { return(ComparisonChain.Start().Compare(startTxId, log.startTxId).Compare(endTxId, log.endTxId).Result()); }
public int Compare(FileJournalManager.EditLogFile a, FileJournalManager.EditLogFile b) { return(ComparisonChain.Start().Compare(a.GetFirstTxId(), b.GetFirstTxId()).Compare (a.GetLastTxId(), b.GetLastTxId()).Result()); }
//------------------------------------------------------------------------- /// <summary> /// Compares this point to another. /// <para> /// The sort order is by date, then by double. /// This is compatible with equals. /// /// </para> /// </summary> /// <param name="other"> the other point </param> /// <returns> negative if this is less than, zero if equal, positive if greater than </returns> public int CompareTo(LocalDateDoublePoint other) { return(ComparisonChain.start().compare(date, other.date).compare(value, other.value).result()); }
public static ComparisonChain <T> Then <T>(this ComparisonChain <T> comparisonChain, Comparison <T> comparison) { comparisonChain.Add(comparison); return(comparisonChain); }
//------------------------------------------------------------------------- /// <summary> /// Compares this period to another by unadjusted start date, then unadjusted end date. /// </summary> /// <param name="other"> the other period </param> /// <returns> the comparison value </returns> public int CompareTo(SchedulePeriod other) { return(ComparisonChain.start().compare(unadjustedStartDate, other.unadjustedStartDate).compare(unadjustedEndDate, other.unadjustedEndDate).result()); }
//------------------------------------------------------------------------- /// <summary> /// Compares this money to another. /// <para> /// This compares currencies alphabetically, then by amount. /// /// </para> /// </summary> /// <param name="other"> the other amount </param> /// <returns> negative if less, zero if equal, positive if greater </returns> public virtual int CompareTo(Money other) { return(ComparisonChain.start().compare(currency, other.currency).compare(amount, other.amount).result()); }
//------------------------------------------------------------------------- /// <summary> /// Compares this cash flow to another, first by date, then value. /// </summary> /// <param name="other"> the other instance </param> /// <returns> the comparison </returns> public int CompareTo(CashFlow other) { return(ComparisonChain.start().compare(paymentDate, other.paymentDate).compare(presentValue, other.presentValue).compare(forecastValue, other.forecastValue).compare(discountFactor, other.discountFactor).result()); }
public virtual int CompareTo(Org.Apache.Hadoop.Metrics2.Util.Quantile other) { return(ComparisonChain.Start().Compare(quantile, other.quantile).Compare(error, other .error).Result()); }
// compare when classes differ, broken out for inlining private int compareSlow <T1>(MarketDataName <T1> other) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: return(ComparisonChain.start().compare(this.GetType().FullName, other.GetType().FullName).compare(Name, other.Name).result()); }
//------------------------------------------------------------------------- /// <summary> /// Compares this currency amount to another. /// <para> /// This compares currencies alphabetically, then by amount. /// /// </para> /// </summary> /// <param name="other"> the other amount </param> /// <returns> negative if less, zero if equal, positive if greater </returns> public int CompareTo(CurrencyAmount other) { return(ComparisonChain.start().compare(currency, other.currency).compare(amount, other.amount).result()); }
public int Compare(EditLogInputStream a, EditLogInputStream b) { return(ComparisonChain.Start().Compare(a.GetFirstTxId(), b.GetFirstTxId()).Compare (b.GetLastTxId(), a.GetLastTxId()).Result()); }
public int CompareTo(ElasticByteBufferPool.Key other) { return(ComparisonChain.Start().Compare(capacity, other.capacity).Compare(insertionTime , other.insertionTime).Result()); }
//------------------------------------------------------------------------- /// <summary> /// Compares the pair based on the first element followed by the second element. /// <para> /// The first element must be {@code Comparable}. /// /// </para> /// </summary> /// <param name="other"> the other pair </param> /// <returns> negative if this is less, zero if equal, positive if greater </returns> /// <exception cref="ClassCastException"> if the object is not comparable </exception> public int CompareTo(ObjIntPair <A> other) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: return com.google.common.collect.ComparisonChain.start().compare((Comparable<?>) first, (Comparable<?>) other.first).compare(second, other.second).result(); return(ComparisonChain.start().compare((IComparable <object>)first, (IComparable <object>)other.first).compare(second, other.second).result()); }
/// <summary> /// Compares the key of two sensitivity objects, excluding the parameter sensitivity values. /// </summary> /// <param name="other"> the other sensitivity object </param> /// <returns> positive if greater, zero if equal, negative if less </returns> public int compareKey(CrossGammaParameterSensitivity other) { return(ComparisonChain.start().compare(marketDataName, other.marketDataName).compare(order.ToString(), other.order.ToString()).compare(currency, other.currency).result()); }