habit skill java-python

fukurou

the supreme coder
ADMIN
Java:
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");
    private AXStrOrDefault strOrDefault = new AXStrOrDefault();
    // gamification modules for shallow ref in other skills
    private AXGamification gamification = new AXGamification();
    private AXGamification punishments = new AXGamification();

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

    public AXGamification getGamification() {
        return gamification;
    }

    public AXGamification getPunishments() {
        return punishments;
    }

    @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,strOrDefault.getOrDefault(habitsPositive.getRNDElement(),"no habits registered"));
                    return;
                case "bad habit":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(habitsNegative.getRNDElement(),"no bad habits registered"));
                    return;
                case "daily":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(dailies.getRNDElement(),"no dailies registered"));
                    return;
                case "weekend": case "prep":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(weekends.getRNDElement(),"no preps registered"));
                    return;
                case "expirations":case "expiration":
                    if(expirations.getAsList().isEmpty()){
                        setVerbatimAlg(4,"no expirations registered");
                        return;
                    }
                    setVerbatimAlgFromList(4,expirations.getAsList());
                    return;
                case "task":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(todo.getTask(),"no tasks registered"));
                    return;
                case "to do":
                    setVerbatimAlg(4,strOrDefault.getOrDefault(todo.getOldTask(),"no tasks registered"));
                    return;
            }
        }
        // engagers
        if(ear.contains("completed")){
            if (!(diSkillUtils.strContainsList(ear,habitsPositive.getAsList()).isEmpty())){
                gamification.increment();
                setVerbatimAlg(4,"good boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,habitsNegative.getAsList()).isEmpty())){
                punishments.increment();
                setVerbatimAlg(4,"bad boy");
                return;
            }
            if (!(diSkillUtils.strContainsList(ear,dailies.getAsList()).isEmpty())){
                gamification.increment();
                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;
            case "clear all habits":
                habitsPositive.clear();
                habitsNegative.clear();
                dailies.clear();
                weekends.clear();
                expirations.clear();
                todo.clearAllTasks();
                setVerbatimAlg(4,"all habits cleared");
                break;
            default:
                if (ear.contains("clear")){
                    temp = clearCmdBreaker.extractCmdParam(ear);
                    if(todo.containsTask(temp)){
                        todo.clearTask(temp);
                        setVerbatimAlg(4,temp +" task cleared");
                        temp = "";
                    }
                }
        }
    }
}
 

fukurou

the supreme coder
ADMIN
Python:
class DiHabit:
    def __init__(self):
        # setter params:
        # habit params
        self._habitsPositive: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(15)
        self._habitP: AXCmdBreaker = AXCmdBreaker("i should")
        self._temp: str = ""
 

fukurou

the supreme coder
ADMIN
Python:
class DiHabit:
    def __init__(self):
        # setter params:
        # habit params
        self._habitsPositive: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(15)
        self._habitP: AXCmdBreaker = AXCmdBreaker("i should")
        self._temp: str = ""
        # bad habits
        self._habitsNegative: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(5)
        self._habitN: AXCmdBreaker = AXCmdBreaker("i must not")
        # dailies
        self._dailies: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._dailyCmdBreaker: AXCmdBreaker = AXCmdBreaker("i out to")
        # weekends
        self._weekends: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._weekendCmdBreaker: AXCmdBreaker = AXCmdBreaker("i have to")
        # expirations
        self._expirations: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._expirationsCmdBreaker: AXCmdBreaker = AXCmdBreaker("i got to")
        # to-do list
        self._todo: TODOListManager = TODOListManager(5)
        self._toDoCmdBreaker: AXCmdBreaker = AXCmdBreaker("i need to")
        self._clearCmdBreaker: AXCmdBreaker = AXCmdBreaker("clear")
        # getter param
        self._getterCmdBreaker: AXCmdBreaker = AXCmdBreaker("random")
        # gamification modules for shallow ref in other skills
        self._gamification: AXGamification = AXGamification()
        self._punishments: AXGamification = AXGamification()

