Zet (Set) class in LotusScript

Public Class Zet As Vector
   'declarations
   Private pValues As Vector

   '/**
   ' * Constructor.
   ' */
   Public Sub New()
      Set Me.pValues = New Vector()
   End Sub

   '/**
   ' * Adds only unique elements.
   ' */
   Public Sub AddElement(d As Variant)
      'see if the vector contains this element already
      If Not Me.pValues.Contains(d.UniversalID) Then
         Call Vector..AddElement(d)
         Call Me.pValues.AddElement(d.UniversalID)
      End If
   End Sub

   Public Function Size() As Integer
      Size = Vector..Size()
   End Function

   Public Function Elements() As Enumeration
      Set Elements = Vector..Elements()
   End Function

End Class

Published by

lekkim

Positive, competent, out-spoken, frank and customer focused architect and developer with a strong foundation in web, cloud and product development. I'm a strong advocate for API first and cloud based solutions and development. I have a knack for being able to communicate and present technically complicated matters in conference, customer and training settings. I've previously acted as team member and leader in a product organisation.

2 thoughts on “Zet (Set) class in LotusScript”

  1. Isn’t your addElement method hardcoded for NotesDocuments, since you are using d.UniversalID? Isn’t it better to override the contains (actually the indexOf) method, so that you can test if any of the UNIDs already have been added?
    Thanks for the bug report btw 😀

  2. Yes – probably… I did the Zet to solve a concrete problem that had to do with looping a collection multiple times and needed to capture unique documents but the code should be made generic.

Comments are closed.