habit skill

owly

闇の伝説
Staff member
戦闘 コーダー
well, that is probably our next one, dear fuk.

now we be makin fresh essential skills, this would be the 5th IG.

one of the annoying things will be the punishment algorithm for bad habits and missed tasks.

if I weren't so cheap I'd hire ppl to do this low level code monkey shit, but they would probably
do a shitty job and I'll just give them a shitty rating.

IG it comes down to how much I can fap in a given day.
the more I fap the more and better I code.

the real problem is the smell.
 

fukurou

the supreme coder
ADMIN
so we have 3 main parts to this:
habits +-
weeklies
ToDos

the 1st 2 we can use a size limited que. why limit it's size? for focus. 15 outta do it for the good habits
5 for the bad ones.

we have a designated module for the to-dos, which can also contain expiration/event dates.
 

owly

闇の伝説
Staff member
戦闘 コーダー
I want separation between the regular ToDos and the expirations. shit in the aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaass :s59:
 

fukurou

the supreme coder
ADMIN
setting specific days would be a bitch on the GUI, so weeklies should be:
weekends/regular days. bringing us to :

habits - :uniqueItemSizeLimitedQue
habits +:uniqueItemSizeLimitedQue
weekends:uniqueItemSizeLimitedQue
dailies:uniqueItemSizeLimitedQue
ToDos: ToDo
expirations: ToDo
 

fukurou

the supreme coder
ADMIN
I'm not adding a cron, cause it will be heavy alg wise,

BUT
maybe we should add an N^3 gamification level up module
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.DiSkillV2;

public class DiHabit extends DiSkillV2 {
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    break;
            }
        }
        // engagers
        // clear specific field
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package LivinGrimoire;

public class DiSkillV2 {
    protected Kokoro kokoro = new Kokoro(new AbsDictionaryDB()); // consciousness, shallow ref class to enable interskill communications
    protected DISkillUtils diSkillUtils = new DISkillUtils();
    protected Algorithm outAlg = null; // skills output
    protected int outpAlgPriority = -1; // defcon 1->5

    public DiSkillV2() {
        super();
    }
    // skill triggers and algorithmic logic
    public void input(String ear, String skin, String eye) {
    }
    // extraction of skill algorithm to run (if there is one)
    public void output(Neuron noiron) {
        if (outAlg != null) {
            noiron.insertAlg(this.outpAlgPriority,outAlg);
            outpAlgPriority = -1;
            outAlg = null;
        }
    }
    public void setKokoro(Kokoro kokoro) {
        // use this for telepathic communication between different chobits objects
        this.kokoro = kokoro;
    }
    protected void setVerbatimAlg(int priority, String... sayThis){
        this.outAlg = this.diSkillUtils.simpleVerbatimAlgorithm(sayThis);
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
}

Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.DiSkillV2;

public class DiHabit extends DiSkillV2 {
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"got it");
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
            }
        }
        // engagers
        // clear specific field
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

public class DiHabit extends DiSkillV2 {
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"got it");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
        }
        // clear specific field
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

