package com.qiwu.chatbotbackend.entity; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; /** * 保存配置文件每一行(单行)解析后的信息的实体类。 * 独立于引擎的另一种condition */ public class Action { private int priority = -1; //public int activePriority = 0; //如果本condition被其他condition激活 private int auxiliaryPriority = 0; //用于priority一样时人为设置的辅助优先级 private HashSet keywordSet = new HashSet(); private HashMap> historyPremise = new HashMap>(); private HashMap> currentPremise = new HashMap>(); private HashMap updateKnowledge = new LinkedHashMap(); private String[] answer = {"",}; private String nextStep = ""; private HashMap featureMap = new HashMap(); private String indexName = ""; private int id = 0; private String configName = ""; private String status = "waiting"; //public ArrayList indexName = new ArrayList(); public Action(int priority) { this.priority = priority; //this.activePriority = priority; } /** * * @param originAction 这个action的初始状态 * @param basePriority 激活originAction的action的条件数量 * @param baseAuxiliaryPriority 激活originAction的action的辅助优先级 */ public Action(Action originAction, int basePriority, int baseAuxiliaryPriority) { this.priority = originAction.priority; this.keywordSet = originAction.keywordSet; this.historyPremise = originAction.historyPremise; this.currentPremise = originAction.currentPremise; this.answer = originAction.answer; this.nextStep = originAction.nextStep; this.featureMap = originAction.featureMap; this.updateKnowledge = originAction.updateKnowledge; this.indexName = originAction.indexName; this.id = originAction.id; this.configName = originAction.configName; this.status = originAction.status; this.priority = originAction.priority + basePriority + 1; //如果激活的配置没有条件 this.auxiliaryPriority = originAction.auxiliaryPriority + baseAuxiliaryPriority; //优先级为两者之和 // //如果激活originAction的action,它的辅助优先级高于originAction,那么。。 // if(baseAuxiliaryPriority > originAction.auxiliaryPriority) // this.auxiliaryPriority = baseAuxiliaryPriority; // else // this.auxiliaryPriority = originAction.auxiliaryPriority; // // this.auxiliaryPriority = this.getAuxiliaryPriority() + 1; } public Action() { } public int getPriority() { return priority; } public int getAuxiliaryPriority() { return auxiliaryPriority; } public void setPriority(int priority) { this.priority = priority; } public void setAuxiliaryPriority(int auxiliaryPriority) { this.auxiliaryPriority = auxiliaryPriority; } public HashSet getKeywordSet() { return keywordSet; } public HashMap> getHistoryPremise() { return historyPremise; } public HashMap> getCurrentPremise() { return currentPremise; } public HashMap getUpdateKnowledge() { return updateKnowledge; } public String[] getAnswer() { return answer; } public String getNextStep() { return nextStep; } public HashMap getFeatureMap() { return featureMap; } public String getIndexName() { return indexName; } public int getId() { return id; } public String getConfigName() { return configName; } public String getStatus() { return status; } public void setKeywordSet(HashSet keywordSet) { this.keywordSet = keywordSet; } public void setHistoryPremise(HashMap> historyPremise) { this.historyPremise = historyPremise; } public void setCurrentPremise(HashMap> currentPremise) { this.currentPremise = currentPremise; } public void setUpdateKnowledge(HashMap updateKnowledge) { this.updateKnowledge = updateKnowledge; } public void setAnswer(String[] answer) { this.answer = answer; } public void setNextStep(String nextStep) { this.nextStep = nextStep; } public void setFeatureMap(HashMap featureMap) { this.featureMap = featureMap; } public void setIndexName(String indexName) { this.indexName = indexName; } public void setId(int id) { this.id = id; } public void setConfigName(String configName) { this.configName = configName; } public void setStatus(String status) { this.status = status; } }