コード例 #1
0
        public int CompareTo(InvestmentQuery other)
        {
            var priorityCompare = Priority.CompareTo(other.Priority);

            if (priorityCompare != 0)
            {
                return(priorityCompare);
            }

            return(QueryTime.CompareTo(other.QueryTime));
        }
コード例 #2
0
 public int CompareTo(Element other)
 {
     if (Priority.CompareTo(other.Priority) == 0)
     {
         return(Description.CompareTo(other.Description));
     }
     else
     {
         return(Priority.CompareTo(other.Priority));
     }
 }
コード例 #3
0
        public int CompareTo(PacketHandlerContainer other)
        {
            var res = Priority.CompareTo(other.Priority);

            if (res == 0)
            {
                res = Id.CompareTo(other.Id);
            }

            return(res);
        }
コード例 #4
0
 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);
 }
コード例 #5
0
            public int CompareTo(QueuePriority other)
            {
                int compare = 0;

                compare = Priority.CompareTo(other.Priority);
                if (compare == 0)
                {
                    compare = Sequence.CompareTo(other.Sequence);
                }

                return(compare);
            }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: SingleThreadScheduler.cs プロジェクト: norvegec/rd
 public int CompareTo(PrioritizedAction other)
 {
     if (ReferenceEquals(this, other))
     {
         return(0);
     }
     if (ReferenceEquals(null, other))
     {
         return(1);
     }
     return(-Priority.CompareTo(other.Priority));
 }
コード例 #8
0
 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);
 }
コード例 #9
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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: TypeSerializer.cs プロジェクト: tony48/ksp-kipc
        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);
        }
コード例 #12
0
ファイル: IncidentItem.cs プロジェクト: wrk-fmd/CoCeMoCl
        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));
        }
コード例 #13
0
ファイル: UserTag.cs プロジェクト: rebootus/Esthar
        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));
        }
コード例 #14
0
        /// <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();
            }
        }
コード例 #15
0
 /// <summary>
 /// 比较优先级。
 /// </summary>
 /// <param name="other">给定的 <see cref="ISortable"/>。</param>
 /// <returns>返回整数。</returns>
 public virtual int CompareTo(ISortable other)
 => Priority.CompareTo((float)other?.Priority);
コード例 #16
0
 /// <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));
 }
コード例 #18
0
 public void CompareTo_should_return_positive_when_left_value_is_greater_than_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().BePositive();
 }
コード例 #19
0
 /// <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));
 }
コード例 #20
0
 public void CompareTo_should_return_negative_when_left_value_is_less_than_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().BeNegative();
 }
コード例 #21
0
 public int CompareTo(int other)
 {
     return(Priority.CompareTo(other));
 }
コード例 #22
0
ファイル: PriorityQueue.cs プロジェクト: takytank/KyoProLib
 public int CompareTo(PriorityPair <TPriority, TItem> target)
 => Priority.CompareTo(target.Priority);
コード例 #23
0
ファイル: Rule.cs プロジェクト: alyons/AI-Shell--C--
 public int CompareByPriority(Rule other)
 {
     return(Priority.CompareTo(other.Priority));
 }
コード例 #24
0
 public void CompareTo_should_return_zero_when_left_value_is_equal_to_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().Be(0);
 }
コード例 #25
0
 public void CompareTo_should_return_negative_when_left_value_is_less_than_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().BeNegative();
 }
コード例 #26
0
 public void CompareTo_should_return_zero_when_left_value_is_equal_to_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().Be(0);
 }
コード例 #27
0
 int IComparable <IRuleMethod> .CompareTo(IRuleMethod other)
 {
     return(Priority.CompareTo(other.Priority));
 }
コード例 #28
0
 public void CompareTo_should_return_positive_when_left_value_is_greater_than_right(Priority left, Priority right)
 {
     left.CompareTo(right).Should().BePositive();
 }
コード例 #29
0
 public int CompareTo(PrioritizedLimitedTask other)
 {
     return(Priority.CompareTo(other.Priority));
 }
コード例 #30
0
 int IComparable.CompareTo(object obj)
 {
     return(Priority.CompareTo(((IRuleMethod)obj).Priority));
 }
コード例 #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int CompareTo(IFightObstacle obj)
 {
     return(Priority.CompareTo(obj.Priority));
 }
コード例 #32
0
 /// <inheritdoc/>
 public int CompareTo(IPlugin <IConfig> other) => - Priority.CompareTo(other.Priority);
コード例 #33
0
 public int CompareTo(ISystem other)
 {
     return(Priority.CompareTo(other.Priority));
 }