/// <summary> /// Constructs the expression representing the given statement /// </summary> /// <param name="statement"></param> /// <returns></returns> public static List<ExpressionMemberContainer> ParseExpression(MissionStatement statement) { List<ExpressionMemberContainer> newExpression = new List<ExpressionMemberContainer>(); Append(statement, Root, newExpression); return newExpression; }
/// <summary> /// Constructs the expression representing the given statement /// </summary> /// <param name="statement"></param> /// <returns></returns> public static List <ExpressionMemberContainer> ParseExpression(MissionStatement statement) { List <ExpressionMemberContainer> newExpression = new List <ExpressionMemberContainer>(); Append(statement, Root, newExpression); return(newExpression); }
/// <summary> /// Appends expression members from the specified list of ExpressionMemebers to the specified list of ExpressionMemberContainers /// </summary> /// <param name="what"></param> /// <param name="where"></param> private static void Append(MissionStatement statement, List<ExpressionMember> what, List<ExpressionMemberContainer> where) { foreach (ExpressionMember item in what) { ExpressionMemberContainer nEMC = new ExpressionMemberContainer(item, statement); where.Add(nEMC); if (item as ExpressionMemberCheck == null) continue; Append(statement, ((ExpressionMemberCheck)item).PossibleExpressions[nEMC.Decide()], where); } }
/// <summary> /// Appends expression members from the specified list of ExpressionMemebers to the specified list of ExpressionMemberContainers /// </summary> /// <param name="what"></param> /// <param name="where"></param> private static void Append(MissionStatement statement, List <ExpressionMember> what, List <ExpressionMemberContainer> where) { foreach (ExpressionMember item in what) { ExpressionMemberContainer nEMC = new ExpressionMemberContainer(item, statement); where.Add(nEMC); if (item as ExpressionMemberCheck == null) { continue; } string key = nEMC.Decide(); List <ExpressionMember> toAppend = ((ExpressionMemberCheck)item).PossibleExpressions[key]; Append(statement, toAppend, where); } }
public ExpressionMemberContainer(ExpressionMember member, MissionStatement statement) { Member = member; Statement = statement; }