'**************************************************
' FILE : BBCodeNodeCollection.vb
' AUTHOR : Paulo Santos
' CREATION : 4/29/2009 11:31:52 AM
' COPYRIGHT : Copyright © 2009
' PJ on Development
' All Rights Reserved.
'
' Description:
' TODO: Add file description
'
' Change log:
' 0.1 4/29/2009 11:31:52 AM
' Paulo Santos
' Created.
'***************************************************
'''
''' Represents a collection of .
'''
Public Class BBCodeNodeCollection
Inherits ObjectModel.Collection(Of BBCodeNode)
Private __Owner As BBCodeNode
''' Initializes an instance of the class.
''' This is the default constructor for this class.
Friend Sub New()
End Sub
''' Initializes an instance of the class.
''' The collection owner.
''' The argument is .
Friend Sub New(ByVal owner As BBCodeNode)
If (owner Is Nothing) Then
Throw New ArgumentNullException("owner")
End If
__Owner = owner
End Sub
'''
''' Gets or sets the owner of the collection.
'''
Friend ReadOnly Property Owner() As BBCodeNode
Get
Return __Owner
End Get
End Property
''' Adds an object to the end of the .
''' The object to be added to the end of the .
''' The argument is .
Public Shadows Sub Add(ByVal node As BBCodeNode)
If (node Is Nothing) Then
Throw New ArgumentNullException("node")
End If
node.SetParent(Me.Owner)
MyBase.Add(node)
End Sub
''' Adds the elements of the specified collection to the end of the .
''' The collection whose elements should be added to the end of the .
''' The argument is .
Public Shadows Sub AddRange(ByVal collection As IEnumerable(Of BBCodeNode))
If (collection Is Nothing) Then
Throw New ArgumentNullException("collection")
End If
For Each n In collection
Me.Add(n)
Next
End Sub
'''
''' Inserts an element into the at the specified index.
'''
''' The zero-based index at which item should be inserted.
''' The object to insert.
Public Shadows Sub Insert(ByVal index As Integer, ByVal node As BBCodeNode)
node.SetParent(Me.Owner)
MyBase.Insert(index, node)
End Sub
'''
''' Inserts the elements of a collection into the at the specified index.
'''
''' The zero-based index at which item should be inserted.
''' The collection whose elements should be inserted into the .
Public Shadows Sub InsertRange(ByVal index As Integer, ByVal collection As IEnumerable(Of BBCodeNode))
For Each node In collection
node.SetParent(Me.Owner)
Next
MyBase.Insert(index, collection)
End Sub
End Class