comparebytime.vb

来自「vb开发的车间调度程序」· VB 代码 · 共 31 行

VB
31
字号
Public Class CompareByTime             '实现一个比较接口,按照工序的相对剩余时间从大到小给所有工序进行排序
    Implements IComparer

    Public Function Compare(ByVal o1 As Object, ByVal o2 As Object) As Integer Implements System.Collections.IComparer.Compare
        If (o1 Is Nothing) And (o2 Is Nothing) Then Return 0

        If (o1 Is Nothing) Then Return 1
        If (o2 Is Nothing) Then Return -1

        Dim p1 As CProcess = CType(o1, CProcess)
        Dim p2 As CProcess = CType(o2, CProcess)

        If p1.timeRelation < p2.timeRelation Then
            Return 1

        ElseIf p1.timeRelation = p2.timeRelation Then
            Return 0
        Else
            Return -1
        End If
    End Function






End Class


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?