shiiiiieeet
 

fukurou

the supreme coder
ADMIN
Python:
class DiHabit(DiSkillV2):
    def __init__(self):
        super().__init__()
        # setter params:
        # habit params
        self._habitsPositive: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(15)
        self._habitP: AXCmdBreaker = AXCmdBreaker("i should")
        self._temp: str = ""
        # bad habits
        self._habitsNegative: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(5)
        self._habitN: AXCmdBreaker = AXCmdBreaker("i must not")
        # dailies
        self._dailies: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._dailyCmdBreaker: AXCmdBreaker = AXCmdBreaker("i out to")
        # weekends
        self._weekends: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._weekendCmdBreaker: AXCmdBreaker = AXCmdBreaker("i have to")
        # expirations
        self._expirations: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._expirationsCmdBreaker: AXCmdBreaker = AXCmdBreaker("i got to")
        # to-do list
        self._todo: TODOListManager = TODOListManager(5)
        self._toDoCmdBreaker: AXCmdBreaker = AXCmdBreaker("i need to")
        self._clearCmdBreaker: AXCmdBreaker = AXCmdBreaker("clear")
        # getter param
        self._getterCmdBreaker: AXCmdBreaker = AXCmdBreaker("random")
        # gamification modules for shallow ref in other skills
        self._gamification: AXGamification = AXGamification()
        self._punishments: AXGamification = AXGamification()

    def getGamification(self) -> AXGamification:
        return self._gamification

    def getPunishments(self) -> AXGamification:
        return self._punishments

    # Override
    def input(self, ear: str, skin: str, eye: str):
        if ear == "":
            return
        # setters
        if ear.__contains__("i"):
            self._temp = self._habitP.extractCmdParam(ear)
            if not(self._temp == ""):
                self._habitsPositive.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "habit registered")
                return
            self._temp = self._habitN.extractCmdParam(ear)
            if not (self._temp == ""):
                self._habitsNegative.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "bad habit registered")
                return
            self._temp = self._dailyCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._dailies.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "daily registered")
                return
            self._temp = self._weekendCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._weekends.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "prep registered")
                return
            self._temp = self._expirationsCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._expirations.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "expiration registered")
                return
            self._temp = self._toDoCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._todo.addTask(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "task registered")
                return
 

fukurou

