VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "CDS_Edge"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' ========== Class Module for Graph edge ========
' Shared module version: 20210410
' Tested in: TestCommons
' Depends on: ex_VBA
' Required reference:
Option Explicit

Public source_ As Variant
Public dest_ As Variant

Public Function Init(vSource As Variant, vDestination As Variant)
  source_ = vSource
  dest_ = vDestination
End Function

Public Function Clone() As CDS_Edge
  Set Clone = New CDS_Edge
  Call Clone.Init(source_, dest_)
End Function

Public Function Reversed() As CDS_Edge
  Dim iEdge As New CDS_Edge
  Call iEdge.Init(dest_, source_)
  Set Reversed = iEdge
End Function

Public Property Get ID() As String
  ID = VBA.CStr(source_) & "-" & VBA.CStr(dest_)
End Property

Public Function Compare(rhs As Variant) As Double
  Compare = CompareDeep(source_, rhs.source_)
  If Compare = 0 Then _
    Compare = CompareDeep(dest_, rhs.dest_)
End Function

Public Function ToString(Optional nIndent& = 0) As String
  ToString = "$Edge " & ID
End Function
