arrayIterator

POO ou Classe personnel

arrayIterator

Messagepar oguruma » 30 Jan 2005 à 12:44

Public Class ArrayIterator
' Iterator for a LotusScript array / Variant

a As Variant
ix As Long

Public Sub new(a As Variant)
If Not Isarray(a) Then Error ErrTypeMismatch, "No array"
Me.a = a
ix = 0
End Sub

Private Function size() As Integer
size = Ubound(a) - Lbound(a) + 1
End Function

Public Function hasNext() As Variant
hasNext = ix =< size()
End Function

Public Function next() As Variant
If Not hasNext() _
Then Error ErrIllegalOperation, "No more elements"
If Isobject(a(ix)) Then Set Me.next = a(ix) Else Me.next = a(ix)
ix = ix + 1
End Function

Public Sub remove()
Error ErrIllegalOperation, "Operation not supported"
End Sub
End Class
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Retour vers Programmation orienté objet