Exemplo n.º 1
0
        public List <Dictionary <string, object> > ProcessInstructions()
        {
            bool firstRun   = true;
            bool whereState = false;

            foreach (KeyValuePair <int, WhereInstruction> whereInstruction in whereInstructions)
            {
                whereState = whereInstruction.Value.Process(ref _queryableScriptableObjectCollection.FilterableScriptableObjects);
                if (whereInstruction.Key == whereInstructions.Count - 1)
                {
                    break;
                }
                int conditionalKey = whereInstruction.Key;
                IConditionalOperator conditionalType = conditionalOperators[conditionalKey];

                // previous where statement is true and is followed by an OR
                if (whereState && conditionalOperators[conditionalKey].GetType() == typeof(OrConditionalOperator))
                {
                    break;
                }

                // previous where statement is false and is followed by an OR
                if (!whereState && conditionalOperators[conditionalKey].GetType() == typeof(OrConditionalOperator))
                {
                    // TODO reset the data back to its original state
                    _queryableScriptableObjectCollection.Reset();
                    continue;
                }

                // previous where statement is false and is followed by an And
                if (!whereState && conditionalOperators[conditionalKey].GetType() == typeof(AndConditionalOperator))
                {
                    continue;
                }
            }

            return(BuildQueryResult(_queryableScriptableObjectCollection.FilterableScriptableObjects));
        }
Exemplo n.º 2
0
 public void AddConditionalOperator(IConditionalOperator conditionalOperator)
 {
     conditionalOperators.Add(this.condtionalInstructionIndex, conditionalOperator);
     this.condtionalInstructionIndex++;
 }