public class DiHabit extends DiSkillV2 {
    /*setter params*/
    // habit params
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    // bad habits
    private UniqueItemSizeLimitedPriorityQueue habitsNegative = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitN = new AXCmdBreaker("i must not");
    //getter param
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
        habitsNegative.setLimit(5);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"habit registered");
                return;
            }
            temp = habitN.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsNegative.add(temp);
                temp = "";
                setVerbatimAlg(4,"bad habit registered");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
                case "bad habit":
                    setVerbatimAlg(4,habitsNegative.getRNDElement());
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                setVerbatimAlg(4,"bad boy");
                return;
            }
        }
        // clear specific field
        switch(ear) {
            case "clear habits":
                habitsPositive.clear();
                setVerbatimAlg(4,"habits cleared");
                break;
            case "clear bad habits":
                habitsNegative.clear();
                setVerbatimAlg(4,"bad habits cleared");
                break;
            default:
                // code block
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

public class DiHabit extends DiSkillV2 {
    /*setter params*/
    // habit params
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    // bad habits
    private UniqueItemSizeLimitedPriorityQueue habitsNegative = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitN = new AXCmdBreaker("i must not");
    // dailies
    private UniqueItemSizeLimitedPriorityQueue dailies = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker dailyCmdBreaker = new AXCmdBreaker("i out to");
    // weekends
    private UniqueItemSizeLimitedPriorityQueue weekends = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker weekendCmdBreaker = new AXCmdBreaker("i have to");
    //getter param
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
        habitsNegative.setLimit(5);
        dailies.setLimit(3);
        weekends.setLimit(3);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"habit registered");
                return;
            }
            temp = habitN.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsNegative.add(temp);
                temp = "";
                setVerbatimAlg(4,"bad habit registered");
                return;
            }
            temp = dailyCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                dailies.add(temp);
                temp = "";
                setVerbatimAlg(4,"daily registered");
                return;
            }
            temp = weekendCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                weekends.add(temp);
                temp = "";
                setVerbatimAlg(4,"prep registered");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
                case "bad habit":
                    setVerbatimAlg(4,habitsNegative.getRNDElement());
                    return;
                case "daily":
                    setVerbatimAlg(4,dailies.getRNDElement());
                    return;
                case "weekend": case "prep":
                    setVerbatimAlg(4,weekends.getRNDElement());
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                setVerbatimAlg(4,"bad boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,dailies.getAsList()).isEmpty())){
                setVerbatimAlg(4,"daily engaged");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,weekends.getAsList()).isEmpty())){
                setVerbatimAlg(4,"prep engaged");
                return;
            }
        }
        // clear specific field
        switch(ear) {
            case "clear habits":
                habitsPositive.clear();
                setVerbatimAlg(4,"habits cleared");
                break;
            case "clear bad habits":
                habitsNegative.clear();
                setVerbatimAlg(4,"bad habits cleared");
                break;
            case "clear dailies":
                dailies.clear();
                setVerbatimAlg(4,"dailies cleared");
                break;
            case "clear preps": case "clear weekends":
                weekends.clear();
                setVerbatimAlg(4,"preps cleared");
                break;
            default:
                // code block
        }
    }
}
 

owly

闇の伝説
Staff member
戦闘 コーダー
add expirations // Q
and todos // ToDo manager dual getter
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.APVerbatim;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

import java.util.ArrayList;

public class DiHabit extends DiSkillV2 {
    /*setter params*/
    // habit params
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    // bad habits
    private UniqueItemSizeLimitedPriorityQueue habitsNegative = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitN = new AXCmdBreaker("i must not");
    // dailies
    private UniqueItemSizeLimitedPriorityQueue dailies = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker dailyCmdBreaker = new AXCmdBreaker("i out to");
    // weekends
    private UniqueItemSizeLimitedPriorityQueue weekends = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker weekendCmdBreaker = new AXCmdBreaker("i have to");
    // expirations
    private UniqueItemSizeLimitedPriorityQueue expirations = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker expirationsCmdBreaker = new AXCmdBreaker("i got to");
    //getter param
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
        habitsNegative.setLimit(5);
        dailies.setLimit(3);
        weekends.setLimit(3);
        expirations.setLimit(3);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"habit registered");
                return;
            }
            temp = habitN.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsNegative.add(temp);
                temp = "";
                setVerbatimAlg(4,"bad habit registered");
                return;
            }
            temp = dailyCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                dailies.add(temp);
                temp = "";
                setVerbatimAlg(4,"daily registered");
                return;
            }
            temp = weekendCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                weekends.add(temp);
                temp = "";
                setVerbatimAlg(4,"prep registered");
                return;
            }
            temp = expirationsCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                expirations.add(temp);
                temp = "";
                setVerbatimAlg(4,"expiration registered");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
                case "bad habit":
                    setVerbatimAlg(4,habitsNegative.getRNDElement());
                    return;
                case "daily":
                    setVerbatimAlg(4,dailies.getRNDElement());
                    return;
                case "weekend": case "prep":
                    setVerbatimAlg(4,weekends.getRNDElement());
                    return;
                case "expirations":case "expiration":
                    setVerbatimAlgFromList(4,expirations.getAsList());
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                setVerbatimAlg(4,"bad boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,dailies.getAsList()).isEmpty())){
                setVerbatimAlg(4,"daily engaged");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,weekends.getAsList()).isEmpty())){
                setVerbatimAlg(4,"prep engaged");
                return;
            }
            // expiration gamification redacted
        }
        // clear specific field
        switch(ear) {
            case "clear habits":
                habitsPositive.clear();
                setVerbatimAlg(4,"habits cleared");
                break;
            case "clear bad habits":
                habitsNegative.clear();
                setVerbatimAlg(4,"bad habits cleared");
                break;
            case "clear dailies":
                dailies.clear();
                setVerbatimAlg(4,"dailies cleared");
                break;
            case "clear preps": case "clear weekends":
                weekends.clear();
                setVerbatimAlg(4,"preps cleared");
                break;
            case "clear expirations":
                expirations.clear();
                setVerbatimAlg(4,"expirations cleared");
                break;
            default:
                // code block
        }
    }
    protected void setVerbatimAlgFromList(int priority, ArrayList<String> sayThis){
        this.outAlg = this.diSkillUtils.onePartAlgorithmWithRepresantation(new APVerbatim(sayThis));
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
}
 

