ChobitV2 with the personality constructor :

Code:

import java.util.ArrayList;
import java.util.Hashtable;

public class ChobitV2 implements thinkable{
    protected String emot = ""; // emotion
    protected ArrayList<AbsCmdReq> dClassesLv1;
    protected ArrayList<AbsCmdReq> dClassesLv2;// can engage with friends and work related
    protected ArrayList<AbsCmdReq> dClassesLv3;// can engage only by user
    protected ArrayList<AbsCmdReq> dClassesAuto = new ArrayList<>();// automatically added and engaged by time
    // algorithms fusion (polymarization)
    protected Hashtable<String, Integer> AlgDurations;
    protected Fusion fusion;
    // region essential DClasses
    protected Permission permission;
    protected DPermitter dPermitter;
    // endregion
    protected Neuron noiron;
    // sleep vars :
    protected Person activePerson = new Person();
    protected PrimoCera primoCera = new PrimoCera();
    // added :
    protected Kokoro kokoro; // soul
    protected Person master = new Person();
    protected String lastOutput = "";
    // standBy phase 260320
    protected TimeGate timeGate = new TimeGate();
    public ChobitV2(Personality personality) {
        super();
        this.AlgDurations=personality.getAlgDurations();
        this.fusion=personality.getFusion();
        this.kokoro = personality.getKokoro();
        permission=personality.getPermission();
        dPermitter=personality.getdPermitter();
        noiron = new Neuron();
        dClassesLv1=personality.getdClassesLv1();
        dClassesLv2=personality.getdClassesLv2();
        dClassesLv3=personality.getdClassesLv3();
        formAutoClassesList();
    }
public void loadPersonality(Personality personality){
    this.AlgDurations=personality.getAlgDurations();
    this.fusion=personality.getFusion();
    this.kokoro = personality.getKokoro();
    permission=personality.getPermission();
    dPermitter=personality.getdPermitter();
    noiron = new Neuron();
    dClassesLv1=personality.getdClassesLv1();
    dClassesLv2=personality.getdClassesLv2();
    dClassesLv3=personality.getdClassesLv3();
    dClassesAuto = new ArrayList<>();
    formAutoClassesList();
}
    protected void formAutoClassesList() {
        // adds automatic skills so they can be engaged by time
        for (AbsCmdReq dCls : dClassesLv2) {
            if (dCls.auto()) {
                dClassesAuto.add(dCls);
            }
        }
        for (AbsCmdReq dCls : dClassesLv3) {
            if (dCls.auto()) {
                dClassesAuto.add(dCls);
            }
        }
    }
    public String doIt(String ear, String skin, String eye) {
        ear = translateIn(ear);
        for (AbsCmdReq dCls : dClassesAuto) {
            inOut(dCls, "", skin, eye);
        }
        for (AbsCmdReq dCls : dClassesLv1) {
            inOut(dCls, ear, skin, eye);
        }
        if (dPermitter.getPermissionLevel() > 0) {
            // works with friends
            for (AbsCmdReq dCls : dClassesLv2) {
                inOut(dCls, ear, skin, eye);

            }
        }
        if (dPermitter.getPermissionLevel() > 1) {
            // only works with owner
            for (AbsCmdReq dCls : dClassesLv3) {
                inOut(dCls, ear, skin, eye);
            }
        }
        fusion.setAlgQueue(noiron);
        return translateOut(fusion.act(ear, skin, eye));
    }
    public String getSoulEmotion(){return kokoro.getEmot();}
    public String getEmot() {
        // emot (emotion for display)
        String x1 = emot;
        switch (this.emot) {
            case "APCuss ":
                x1 = "angry";
                break;
            case "APDirtyTalk":
                x1 = "grinny";
                break;
            case "APMoan":
                x1 = "horny";
                break;
            case "APSay":
                x1 = "speaking";
                break;
            case "APSleep0":
                x1 = "dreaming";
                break;
            case "APSleep":
                x1 = "asleep";
                break;
            case "APSpell":
                x1 = "blank";
                break;
            default:
                break;
        }
        emot = "";
        return x1;
    }

    protected void inOut(AbsCmdReq dClass, String ear, String skin, String eye) {
        dClass.input(ear, skin, eye); // new
        dClass.output(noiron);
    }

    protected String translateIn(String earIn) {
        // makes sure the chobit doesn't feedback on her own output
        if (earIn.equals(lastOutput)) {
            return "";
        }
        return earIn;
    }

    protected String translateOut(String outResult) {
        // save last output served
        if (!outResult.isEmpty()) {
            lastOutput = outResult;
            this.timeGate.close();
            this.kokoro.standBy = false;
        }
        // standBy :
        else {
            if (!this.timeGate.isClosed()) {
                this.kokoro.standBy = true;
                this.timeGate.close();
            } else {
                this.kokoro.standBy = false;
            }
        }
        return outResult;
    }

