public int CompareTo(Symbol other) { var result = Kind.CompareTo(other.Kind); if (result == 0) { result = Name.CompareTo(other.Name); } return(result); }
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { ImportThunk otherNode = (ImportThunk)other; int result = _thunkKind.CompareTo(otherNode._thunkKind); if (result != 0) { return(result); } result = comparer.Compare(_helperCell, otherNode._helperCell); if (result != 0) { return(result); } return(comparer.Compare(_instanceCell, otherNode._instanceCell)); }
/**@}*/ #endregion #region Order comparison /*! \name Order comparison */ /**@{*/ /// <summary> /// Generic IComparable implementation (default) for comparing AcLock objects to sort /// by [LockKind](@ref AcUtils#LockKind) (descending) then stream name. /// </summary> /// <param name="other">An AcLock object to compare with this instance.</param> /// <returns>Value indicating the relative order of the AcLock objects being compared.</returns> /*! \sa [OrderBy example](@ref AcUtils#AcLocks#AcLocks) */ public int CompareTo(AcLock other) { int result; if (AcLock.ReferenceEquals(this, other)) { result = 0; } else { result = (-1 * Kind.CompareTo(other.Kind)); // descending if (result == 0) { result = String.Compare(Name, other.Name); } } return(result); }
public int CompareTo(Style other) { if (other == null) { return(-1); } int result = Kind.CompareTo(other.Kind); if (result != 0) { return(result); } result = StringComparer.OrdinalIgnoreCase.Compare(_Name, other._Name); if (result != 0) { return(result); } return(StringComparer.OrdinalIgnoreCase.Compare(_Author, other._Author)); }
public int CompareTo([AllowNull] TreeNode other) { if (other == null) { return(1); } var result = Kind.CompareTo(other.Kind); if (result == 0) { result = Title.CompareTo(other.Title); if (result == 0) { result = Id.CompareTo(other.Id); } } return(result); }
public int CompareTo(ApiModel other) { if (other == default) { return(1); } if (Kind.IsType() && other.Kind.IsMember()) { return(-1); } if (Kind.IsMember() && other.Kind.IsType()) { return(1); } if (Kind.IsMember() && other.Kind.IsMember()) { var result = Kind.CompareTo(other.Kind); if (result != 0) { return(result); } } if (Kind == ApiKind.Namespace && other.Kind == ApiKind.Namespace) { var orderReversed = new[] { "Windows", "Microsoft", "System", }; var topLevel = GetTopLevelNamespace(Name); var otherTopLevel = GetTopLevelNamespace(other.Name); var topLevelIndex = Array.IndexOf(orderReversed, topLevel); var otherTopLevelIndex = Array.IndexOf(orderReversed, otherTopLevel); var result = -topLevelIndex.CompareTo(otherTopLevelIndex); if (result != 0) { return(result); } } if (GetMemberName(Name) == GetMemberName(other.Name)) { var typeParameterCount = GetTypeParameterCount(Name); var otherTypeParameterCount = GetTypeParameterCount(other.Name); var result = typeParameterCount.CompareTo(otherTypeParameterCount); if (result != 0) { return(result); } var parameterCount = GetParameterCount(Name); var otherParameterCount = GetParameterCount(other.Name); result = parameterCount.CompareTo(otherParameterCount); if (result != 0) { return(result); } } return(Name.CompareTo(other.Name));
/// <inheritdoc /> public int CompareTo(MemberName other) => ShortTypeName != other.ShortTypeName ? string.Compare(ShortTypeName, other.ShortTypeName, StringComparison.Ordinal) : Kind != other.Kind ? Kind.CompareTo(other.Kind) : string.Compare(LongName, other.LongName, StringComparison.Ordinal);