the supreme coder
ADMIN
Python:
class DiHabit(DiSkillV2):
    def __init__(self):
        super().__init__()
        # setter params:
        # habit params
        self._habitsPositive: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(15)
        self._habitP: AXCmdBreaker = AXCmdBreaker("i should")
        self._temp: str = ""
        # bad habits
        self._habitsNegative: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(5)
        self._habitN: AXCmdBreaker = AXCmdBreaker("i must not")
        # dailies
        self._dailies: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._dailyCmdBreaker: AXCmdBreaker = AXCmdBreaker("i out to")
        # weekends
        self._weekends: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._weekendCmdBreaker: AXCmdBreaker = AXCmdBreaker("i have to")
        # expirations
        self._expirations: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._expirationsCmdBreaker: AXCmdBreaker = AXCmdBreaker("i got to")
        # to-do list
        self._todo: TODOListManager = TODOListManager(5)
        self._toDoCmdBreaker: AXCmdBreaker = AXCmdBreaker("i need to")
        self._clearCmdBreaker: AXCmdBreaker = AXCmdBreaker("clear")
        # getter param
        self._getterCmdBreaker: AXCmdBreaker = AXCmdBreaker("random")
        # gamification modules for shallow ref in other skills
        self._gamification: AXGamification = AXGamification()
        self._punishments: AXGamification = AXGamification()

    def getGamification(self) -> AXGamification:
        return self._gamification

    def getPunishments(self) -> AXGamification:
        return self._punishments

    # Override
    def input(self, ear: str, skin: str, eye: str):
        if ear == "":
            return
        # setters
        if ear.__contains__("i"):
            self._temp = self._habitP.extractCmdParam(ear)
            if not (self._temp == ""):
                self._habitsPositive.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "habit registered")
                return
            self._temp = self._habitN.extractCmdParam(ear)
            if not (self._temp == ""):
                self._habitsNegative.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "bad habit registered")
                return
            self._temp = self._dailyCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._dailies.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "daily registered")
                return
            self._temp = self._weekendCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._weekends.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "prep registered")
                return
            self._temp = self._expirationsCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._expirations.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "expiration registered")
                return
            self._temp = self._toDoCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._todo.addTask(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "task registered")
                return
        # getters
        self._temp = self._getterCmdBreaker.extractCmdParam(ear)
        if not (self._temp == ""):
            match self._temp:
                case 'habit':
                    self.setVerbatimAlg(4, getOrDefault(self._habitsPositive.getRNDElement(), "no habits registered"))
                    return
                case 'bad habit':
                    self.setVerbatimAlg(4,
                                        getOrDefault(self._habitsNegative.getRNDElement(), "no bad habits registered"))
                    return
                case 'daily':
                    self.setVerbatimAlg(4, getOrDefault(self._dailies.getRNDElement(), "no dailies registered"))
                    return
                case "prep":
                    self.setVerbatimAlg(4, getOrDefault(self._weekends.getRNDElement(), "no preps registered"))
                    return
                case "expiration":
                    if len(self._expirations.getAsList()) == 0:
                        self.setVerbatimAlg(4, "no expirations registered")
                        return
                    l1: list[str] = []
                    q1 = self._expirations.getAsList()
                    for i in range(0, len(q1)):
                        l1.append(q1[i])
                    self.setVebatimAlgFromList(4, l1)
                    return
 

fukurou