    @Override
    public String think(String ear, String skin, String eye) {
        return doIt(ear,skin,eye);
    }
}


so at this point you wonder why does the ChobitV2 class implements thinkable ?

this is a beef up, which enables daisy chaining chobits using a Brain class.
said brain class has input flow through a list of chobits(AGIs), and ending up in
a cerabellum class which is responsible for executing codes in the real world, meaning
speaking words, moving robotics, changing screen backgrounds, sending SMS and other such codes.

this daisy chain process enables AI pharmaceuticals, as can be seen in the Brain class documentation :
/*
    * chobit hierarchy and responsibilities within the Brain class, which is a
    * Chobit daisy chain.
    *
    * higher lv chobits : reality distortion on drug intake, and input
    * translations(such as languages) lower lv chobits : drug addictions, context
    * sensitive translation of outputs, and primitive behaviors. primitive
    * behaviors : algorithm,s that do not require items and are not dependant on
    * time or place
    */

to use the Chobit class you can remove the implements thinkable. however to use the Brian class add :

Code:

public interface actionable {
    //an interface for cerabellums, see CerabellumV2 for example
    public void act(String thought);
}


thinkable:

Code:

public interface thinkable {
    // an interface for the doIt function, see ChobitV2 for example implements
    public String think(String ear, String skin, String eye);
}


CerabellumV2 an example cerabellum class for the brain class to run IRL actions:

Code:

import android.app.Activity;
import android.content.Context;

public class CerabellumV2 implements actionable{
    private Boolean screen = true;
    private String time = "";
    private String place = "";
    private String item = "";
    private String person = "";
    private int number = 0;
    private MainActivity context=null;
    private RegexUtil regexUtil = new RegexUtil();
    public CerabellumV2(MainActivity context) {
        this.context = context;
    }
    @Override
    public void act(String thought) {
        /*
        * gets the chobit result string (chobit.doIt)
        * and converts it to an action*/
        if(thought.isEmpty()){context.clearTxtBox();return;}
        String action = regexCmd(thought);
        //case, functions or variables from the mainactivity are engaged as needed
        //modify as needed
        switch(action) {
            case "change screen":
                if(screen){context.screenFlip1();}
                else {context.screenFlip2();}
                screen = !screen;
                context.clearTxtBox();
                break;
            default:
                context.cerabellumSpeak(action);
        }

    }
    private String regexCmd(String thought){
        //populate the global vars and set the action (return string value to run in the act functions switch case)
        //this is used for actions that use regexed params such as sending an SMS
        return thought;
    }
    private void clearGlobalVars(){}
}


and finally the brain class :

Code:

package com.yotamarker.lgkotlin1;

import java.util.ArrayList;

public class Brain {
    private ArrayList<thinkable> chobits = new ArrayList<>();
    private actionable action;

    /*
    * chobit hierarchy and responsibilities within the Brain class, which is a
    * Chobit daisy chain.
    *
    * higher lv chobits : reality distortion on drug intake, and input
    * translations(such as languages) lower lv chobits : drug addictions, context
    * sensitive translation of outputs, and primitive behaviors. primitive
    * behaviors : algorithm,s that do not require items and are not dependant on
    * time or place
    */
    public Brain(actionable action, thinkable...chobits) {
        super();
        this.action = action;
        for (thinkable chobit : chobits) {
            this.chobits.add(chobit);
        }
    }

    public void doIt(String ear, String skin, String eye) {
        String result = ear;
        for (thinkable chobit : chobits) {
            if (result.contains("#skin")) {
                result = result.replace("#skin", "");
                result = chobit.think(ear, result, eye);
                continue;
            }
            if (result.contains("#eye")) {
                result = result.replace("#eye", "");
                result = chobit.think(ear, skin, result);
                continue;
            }
            if (result.isEmpty()) {
                chobit.think(ear, skin, eye);
            } else {
                result = chobit.think(result, skin, eye);
            }
        }
        action.act(result);
    }
}


in the main activity :
declaring the globla variables :
var chii:ChobitV2? = null
var cerabellumV2:actionable?=null //TODO
var brain:Brain?=null

initializing variables (within onCreate function of the MainActivity):
chii = ChobitV2(Personality1(SharedPrefDB(this))) //builds a chobit with
chii!!.loadPersonality(Personality1(SharedPrefDB(this)))//reload a new personality if needed
cerabellumV2=CerabellumV2(this)//builds a class to run actuall real world actions
brain = Brain(cerabellumV2!!,chii!!) //builds a chobit daisy chain

example engaging the brain class :
brain!!.doIt(editText.text.toString(),"","")

:morph: