<commit_before>﻿<ControlType("dropdown")> _
Public Class DropDownControl
    Implements IElementEditorControl

    Private m_oldValue As String
    Private m_controller As EditorController
    Private m_attribute As String
    Private m_attributeName As String
    Private m_data As IEditorData
    Private m_dictionary As IDictionary(Of String, String)
    Private m_dictionaryValuesToKeys As Dictionary(Of String, String)

    Public Event Dirty(sender As Object, args As DataModifiedEventArgs) Implements IElementEditorControl.Dirty
    Public Event RequestParentElementEditorSave() Implements IElementEditorControl.RequestParentElementEditorSave

    Public ReadOnly Property Control() As System.Windows.Forms.Control Implements IElementEditorControl.Control
        Get
            Return Me
        End Get
    End Property

    Public Property Value() As Object Implements IElementEditorControl.Value
        Get
            Return GetValue()
        End Get
        Set(value As Object)
            SetValue(value)
        End Set
    End Property

    Protected Overridable Function GetValue() As Object
        If m_dictionary Is Nothing Then
            Return lstDropdown.Text
        Else
            If lstDropdown.Text.Length = 0 Then Return Nothing
            Return m_dictionaryValuesToKeys(lstDropdown.Text)
        End If
    End Function

    Protected Overridable Sub SetValue(value As Object)
        Dim stringValue As String = TryCast(value, String)

        If stringValue Is Nothing Then
            stringValue = String.Empty
        End If

        If m_dictionary Is Nothing Then
            lstDropdown.Text = stringValue
        Else
            If stringValue = String.Empty Then
                lstDropdown.Text = String.Empty
            Else
                lstDropdown.Text = m_dictionary(stringValue)
            End If
        End If

        m_oldValue = stringValue
    End Sub

    Public ReadOnly Property IsDirty() As Boolean
        Get
            Dim stringValue As String = TryCast(Value, String)
            If stringValue Is Nothing Then Return False
            Return stringValue <> m_oldValue
        End Get
    End Property

    Public Property Controller() As EditorController Implements IElementEditorControl.Controller
        Get
            Return m_controller
        End Get
        Set(value As EditorController)
            m_controller = value<commit_msg>Fix function "return type" dropdown when function doesn't return a value<commit_after>﻿<ControlType("dropdown")> _
Public Class DropDownControl
    Implements IElementEditorControl

    Private m_oldValue As String
    Private m_controller As EditorController
    Private m_attribute As String
    Private m_attributeName As String
    Private m_data As IEditorData
    Private m_dictionary As IDictionary(Of String, String)
    Private m_dictionaryValuesToKeys As Dictionary(Of String, String)

    Public Event Dirty(sender As Object, args As DataModifiedEventArgs) Implements IElementEditorControl.Dirty
    Public Event RequestParentElementEditorSave() Implements IElementEditorControl.RequestParentElementEditorSave

    Public ReadOnly Property Control() As System.Windows.Forms.Control Implements IElementEditorControl.Control
        Get
            Return Me
        End Get
    End Property

    Public Property Value() As Object Implements IElementEditorControl.Value
        Get
            Return GetValue()
        End Get
        Set(value As Object)
            SetValue(value)
        End Set
    End Property

    Protected Overridable Function GetValue() As Object
        If m_dictionary Is Nothing Then
            Return lstDropdown.Text
        Else
            If lstDropdown.Text.Length = 0 Then Return Nothing
            Return m_dictionaryValuesToKeys(lstDropdown.Text)
        End If
    End Function

    Protected Overridable Sub SetValue(value As Object)
        Dim stringValue As String = TryCast(value, String)

        If stringValue Is Nothing Then
            stringValue = String.Empty
        End If

        If m_dictionary Is Nothing Then
            lstDropdown.Text = stringValue
        Else
            If stringValue = String.Empty Then
                If m_dictionary.ContainsKey(String.Empty) Then
                    lstDropdown.Text = m_dictionary(stringValue)
                Else
                    lstDropdown.Text = String.Empty
                End If
            Else
                lstDropdown.Text = m_dictionary(stringValue)
            End If
        End If

        m_oldValue = stringValue
    End Sub

    Public ReadOnly Property IsDirty() As Boolean
        Get
            Dim stringValue As String = TryCast(Value, String)
            If stringValue Is Nothing Then Return False
            Return stringValue <> m_oldValue
        End Get
    End Property

    Public Property Controller() As EditorController Implements IElementEditorControl.Controller
        Get
            Return m_controller
        End Get
        Set(value As EditorController)
            m_controller = value
{'fraction_non_alphanumeric': 0.03408866995073891, 'fraction_numerical': 0.00039408866995073894, 'mean_word_length': 2.306840390879479, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6926776', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1164, 'n_words': 425}