Swift:
class Log:UniqueItemsPriorityQue {
/// chronological log of inputs
private var lastWithdrawal:String = ""
override func peak() -> String {
/// get last memory
lastWithdrawal = super.peak()
return lastWithdrawal
}
override func getRndItem() -> String {
/// get random memory
lastWithdrawal = super.getRndItem()
return lastWithdrawal
}
@discardableResult
func removeLastWithdrawal() ->String{
/// remove last processed memory
deleteStr(str1: self.lastWithdrawal)
let temp = lastWithdrawal
lastWithdrawal = ""
return temp
}
override func poll() -> String {
return peak()
}
}
class AXListeaNLearn{
/// this module learn places, items and persons relevant to the skill's goal
/// by listening to people
let logNegative:Log
let logPossitive:Log
init(logMinus:Log, logPlus:Log) {
self.logNegative = logMinus
self.logPossitive = logPlus
}
// learnability mutation = true
func forget() {
/// an algorithm using the item, failed (reported by a Learnability class or a cloudian object)
/// and so it will be moved to the lies Log
let temp = logPossitive.removeLastWithdrawal()
logNegative.input(in1: temp)
}
func clearNegativeLog() {
/// clear memory of lies and failed items
/// this can be done once in a time period
/// allowing for reconsideration of items that didn't work in the past
/// but may work in the future
logNegative.clearData()
}
func peak() -> String {
// get 1st item from assumed working items, log
return logPossitive.peak()
}
func RndPeak() -> String {
// get random item from assumed working items, log
return logPossitive.getRndItem()
}
/// new data should be aquired via a regex for the verb/verb that correspond to
/// the skill using the module
func insert(str1:String) {
// failed data AKA a lie is not accepted
if !logNegative.contains(str: str1){
logPossitive.input(in1: str1)
}
}
}