VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "DB_Components"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private data_ As Excel.Worksheet

Public Function Init(target As Excel.Worksheet)
  Set data_ = target
End Function

Public Function IBegin() As IteratorComponent
  Set IBegin = New IteratorComponent
  Call IBegin.Init(data_)
End Function

Public Function ILast() As IteratorComponent
  Set ILast = New IteratorComponent
  Call ILast.Init(data_)
  Call ILast.GoLast
End Function

Public Function INew() As IteratorComponent
  Set INew = New IteratorComponent
  Call INew.Init(data_)
  Call INew.GoLast
  Call INew.Increment
End Function

Public Function Contains(sProduct$, sComponent$) As Boolean
  Contains = Not Access(sProduct, sComponent) Is Nothing
End Function

Public Function Access(sProduct$, sComponent$) As IteratorComponent
  Dim iComp As New IteratorComponent: Call iComp.Init(data_)
  Do While Not iComp.IsDone
    If iComp.Product = sProduct Then
      If iComp.ItemName = sComponent Then
        Set Access = iComp
        Exit Function
      End If
    End If
    Call iComp.Increment
  Loop
End Function
