public ReleasesExpression(string line) : base(line) { var tokens = line.Trim().Split(' '); AdeSystem.Actions.Add(tokens[0]); ActionName = tokens[0]; AdeSystem.Fluents.Add(tokens.Last().Replace("!", "")); if (line.Contains(" by ")) { Executor = FluentParser.GetSubstring(line, " by ", " releases "); AdeSystem.Executors.Add(Executor); } if (line.Contains(" if ")) { var con = line.Substring(line.IndexOf("if") + 2).Trim(); Conditions = LogicFormulaParser.GetConditions(con); Effects.Add(FluentParser.GetSubstring(line, " releases ", " if ")); } else { Effects.Add(FluentParser.GetSubstring(line, " releases ")); } }
public PreservesExpression(string line) : base(line) { var tokens = line.Trim().Split(' '); AdeSystem.Actions.Add(tokens[0]); ActionName = tokens[0]; if (line.Contains(" by ")) { ExecutorName = FluentParser.GetSubstring(line, " by ", " preserves").Trim(); AdeSystem.Executors.Add(ExecutorName); } if (line.Contains(" if ")) { Fluent = FluentParser.GetSubstring(line, " preserves ", " if "); var con = FluentParser.GetSubstring(line, " if "); List <string> litVal; List <Token> lit; var exp = LogicFormulaParser.Parse(con, out lit, out litVal); Fluents = LogicFormulaParser.GetConditions(con); } else { Fluent = FluentParser.GetSubstring(line, " preserves "); } }
public AfterExpression(string line) : base(line) { var conditions = line.Substring(0, line.IndexOf("after")).Trim(); List <string> litValues; List <Token> literals; var expression = LogicFormulaParser.Parse(conditions, out literals, out litValues); Fluents = LogicFormulaParser.GetFluentStrings(expression); if (line.Contains("by")) { ActionsString = FluentParser.GetSubstring(line, " after ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by "); } else { ActionsString = FluentParser.GetSubstring(line, " after "); char[] tab = new char[] { ',' }; var len = ActionsString.Split().Length; List <string> l = new List <string>(); for (int i = 0; i < len; i++) { l.Add("epsilon"); } ExecutorsString = String.Join(", ", l); } }
public InvolvedQuery(string line) : base(line) { ExecutorString = FluentParser.GetSubstring(line, " involved ", " in "); ActionsString = FluentParser.GetSubstring(line, " in ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by "); }
public CausesExpression(string line) : base(line) { var tokens = line.Trim().Split(' '); AdeSystem.Actions.Add(tokens[0]); ActionName = tokens[0]; var ef = FluentParser.GetSubstring(line, " causes "); Effects = LogicFormulaParser.GetConditions(ef); AdeSystem.Fluents.Add(tokens.Last().Replace("!", "")); }
public AccessibleQuery(string line) : base(line) { if (line.Contains("from")) { GoalString = FluentParser.GetConditions(LogicFormulaParser.GetConditions(FluentParser.GetSubstring(line, " accessible ", " from "))); var conditions = FluentParser.GetSubstring(line, " from "); List <string> litValues; List <Token> literals; var expression = LogicFormulaParser.Parse(conditions, out literals, out litValues); ConditionsStrings = FluentParser.GetConditions(LogicFormulaParser.GetConditions(conditions)); } else { GoalString = FluentParser.GetSubstring(line, " accessible "); } }
public ExecutableQuery(string line) : base(line) { if (line.Contains("from")) { ActionsString = FluentParser.GetSubstring(line, " executable ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by ", " from "); var conditions = FluentParser.GetSubstring(line, " from "); List <string> litValues; List <Token> literals; var expression = LogicFormulaParser.Parse(conditions, out literals, out litValues); ConditionsStrings = FluentParser.GetConditions(LogicFormulaParser.GetConditions(conditions)); } else { ActionsString = FluentParser.GetSubstring(line, " executable ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by "); } }
public AfterQuery(string line, string prefix) : base(line) { line = line.ToLower(); if (line.Contains("from")) { GoalString = FluentParser.GetSubstring(line, prefix + " ", " after "); ActionsString = FluentParser.GetSubstring(line, " after ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by ", " from "); var conditions = FluentParser.GetSubstring(line, " from "); List <string> litValues; List <Token> literals; var expression = LogicFormulaParser.Parse(conditions, out literals, out litValues); ConditionsStrings = FluentParser.GetConditions(LogicFormulaParser.GetConditions(conditions)); GoalString = GoalString.Replace("&", ",").Replace("!", "not_"); } else { GoalString = FluentParser.GetSubstring(line, " always ", " after "); ActionsString = FluentParser.GetSubstring(line, " after ", " by "); ExecutorsString = FluentParser.GetSubstring(line, " by "); } }