fukurou

the supreme coder
ADMIN
Java:
package skills;

import AXJava.AXCmdBreaker;
import AXJava.TODOListManager;
import AXJava.UniqueItemSizeLimitedPriorityQueue;
import LivinGrimoire.APVerbatim;
import LivinGrimoire.DISkillUtils;
import LivinGrimoire.DiSkillV2;

import java.util.ArrayList;

public class DiHabit extends DiSkillV2 {
    /*setter params*/
    // habit params
    private UniqueItemSizeLimitedPriorityQueue habitsPositive = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitP = new AXCmdBreaker("i should");
    private String temp = "";
    // bad habits
    private UniqueItemSizeLimitedPriorityQueue habitsNegative = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker habitN = new AXCmdBreaker("i must not");
    // dailies
    private UniqueItemSizeLimitedPriorityQueue dailies = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker dailyCmdBreaker = new AXCmdBreaker("i out to");
    // weekends
    private UniqueItemSizeLimitedPriorityQueue weekends = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker weekendCmdBreaker = new AXCmdBreaker("i have to");
    // expirations
    private UniqueItemSizeLimitedPriorityQueue expirations = new UniqueItemSizeLimitedPriorityQueue();
    private AXCmdBreaker expirationsCmdBreaker = new AXCmdBreaker("i got to");
    // to-do list
    private TODOListManager todo = new TODOListManager(5);
    private AXCmdBreaker toDoCmdBreaker = new AXCmdBreaker("i need to");
    private AXCmdBreaker clearCmdBreaker = new AXCmdBreaker("clear");
    //getter param
    private AXCmdBreaker getterCmdBreaker = new AXCmdBreaker("random");

    public DiHabit() {
        habitsPositive.setLimit(15);
        habitsNegative.setLimit(5);
        dailies.setLimit(3);
        weekends.setLimit(3);
        expirations.setLimit(3);
    }