the supreme coder
ADMIN
Python:
class DiHabit(DiSkillV2):
    def __init__(self):
        super().__init__()
        # setter params:
        # habit params
        self._habitsPositive: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(15)
        self._habitP: AXCmdBreaker = AXCmdBreaker("i should")
        self._temp: str = ""
        # bad habits
        self._habitsNegative: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(5)
        self._habitN: AXCmdBreaker = AXCmdBreaker("i must not")
        # dailies
        self._dailies: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._dailyCmdBreaker: AXCmdBreaker = AXCmdBreaker("i out to")
        # weekends
        self._weekends: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._weekendCmdBreaker: AXCmdBreaker = AXCmdBreaker("i have to")
        # expirations
        self._expirations: UniqueItemSizeLimitedPriorityQueue = UniqueItemSizeLimitedPriorityQueue(3)
        self._expirationsCmdBreaker: AXCmdBreaker = AXCmdBreaker("i got to")
        # to-do list
        self._todo: TODOListManager = TODOListManager(5)
        self._toDoCmdBreaker: AXCmdBreaker = AXCmdBreaker("i need to")
        self._clearCmdBreaker: AXCmdBreaker = AXCmdBreaker("clear")
        # getter param
        self._getterCmdBreaker: AXCmdBreaker = AXCmdBreaker("random")
        # gamification modules for shallow ref in other skills
        self._gamification: AXGamification = AXGamification()
        self._punishments: AXGamification = AXGamification()

    def getGamification(self) -> AXGamification:
        return self._gamification

    def getPunishments(self) -> AXGamification:
        return self._punishments

    # Override
    def input(self, ear: str, skin: str, eye: str):
        if ear == "":
            return
        # setters
        if ear.__contains__("i"):
            self._temp = self._habitP.extractCmdParam(ear)
            if not (self._temp == ""):
                self._habitsPositive.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "habit registered")
                return
            self._temp = self._habitN.extractCmdParam(ear)
            if not (self._temp == ""):
                self._habitsNegative.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "bad habit registered")
                return
            self._temp = self._dailyCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._dailies.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "daily registered")
                return
            self._temp = self._weekendCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._weekends.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "prep registered")
                return
            self._temp = self._expirationsCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._expirations.insert(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "expiration registered")
                return
            self._temp = self._toDoCmdBreaker.extractCmdParam(ear)
            if not (self._temp == ""):
                self._todo.addTask(self._temp)
                self._temp = ""
                self.setVerbatimAlg(4, "task registered")
                return
        # getters
        self._temp = self._getterCmdBreaker.extractCmdParam(ear)
        if not (self._temp == ""):
            match self._temp:
                case 'habit':
                    self.setVerbatimAlg(4, getOrDefault(self._habitsPositive.getRNDElement(), "no habits registered"))
                    return
                case 'bad habit':
                    self.setVerbatimAlg(4,
                                        getOrDefault(self._habitsNegative.getRNDElement(), "no bad habits registered"))
                    return
                case 'daily':
                    self.setVerbatimAlg(4, getOrDefault(self._dailies.getRNDElement(), "no dailies registered"))
                    return
                case "prep":
                    self.setVerbatimAlg(4, getOrDefault(self._weekends.getRNDElement(), "no preps registered"))
                    return
                case "expiration":
                    if len(self._expirations.getAsList()) == 0:
                        self.setVerbatimAlg(4, "no expirations registered")
                        return
                    l1: list[str] = []
                    q1 = self._expirations.getAsList()
                    for i in range(0, len(q1)):
                        l1.append(q1[i])
                    self.setVebatimAlgFromList(4, l1)
                    return
                case "task":
                    self.setVerbatimAlg(4, getOrDefault(self._todo.getTask(), "no new tasks registered"))
                    return
                case "to do":
                    self.setVerbatimAlg(4, getOrDefault(self._todo.getOldTask(), "no tasks registered"))
                    return
        # engagers
        if ear.__contains__("completed"):
            if not (self._diSkillUtils.strContainsList(ear, self._habitsPositive.getAsList()) == ""):
                self._gamification.increment()
                self.setVerbatimAlg(4, "good boy")
                return
            if not (self._diSkillUtils.strContainsList(ear, self._habitsNegative.getAsList()) == ""):
                self._punishments.increment()
                self.setVerbatimAlg(4, "bad boy")
                return
            if not (self._diSkillUtils.strContainsList(ear, self._dailies.getAsList()) == ""):
                self._gamification.increment()
                self.setVerbatimAlg(4, "daily engaged")
                return
            if not (self._diSkillUtils.strContainsList(ear, self._weekends.getAsList()) == ""):
                self.setVerbatimAlg(4, "prep engaged")
                return
            # expiration gamification redacted
        # clear specific fields
        match ear:
            case 'clear habits':
                self._habitsPositive.clear()
                self.setVerbatimAlg(4, "habits cleared")
                return
            case 'clear bad habits':
                self._habitsNegative.clear()
                self.setVerbatimAlg(4, "bad habits cleared")
                return
            case 'clear dailies':
                self._dailies.clear()
                self.setVerbatimAlg(4, "dailies cleared")
                return
            case 'clear preps':
                self._weekends.clear()
                self.setVerbatimAlg(4, "preps cleared")
                return
            case 'clear expirations':
                self._expirations.clear()
                self.setVerbatimAlg(4, "expirations cleared")
                return
            case 'clear tasks':
                self._todo.clearAllTasks()
                self.setVerbatimAlg(4, "tasks cleared")
                return
            case 'clear all habits':
                self._habitsPositive.clear()
                self._habitsNegative.clear()
                self._dailies.clear()
                self._weekends.clear()
                self._expirations.clear()
                self._todo.clearAllTasks()
                self.setVerbatimAlg(4, "all habits cleared")
                return
            case _:
                if ear.__contains__("clear"):
                    self._temp = self._clearCmdBreaker(ear)
                    if self._todo.containsTask(self._temp):
                        self._todo.clearTask(self._temp)
                        self.setVerbatimAlg(4, f'{self._temp} task cleared')
                        self._temp = ""

 
Top