'**************************************************
' 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(Of TContext As Class)
Inherits ObjectModel.Collection(Of BBCodeNode(Of TContext))
Private __Owner As BBCodeNode(Of TContext)
''' 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(Of TContext))
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(Of TContext)
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(Of TContext))
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(Of TContext)))
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(Of TContext))
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(Of TContext)))
For Each node In collection
node.SetParent(Me.Owner)
Next
MyBase.Insert(index, collection)
End Sub
End Class