Internally it aggregates a control which the user will
manipulate in order to produce a range of scores. It also keeps an
acquaintance-reference to an Implementor (a renderer). The UpdateScoreValue()
function will call the render method on the Renderer and pass to it the score
which it should render at the same time.
Listing 1
' Equivalent to Abstraction in the Bridge pattern
Public MustInherit Class Evaluation
Protected m_RenderingDevice As Implementors.RatingRenderer
' Equivalent to Operation in the pattern
Public MustOverride Function UpdateScoreValue()
Public Property RatingRenderDevice() As
Implementors.RatingRenderer …
End Property
End Class
' Equivalent to Refined Abstraction in the Bridge pattern
Public Class VerbalEvaluation
Inherits Evaluation
Dim ChoiceList As ListBox
Dim ChoiceString As String
Dim EquivalentScore As Integer
Public Sub New(ByVal ControllerListBox As ListBox)
ChoiceList = ControllerListBox
End Sub
' Equivalent to Operation in the pattern
Public Overrides Function UpdateScoreValue()
ChoiceString = ChoiceList.SelectedItem
' Translate the specific selections in the list box to
'a standard language - the score
Select Case LCase(ChoiceString)
Case "poor"
EquivalentScore = 1
Case "fair"
EquivalentScore = 2
….
Case "excellent"
EquivalentScore = 5
End Select
' The payload statement – uses the acquaintance implementor
' to implement the score
m_RenderingDevice.RenderRating(EquivalentScore)
End Function
End Class