👨‍💻 dev LG port Java->vb.net

development

fukurou

the supreme coder
ADMIN
Code:
Public Class Thinkable
    Public Function Think(ear As String, skin As String, eye As String) As String
        ' Override me
        Return ""
    End Function
End Class
 

fukurou

the supreme coder
ADMIN
Code:
Public Class Chobits
        Inherits Thinkable

        Protected dClasses As New List(Of DiSkillV2)()
        Protected fusion As Fusion
        Protected noiron As Neuron
        Protected kokoro As Kokoro = New Kokoro(New AbsDictionaryDB()) ' consciousness

        Public Sub New()
            MyBase.New()
            Me.fusion = New Fusion()
            noiron = New Neuron()
        End Sub

        Public Sub SetDataBase(absDictionaryDB As AbsDictionaryDB)
            Me.kokoro = New Kokoro(absDictionaryDB)
        End Sub

        Public Function AddSkill(skill As DiSkillV2) As Chobits
            skill.SetKokoro(Me.kokoro)
            Me.dClasses.Add(skill)
            Return Me
        End Function

        Public Sub ClearSkills()
            ' Remove all skills
            Me.dClasses.Clear()
        End Sub

        Public Sub AddSkills(ParamArray skills As DiSkillV2())
            For Each skill As DiSkillV2 In skills
                skill.SetKokoro(Me.kokoro)
                Me.dClasses.Add(skill)
            Next
        End Sub

        Public Sub RemoveSkill(skill As DiSkillV2)
            dClasses.Remove(skill)
        End Sub

        Public Function ContainsSkill(skill As DiSkillV2) As Boolean
            Return dClasses.Contains(skill)
        End Function

        Public Overloads Function Think(ear As String, skin As String, eye As String) As String
            For Each dCls As DiSkillV2 In dClasses
                InOut(dCls, ear, skin, eye)
            Next
            fusion.LoadAlgs(noiron)
            Return fusion.RunAlgs(ear, skin, eye)
        End Function

        Public Function GetSoulEmotion() As String
            Return fusion.GetEmot()
        End Function

        Protected Sub InOut(dClass As DiSkillV2, ear As String, skin As String, eye As String)
            dClass.Input(ear, skin, eye) ' New
            dClass.Output(noiron)
        End Sub

        Public Function GetFusion() As Fusion
            Return fusion
        End Function

        Public Function GetSkillList() As List(Of String)
            Dim result As New List(Of String)()
            For Each skill As DiSkillV2 In Me.dClasses
                result.Add(skill.GetType().Name)
            Next
            Return result
        End Function
        Public Function GetKokoro() As Kokoro
            Return kokoro
        End Function
        Public Sub SetKokoro(kokoro As Kokoro)
            Me.kokoro = kokoro
        End Sub
    End Class
 

fukurou

the supreme coder
ADMIN
Code:
    Public Class Chobits
        Inherits Thinkable

        Protected dClasses As New List(Of DiSkillV2)()
        Protected fusion As Fusion
        Protected noiron As Neuron
        Protected kokoro As Kokoro = New Kokoro(New AbsDictionaryDB()) ' consciousness

        Public Sub New()
            MyBase.New()
            Me.fusion = New Fusion()
            noiron = New Neuron()
        End Sub

        Public Sub SetDataBase(absDictionaryDB As AbsDictionaryDB)
            Me.kokoro = New Kokoro(absDictionaryDB)
        End Sub

        Public Function AddSkill(skill As DiSkillV2) As Chobits
            skill.SetKokoro(Me.kokoro)
            Me.dClasses.Add(skill)
            Return Me
        End Function

        Public Sub ClearSkills()
            ' Remove all skills
            Me.dClasses.Clear()
        End Sub

        Public Sub AddSkills(ParamArray skills As DiSkillV2())
            For Each skill As DiSkillV2 In skills
                skill.SetKokoro(Me.kokoro)
                Me.dClasses.Add(skill)
            Next
        End Sub

        Public Sub RemoveSkill(skill As DiSkillV2)
            dClasses.Remove(skill)
        End Sub

        Public Function ContainsSkill(skill As DiSkillV2) As Boolean
            Return dClasses.Contains(skill)
        End Function

        Public Overloads Function Think(ear As String, skin As String, eye As String) As String
            For Each dCls As DiSkillV2 In dClasses
                InOut(dCls, ear, skin, eye)
            Next
            fusion.LoadAlgs(noiron)
            Return fusion.RunAlgs(ear, skin, eye)
        End Function

        Public Function GetSoulEmotion() As String
            Return fusion.GetEmot()
        End Function

        Protected Sub InOut(dClass As DiSkillV2, ear As String, skin As String, eye As String)
            dClass.Input(ear, skin, eye) ' New
            dClass.Output(noiron)
        End Sub

        Public Function GetFusion() As Fusion
            Return fusion
        End Function

        Public Function GetSkillList() As List(Of String)
            Dim result As New List(Of String)()
            For Each skill As DiSkillV2 In Me.dClasses
                result.Add(skill.GetType().Name)
            Next
            Return result
        End Function
        Public Function GetKokoro() As Kokoro
            Return kokoro
        End Function
        Public Sub SetKokoro(kokoro As Kokoro)
            Me.kokoro = kokoro
        End Sub
    End Class
 

fukurou

the supreme coder
ADMIN
Code:
    Sub Main()
        Dim neo As New Chobits()
        neo.AddSkill(New DiHelloWorld())
        Console.WriteLine(neo.Think("hello", "", ""))
        Console.WriteLine(neo.Think("", "", ""))
        Console.ReadLine()
    End Sub
 

fukurou

the supreme coder
ADMIN
Code:
    Public Class Brain
        Public logicChobit As Chobits
        Public hardwareChobit As Chobits
        Private emotion As String = ""
        Private bodyInfo As String = ""
        Private logicChobitOutput As String = ""

        Public ReadOnly Property GetEmotion() As String
            Get
                Return emotion
            End Get
        End Property

        Public ReadOnly Property GetBodyInfo() As String
            Get
                Return bodyInfo
            End Get
        End Property

        Public ReadOnly Property GetLogicChobitOutput() As String
            Get
                Return logicChobitOutput
            End Get
        End Property

        Public Sub New()
            logicChobit = New Chobits()
            hardwareChobit = New Chobits()
            hardwareChobit.SetKokoro(logicChobit.GetKokoro())
        End Sub

        Public Sub DoIt(ByVal ear As String, ByVal skin As String, ByVal eye As String)
            If Not bodyInfo = "" Then
                logicChobitOutput = logicChobit.Think(ear, bodyInfo, eye)
            Else
                logicChobitOutput = logicChobit.Think(ear, skin, eye)
            End If
            emotion = logicChobit.GetSoulEmotion()
            ' Case: Hardware skill wishes to pass info to logical chobit
            bodyInfo = hardwareChobit.Think(logicChobitOutput, skin, eye)
        End Sub
    End Class
 
Top