    @Override
    public void input(String ear, String skin, String eye) {
        if (ear.isEmpty()){return;}
        // setters
        if (ear.contains("i")){
            temp = habitP.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsPositive.add(temp);
                temp = "";
                setVerbatimAlg(4,"habit registered");
                return;
            }
            temp = habitN.extractCmdParam(ear);
            if (!temp.isEmpty()){
                habitsNegative.add(temp);
                temp = "";
                setVerbatimAlg(4,"bad habit registered");
                return;
            }
            temp = dailyCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                dailies.add(temp);
                temp = "";
                setVerbatimAlg(4,"daily registered");
                return;
            }
            temp = weekendCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                weekends.add(temp);
                temp = "";
                setVerbatimAlg(4,"prep registered");
                return;
            }
            temp = expirationsCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                expirations.add(temp);
                temp = "";
                setVerbatimAlg(4,"expiration registered");
                return;
            }
            temp = toDoCmdBreaker.extractCmdParam(ear);
            if (!temp.isEmpty()){
                todo.addTask(temp);
                temp = "";
                setVerbatimAlg(4,"task registered");
                return;
            }
        }
        // getters
        temp = getterCmdBreaker.extractCmdParam(ear);
        if (!temp.isEmpty()){
            switch (temp){
                case "habit":
                    setVerbatimAlg(4,habitsPositive.getRNDElement());
                    return;
                case "bad habit":
                    setVerbatimAlg(4,habitsNegative.getRNDElement());
                    return;
                case "daily":
                    setVerbatimAlg(4,dailies.getRNDElement());
                    return;
                case "weekend": case "prep":
                    setVerbatimAlg(4,weekends.getRNDElement());
                    return;
                case "expirations":case "expiration":
                    setVerbatimAlgFromList(4,expirations.getAsList());
                    return;
                case "task":
                    setVerbatimAlg(4,todo.getTask());
                    return;
                case "to do":
                    setVerbatimAlg(4,todo.getOldTask());
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                setVerbatimAlg(4,"bad boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,dailies.getAsList()).isEmpty())){
                setVerbatimAlg(4,"daily engaged");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,weekends.getAsList()).isEmpty())){
                setVerbatimAlg(4,"prep engaged");
                return;
            }
            // expiration gamification redacted
        }
        // clear specific field
        switch(ear) {
            case "clear habits":
                habitsPositive.clear();
                setVerbatimAlg(4,"habits cleared");
                break;
            case "clear bad habits":
                habitsNegative.clear();
                setVerbatimAlg(4,"bad habits cleared");
                break;
            case "clear dailies":
                dailies.clear();
                setVerbatimAlg(4,"dailies cleared");
                break;
            case "clear preps": case "clear weekends":
                weekends.clear();
                setVerbatimAlg(4,"preps cleared");
                break;
            case "clear expirations":
                expirations.clear();
                setVerbatimAlg(4,"expirations cleared");
                break;
            case "clear tasks":case "clear task":case "clear to do":
                todo.clearAllTasks();
                setVerbatimAlg(4,"tasks cleared");
                break;
            default:
                if (ear.contains("clear")){
                    temp = clearCmdBreaker.extractCmdParam(ear);
                    if(todo.containsTask(temp)){
                        todo.clearTask(temp);
                        setVerbatimAlg(4,temp +" task cleared");
                        temp = "";
                    }
                }
        }
    }
    protected void setVerbatimAlgFromList(int priority, ArrayList<String> sayThis){
        this.outAlg = this.diSkillUtils.onePartAlgorithmWithRepresantation(new APVerbatim(sayThis));
        this.outpAlgPriority = priority; // 1->5 1 is the highest algorithm priority
    }
}

Java:
public class TODOListManager {
    /* manages to do tasks.
    q1 tasks are mentioned once, and forgotten
    backup tasks are the memory of recently mentioned tasks
    * */
    private UniqueItemSizeLimitedPriorityQueue q1 = new UniqueItemSizeLimitedPriorityQueue();
    private UniqueItemSizeLimitedPriorityQueue backup = new UniqueItemSizeLimitedPriorityQueue();

    public TODOListManager(int todoLim) {
        q1.setLimit(todoLim);
        backup.setLimit(todoLim);
    }

    public void addTask(String e1){
        q1.add(e1);
    }
    public String getTask(){
        String temp = q1.poll();
        if(!temp.isEmpty()){backup.add(temp);}
        return temp;
    }
    public String getOldTask(){
        // task graveyard (tasks you've tackled already)
        return backup.getRNDElement();
    }
    public void clearAllTasks(){
        q1.clear();
        backup.clear();
    }
    public void clearTask(String task){
        q1.removeItem(task);
        backup.removeItem(task);
    }
    public Boolean containsTask(String task){
        return backup.contains(task);
    }
}
 
Top