public int CompareTo(InvestmentQuery other) { var priorityCompare = Priority.CompareTo(other.Priority); if (priorityCompare != 0) { return(priorityCompare); } return(QueryTime.CompareTo(other.QueryTime)); }
public int CompareTo(Element other) { if (Priority.CompareTo(other.Priority) == 0) { return(Description.CompareTo(other.Description)); } else { return(Priority.CompareTo(other.Priority)); } }
public int CompareTo(PacketHandlerContainer other) { var res = Priority.CompareTo(other.Priority); if (res == 0) { res = Id.CompareTo(other.Id); } return(res); }
public int CompareTo(IPriorityQueueNode <K, T> other) { if (Priority.CompareTo(other.Priority) < 0) { return(-1); } else if (Priority.CompareTo(other.Priority) > 0) { return(1); } return(0); }
public int CompareTo(QueuePriority other) { int compare = 0; compare = Priority.CompareTo(other.Priority); if (compare == 0) { compare = Sequence.CompareTo(other.Sequence); } return(compare); }
public int CompareTo(object obj) { PQNode <T> other = obj as PQNode <T>; int compareValue = Priority.CompareTo(other.Priority); if (compareValue == 0) { // priority is the same, compare by their value compareValue = Value.CompareTo(other.Value); } return(compareValue); }
public int CompareTo(PrioritizedAction other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } return(-Priority.CompareTo(other.Priority)); }
public int CompareTo(State other) { // We want the highest first. // int, by default, chooses the lowest to be sorted // at the bottom of the list. We want the opposite. try { return(-Priority.CompareTo(other.Priority)); } catch (Exception e) { Logging.WriteError("State > CompareTo(State other): " + e); } return(0); }
public int CompareTo(HeapNode <TValue>?other) { if (other == null) { return(1); } var diff = Priority.CompareTo(other.Priority); if (diff == 0) { return(InsertOrder.CompareTo(other.InsertOrder)); } return(diff); }
public int CompareTo(GameEventPriority other) { // If other is not a valid object reference, this instance is greater. if (other == null) { return(1); } int priority = Priority.CompareTo(other.Priority); if (priority != 0) { return(priority); } int portPriority = PortPriority.CompareTo(other.PortPriority); if (portPriority != 0) { return(portPriority); } int typeId = TypeID.CompareTo(other.TypeID); if (typeId != 0) { return(typeId); } int id = ID.CompareTo(other.ID); if (id != 0) { return(id); } int index = ListIndex.CompareTo(other.ListIndex); if (index != 0) { return(index); } return(0); }
public int CompareTo(object obj) { var other = obj as TypeSerializer; if (other == null) { //Debug.LogWarning("[KIPCPlugin] TypeSerializer: Attempted comparison against NULL!"); throw new ArgumentNullException(); } //Debug.Log(String.Format("Our priority is: {0}. Other priority is {1}", Priority, other.Priority)) int result = Priority.CompareTo(other.Priority); if (result == 0) { return(Name.CompareTo(other.Name)); } return(result); }
public int CompareTo(IncidentItem other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var assignmentComparison = IsUnitAssignedToTask.CompareTo(other.IsUnitAssignedToTask); if (assignmentComparison != 0) { return(-assignmentComparison); } var blueComparison = Blue.CompareTo(other.Blue); if (blueComparison != 0) { return(-blueComparison); } var priorityComparison = Priority.CompareTo(other.Priority); if (priorityComparison != 0) { return(-priorityComparison); } var typeComparison = Nullable.Compare(Type, other.Type); if (typeComparison != 0) { return(typeComparison); } return(string.Compare(Info, other.Info, StringComparison.OrdinalIgnoreCase)); }
public int CompareTo(object obj) { UserTag other = obj as UserTag; if (ReferenceEquals(other, null)) { return(1); } if (ReferenceEquals(this, other)) { return(0); } int result = Priority.CompareTo(other.Priority); if (result != 0) { return(result); } return(String.Compare(Name, other.Name, StringComparison.Ordinal)); }
/// <summary> /// Schedules task based on a priority. If the task has a greater prirority than one of the currently running tasks, /// and if one of the currently running tasks allows cooperative context-switching, than context-switching will happen. /// </summary> /// <param name="task">Task to be scheduled (must extend <see cref="PrioritizedLimitedTask"/>), /// otherwise exception will be thrown</param> /// <exception cref="InvalidTaskException"></exception> protected override void QueueTask(Task task) { if (!(task is PrioritizedLimitedTask)) { throw new InvalidTaskException(); } pendingTasks.Enqueue(task as PrioritizedLimitedTask); Priority priority = (task as PrioritizedLimitedTask).Priority; PriorityComparer priorityComparer = new PriorityComparer(); PrioritizedLimitedTask taskToPause = executingTasks.Values .Where(x => x.CooperationMechanism.CanBePaused) .Min(); if (taskToPause != null && priority.CompareTo(taskToPause.Priority) > 0) { RequestContextSwitch(task as PrioritizedLimitedTask, taskToPause); } else { SortPendingTasks(); RunScheduling(); } }
/// <summary> /// 比较优先级。 /// </summary> /// <param name="other">给定的 <see cref="ISortable"/>。</param> /// <returns>返回整数。</returns> public virtual int CompareTo(ISortable other) => Priority.CompareTo((float)other?.Priority);
/// <summary> /// Compares the current object with another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns>A value that indicates the relative order of the objects being compared.</returns> public Int32 CompareTo(PriorityQueueItem other) { return(Priority.CompareTo(other.Priority)); }
public int CompareTo(PriorityQueueNode <TKey, TValue> other) { return(Priority.CompareTo(other.Priority)); }
public void CompareTo_should_return_positive_when_left_value_is_greater_than_right(Priority left, Priority right) { left.CompareTo(right).Should().BePositive(); }
/// <summary> /// Compare this player's priority to another player's. /// </summary> /// <param name="other">Another player.</param> /// <returns></returns> public int CompareTo(IPrioritable other) { return(Priority.CompareTo(other.Priority)); }
public void CompareTo_should_return_negative_when_left_value_is_less_than_right(Priority left, Priority right) { left.CompareTo(right).Should().BeNegative(); }
public int CompareTo(int other) { return(Priority.CompareTo(other)); }
public int CompareTo(PriorityPair <TPriority, TItem> target) => Priority.CompareTo(target.Priority);
public int CompareByPriority(Rule other) { return(Priority.CompareTo(other.Priority)); }
public void CompareTo_should_return_zero_when_left_value_is_equal_to_right(Priority left, Priority right) { left.CompareTo(right).Should().Be(0); }
public void CompareTo_should_return_negative_when_left_value_is_less_than_right(Priority left, Priority right) { left.CompareTo(right).Should().BeNegative(); }
public void CompareTo_should_return_zero_when_left_value_is_equal_to_right(Priority left, Priority right) { left.CompareTo(right).Should().Be(0); }
int IComparable <IRuleMethod> .CompareTo(IRuleMethod other) { return(Priority.CompareTo(other.Priority)); }
public void CompareTo_should_return_positive_when_left_value_is_greater_than_right(Priority left, Priority right) { left.CompareTo(right).Should().BePositive(); }
public int CompareTo(PrioritizedLimitedTask other) { return(Priority.CompareTo(other.Priority)); }
int IComparable.CompareTo(object obj) { return(Priority.CompareTo(((IRuleMethod)obj).Priority)); }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public int CompareTo(IFightObstacle obj) { return(Priority.CompareTo(obj.Priority)); }
/// <inheritdoc/> public int CompareTo(IPlugin <IConfig> other) => - Priority.CompareTo(other.Priority);
public int CompareTo(ISystem other) { return(Priority.CompareTo(other.Priority)); }