kokoro where the soul will reside :

Code:


package chobit;

import java.util.Hashtable;

public class Kokoro {
   Hashtable<String, Integer> pain = new Hashtable<>();

   public int getPain(String BijuuName) {
      return pain.getOrDefault(BijuuName, 0);
   }

   public void in(Chi chi) {
   }
   public void out(Boolean isCompleted, enumFail failure) {
   }
}


Bijuu : a wrapper for groups of skills (treated as a single skill)

Code:


package chobit;

import java.util.ArrayList;

public class Bijuu extends AbsCmdReq {
   private ArrayList<DISkill> dSkills = new ArrayList<>();
   private Kokoro kokoro;
   private String myName;
   final int constTolerance = 3;
   int tolerance = constTolerance;
   Boolean enabled = true;
   Boolean fastBreak = true;
   private Permission permission;
   private Person person;

   public Bijuu(Permission permission, Person master, Kokoro kokoro, String myName, DISkill... skills) {
      super();
      this.kokoro = kokoro;
      this.myName = myName;
      this.permission = permission;
      this.person = person;
      for (DISkill i : skills) {
         dSkills.add(i);
      }
   }

   public void modeFlip() {
      tolerance -= kokoro.getPain(myName);
      if (tolerance < 1) {
         this.enabled = !this.enabled;
      }
   }

   @Override
   public void input(String ear, String skin, String eye) {
      if (enabled) {
         for (DISkill dISkill : dSkills) {
            dISkill.input(ear, skin, eye);
            if (dISkill.getSentAlg()) {
               dISkill.setOutput(true);
               fastBreak = false;
               break;
            }
         }
      }
      else {
         reenable(ear, skin, eye);
      }
   }

   @Override
   public void output(Neuron noiron) {
      // TODO Auto-generated method stub
      if (!fastBreak) {
         fastBreak = true;
         for (DISkill dISkill : dSkills) {
            if (dISkill.getOutput()) {
               dISkill.output(noiron);
               break;
            }
         }
      }
   }

   public void reenable(String ear, String skin, String eye) {
      if (ear.contains("pain") || skin.contains("pain")) {
         tolerance -= 1;
         if (tolerance < 1) {
            this.enabled = true;
         }
      }
   }
}



DISkill : a DSkill built to work with the kokoro :

Code:


package chobit;

public class DISkill extends AbsCmdReq {
   Boolean sentAlg = false;
   Boolean output = false;
   String ofSkill;
   Kokoro kokoro;
   // in sub cls : person ?
   public DISkill(String ofSkill, Kokoro kokoro) {
      super();
      this.ofSkill = ofSkill;
      this.kokoro = kokoro;
   }
   @Override
   public void output(Neuron noiron) {
      // set sentAlg = true if an alg is to be sent

   }


   @Override
   public void input(String ear, String skin, String eye) {
      // TODO Auto-generated method stub

   }

   public Boolean getOutput() {
      Boolean result = this.output;
      this.output = false;
      return result;
   }

   public void setOutput(Boolean output) {
      this.output = output;
   }

   public Boolean getSentAlg() {
      Boolean result = this.sentAlg;
      this.sentAlg = false;
      return result;
   }
}



Chi : an adaptor pattern, that wraps an AlgPart which is an actual action
and makes said AP work with the kokoro

Code:

package chobit;

public class Chi extends AbsAlgPart {
   Kokoro Kokoro;
   // *person
   String ofSkill;
   AbsAlgPart aPart;

   public Chi(chobit.Kokoro kokoro, String ofSkill, AbsAlgPart aPart) {
      super();
      Kokoro = kokoro;
      this.ofSkill = ofSkill;
      this.aPart = aPart;
   }

   public String actualAction(String ear, String skin, String eye) {
      return aPart.action(ear, skin, eye);
   }
   @Override
   public String action(String ear, String skin, String eye) {
      Kokoro.in(this);
      String result = actualAction(ear, skin, eye);
      Kokoro.out(completed(), failure(""));
      return result;
   }

   @Override
   public Boolean itemize() {
      // TODO Auto-generated method stub
      return aPart.itemize();
   }

   @Override
   public enumFail failure(String input) {
      // TODO Auto-generated method stub
      return aPart.failure(input);
   }

   @Override
   public Boolean completed() {
      // TODO Auto-generated method stub
      return aPart.completed();
   }

   @Override
   public AbsAlgPart clone() {
      // TODO Auto-generated method stub
      return aPart.clone();
   }

}


:getsome: :LF: