package com.qiwu.chatbotbackend.entity; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; /** * 保存配置文件每一行(单行)解析后的信息的实体类。 * 独立于引擎的另一种condition */ public class Action { public int priority = -1; public int activePriority = 0; //如果本condition被其他condition激活 public int auxiliaryPriority = 0; //用于priority一样时人为设置的辅助优先级 public HashSet keywordSet = new HashSet(); public HashMap> historyPremise = new HashMap>(); public HashMap> currentPremise = new HashMap>(); public HashMap updateKnowledge = new LinkedHashMap(); public String[] answer = {"",}; public String nextStep = ""; public HashMap featureMap = new HashMap(); public String indexName = ""; public int id = 0; public String configName = ""; public 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.activePriority = originAction.activePriority + basePriority + 1; //激活会多一个优先级 //如果激活originAction的action,它的辅助优先级高于originAction,那么。。 if(baseAuxiliaryPriority > originAction.auxiliaryPriority) this.auxiliaryPriority = baseAuxiliaryPriority; else this.auxiliaryPriority = originAction.auxiliaryPriority; } public Action() { } }