public WhereClause AddWhere(LogicOperator logicalOperator, string field, string fromValue, string toValue, int level)
        {
            WhereClause NewWhereClause = new BetweenWhereClause(logicalOperator, field, fromValue, toValue, level);

            _whereStatement.Add(NewWhereClause);
            return(NewWhereClause);
        }
Example #2
0
        // Add object group to symbol table
        internal void AddObjectDef(string name, IList <string> others, LogicOperator oper)
        {
            var sym = CollectObjects(others.Select(o => ParseSymbol(o)).ToList());

            sym.Name = name;

            // if it's a collection of all objects then make a decision
            if (sym.Kind == SymbolKind.Real && sym.ObjectIds.Count > 1)
            {
                sym.Kind = (oper == LogicOperator.And) ? SymbolKind.Aggregate : SymbolKind.Property;
            }

            // these are bad, otherwise use whatever we have
            if ((oper == LogicOperator.And && sym.Kind != SymbolKind.Aggregate) ||
                (oper == LogicOperator.Or && sym.Kind != SymbolKind.Property))
            {
                CompileError("incompatible symbols: {0}", others.Join());
            }
            _symbols[name] = sym;
            var decode = name.All(c => (int)c <= 255) ? ""
        : " (" + name.Select(c => ((int)c).ToString("X")).Join() + ")";

            DebugLog("Define '{0}'{1}: {2} <{3}>",
                     name, decode, sym.Kind, sym.ObjectIds.Select(o => _gamedef.ShowName(o)).Join());
        }
        internal static string GenCondition(List <ConditionList> condlist, LogicOperator logic)
        {
            string Cond       = "";
            string logiccHead = logic.ToString();

            foreach (var item in condlist)
            {
                var SubCond = "";
                foreach (var item1 in item.CondList)
                {
                    string logicc = item.Logic.ToString();
                    if (item.CondList.LastOrDefault().Equals(item1))
                    {
                        logicc = "";
                    }
                    SubCond += CreateComparisonClause(item1.Key, item1.Operator, item1.Value) + $" {logicc} ";
                }
                if (condlist.LastOrDefault().Equals(item))
                {
                    logiccHead = "";
                }
                Cond += "(" + SubCond + ")" + logiccHead.ToString();
            }
            return(Cond);
        }
        public static FormulaNode JoinTerms(LogicOperator op, List <FormulaNode> terms)
        {
            FormulaNode result;

            if (terms.Count == 0)
            {
                if (op == LogicOperator.AND)
                {
                    return(new FormulaNode(FormulaNode.TRUE_LITERAL));
                }
                if (op == LogicOperator.OR)
                {
                    // Build FALSE as ~TRUE
                    result = new FormulaNode(LogicOperator.NOT);
                    result.SetChildren(new FormulaNode(FormulaNode.TRUE_LITERAL), null);
                    return(result);
                }

                throw new Exception("Join with unsupported logic operator");
            }


            if (terms.Count == 1)
            {
                return(terms[0]);
            }

            result = new FormulaNode(op, terms[0], terms[1]);
            foreach (var t in terms.GetRange(2, terms.Count - 2))
            {
                result = new FormulaNode(op, result, t);
            }

            return(result);
        }
Example #5
0
        public QueryFilter BuildQueryFilter(Type queryEntityType = null)
        {
            if (null == Filters || 1 > Filters.Count)
            {
                return(null);
            }

            LogicOperator logicOperator = String.Equals(Logic, "and", StringComparison.OrdinalIgnoreCase) ? LogicOperator.AndAlso : LogicOperator.OrElse;
            var           filterItems   = Filters.Where(f => null != f).Select(f => f.ToFilterItem()).ToArray();

            if (null == filterItems || 1 > filterItems.Length)
            {
                return(null);
            }

            if (null != queryEntityType)
            {
                var props = queryEntityType.GetProperties();
                foreach (var f in filterItems)
                {
                    f.Field = GetFieldName(f.Field, props);
                }
            }

            return(new QueryFilter(filterItems, logicOperator));
        }
        public string ParseLogicOperator(LogicOperator op)
        {
            string res = "";

            /*
             * AND,
             * OR,
             * NOTHING
             */
            switch (op)
            {
            case LogicOperator.OR:
                res = "OR";
                break;

            case LogicOperator.AND:
                res = "AND";
                break;

            case LogicOperator.NOTHING:
                res = "";
                break;

            default:
                res = "";
                break;
            }
            return(res);
        }
Example #7
0
        internal static string CreateBetweenClause(LogicOperator logicalOperator, string fieldName, string fromValue, string toValue, int CurrentLevel, int PreviousLevel)
        {
            string Output = "";

            if (PreviousLevel > CurrentLevel)
            {
                for (int i = 0; i < (PreviousLevel - CurrentLevel); i++)
                {
                    Output += ")";
                }

                Output += GetLogicalOperatorString(logicalOperator);
            }
            else
            {
                if (PreviousLevel < CurrentLevel)
                {
                    Output += GetLogicalOperatorString(logicalOperator);
                    for (int i = 0; i < (CurrentLevel - PreviousLevel); i++)
                    {
                        Output += "(";
                    }
                }
                else
                {
                    Output += GetLogicalOperatorString(logicalOperator);
                }
            }

            Output += fieldName + " between \"" + fromValue + "\" and \"" + toValue + "\"";
            return(Output);
        }
Example #8
0
		private static Filter CreateFilterLogic(LogicOperator logicOperator, Filter leftFilter, Filter rightFilter) {
			return new FilterLogic {
				Left = leftFilter,
				Right = rightFilter,
				LogicOperator = logicOperator
			};
		}
Example #9
0
 public SubClause(LogicOperator logic, Comparison compareOperator, object compareValue, string compareParam)
 {
     LogicOperator      = logic;
     ComparisonOperator = compareOperator;
     Value        = compareValue;
     CompareParam = compareParam;
 }
Example #10
0
 public FormulaNode(LogicOperator logicOp, string name)
 {
     //Useful for existential operators
     //e.g. Ay(...) -> forall y. (...)
     this.logicOp = logicOp;
     this.name    = name;
 }
Example #11
0
        //public WhereClause AddWhere(Enum field, Comparison @operator, object compareValue) { return AddWhere(logicalOperator, field.ToString(), @operator, compareValue, 1); }
        public WhereClause AddWhere(LogicOperator logicalOperator, string field, Comparison @operator, object compareValue, int level)
        {
            WhereClause NewWhereClause = new GeneralWhereClause(logicalOperator, field, @operator, compareValue, level);

            _whereStatement.Add(NewWhereClause);
            return(NewWhereClause);
        }
Example #12
0
        public static Node GenLogicNode(LogicOperator logop, Node left, Node right)
        {
            Type l = left.ContentType;
            Type r = right.ContentType;

            if (l == typeof(int))
            {
                if (r == typeof(int))
                {
                    return(new LogicNode <int, int>(logop, (ContentNode <int>)left, (ContentNode <int>)right));
                }
            }
            if (l == typeof(double))
            {
                if (r == typeof(double))
                {
                    return(new LogicNode <double, double>(logop, (ContentNode <double>)left, (ContentNode <double>)right));
                }
            }
            if (l == typeof(bool))
            {
                if (r == typeof(bool))
                {
                    return(new LogicNode <bool, bool>(logop, (ContentNode <bool>)left, (ContentNode <bool>)right));
                }
            }

            return(null);
        }
Example #13
0
 public TseytinBlock(int ticket, string left, string right, LogicOperator logicOp)
 {
     this.ticket  = ticket;
     this.left    = left;
     this.right   = right;
     this.logicOp = logicOp;
 }
        private Condition method_16(DataGridViewRow dataGridViewRow_0)
        {
            DataField tag = dataGridViewRow_0.Cells["clnField"].Tag as DataField;

            if ((tag != null) && (tag.DataType == FieldType.DataField))
            {
                Condition condition2;
                Condition condition3;
                DataField field2 = dataGridViewRow_0.Cells["clnValue"].Tag as DataField;
                if ((((tag.Name != null) && this.dictionary_2.TryGetValue(tag.Name, out condition2)) && ((field2 != null) && (field2.Name != null))) && this.dictionary_2.TryGetValue(field2.Name, out condition3))
                {
                    CompCondition condition = new CompCondition {
                        Name          = dataGridViewRow_0.Cells["clnName"].Value.ToString(),
                        LeftCondition = condition2
                    };
                    string        str       = dataGridViewRow_0.Cells["clnRel"].Value.ToString();
                    LogicOperator @operator = (LogicOperator)Enum.Parse(typeof(LogicOperator), str);
                    condition.Operator       = @operator;
                    condition.RightCondition = condition3;
                    condition.ValueType      = FieldType.DataField;
                    dataGridViewRow_0.Tag    = condition;
                    return(condition);
                }
            }
            return(null);
        }
Example #15
0
        public override Task <object[]> execute(IGame game, ICard card, IBuff buff, IEventArg eventArg, object[] args, object[] constValues)
        {
            LogicOperator op = (LogicOperator)constValues[0];

            switch (op)
            {
            case LogicOperator.not:
                return(Task.FromResult(new object[] { !(bool)args[0] }));

            case LogicOperator.and:
                foreach (var value in args.Cast <bool>())
                {
                    if (value == false)
                    {
                        return(Task.FromResult(new object[] { false }));
                    }
                }
                return(Task.FromResult(new object[] { true }));

            case LogicOperator.or:
                foreach (var value in args.Cast <bool>())
                {
                    if (value == true)
                    {
                        return(Task.FromResult(new object[] { true }));
                    }
                }
                return(Task.FromResult(new object[] { false }));

            default:
                throw new InvalidOperationException("未知的操作符" + op);
            }
        }
Example #16
0
        /// <summary>
        /// Adds the where.
        /// </summary>
        /// <param name="logicOperator">The logic operator.</param>
        /// <param name="field">The field.</param>
        /// <param name="operator">The operator.</param>
        /// <param name="compareValue">The compare value.</param>
        /// <returns>The where clause.</returns>
        public WhereClause AddWhere(LogicOperator logicOperator, string field, Comparison @operator, object compareValue)
        {
            var where = new WhereClause(logicOperator, field, @operator, compareValue);
            AddWhere(where);

            return(where);
        }
Example #17
0
 public Condition(LogicOperator logicOperator, string column, ComparisonOperator comparisonOperator, object value)
 {
     LogicOperator      = logicOperator;
     Column             = column;
     ComparisonOperator = comparisonOperator;
     Value = value;
 }
Example #18
0
        public WhereClause AddClause(LogicOperator logic, Comparison compareOperator, object compareValue)
        {
            var newSubClause = new SubClause(logic, compareOperator, compareValue);

            SubClauses.Add(newSubClause);
            return(this);
        }
Example #19
0
 public SearchCollection(string name, CriteriaOperator @operator, object value, bool isVarchar, LogicOperator logicContinue)
 {
     Name          = name;
     Operator      = @operator;
     Value         = value;
     IsVarchar     = isVarchar;
     LogicContinue = logicContinue;
 }
Example #20
0
        /// <summary>
        /// Adds the having.
        /// </summary>
        /// <param name="logicOperator">The logic operator.</param>
        /// <param name="field">The field.</param>
        /// <param name="operator">The operator.</param>
        /// <param name="compareValue">The compare value.</param>
        /// <returns>The where clause.</returns>
        public WhereClause AddHaving(LogicOperator logicOperator, string field, Comparison @operator, object compareValue)
        {
            var clause = new WhereClause(logicOperator, field, @operator, compareValue);

            AddHaving(clause);

            return(clause);
        }
Example #21
0
 public static WhereClause CreateContainer(LogicOperator logicOperator)
 {
     return(new WhereClause
     {
         IsContainerOnly = true,
         LogicOperator = logicOperator
     });
 }
Example #22
0
 public BetweenWhereClause(LogicOperator logicalOperator, string field, string fromValue, string toValue, int level)
 {
     base.LogicalOperator = logicalOperator;
     m_FieldName          = field;
     m_FromValue          = fromValue;
     m_ToValue            = toValue;
     base.Level           = level;
 }
Example #23
0
 public Where(string column, Condition condition, object value,
              LogicOperator logicOperator = LogicOperator.NULL)
 {
     Column        = column;
     Condition     = condition;
     Value         = value;
     LogicOperator = logicOperator;
 }
Example #24
0
 private static Filter CreateFilterLogic(LogicOperator logicOperator, Filter leftFilter, Filter rightFilter)
 {
     return(new FilterLogic {
         Left = leftFilter,
         Right = rightFilter,
         LogicOperator = logicOperator
     });
 }
Example #25
0
        public WhereClause Add(LogicOperator logicalOperator, string field, string fromValue, string toValue, int level, int index)
        {
            BetweenWhereClause NewWhereClause = new BetweenWhereClause(logicalOperator, field, fromValue, toValue, level);

            this.Insert(index, NewWhereClause);
            //this.AddWhereClauseToLevel(NewWhereClause, level);
            return(NewWhereClause);
        }
 public LogicOperation(byte _arg1, byte _arg2, LogicOperator _op, short _targetAddress, RegisterFileMap _registerFileMap, short _address)
     : base(_registerFileMap, CYCLES, _address)
 {
     this.arg1 = _arg1;
     this.arg2 = _arg2;
     this.op = _op;
     this.targetAddress = _targetAddress;
 }
Example #27
0
 public WhereClause(string field, Comparison firstCompareOperator, object firstCompareValue, LogicOperator firstLogicOperator)
 {
     m_FieldName          = field;
     m_ComparisonOperator = firstCompareOperator;
     m_Value         = firstCompareValue;
     m_LogicOperator = firstLogicOperator;
     SubClauses      = new List <SubClause>();
 }
Example #28
0
        public WhereClause Add(LogicOperator logicalOperator, string field, Comparison @operator, object compareValue, int level, int index)
        {
            GeneralWhereClause NewWhereClause = new GeneralWhereClause(logicalOperator, field, @operator, compareValue, level);

            this.Insert(index, NewWhereClause);
            //this.AddWhereClauseToLevel(NewWhereClause, level);
            return(NewWhereClause);
        }
 public SearchCollection(string name, CriteriaOperator @operator, string value, bool isVarchar, LogicOperator logicOp)
 {
     Name      = name;
     Operator  = @operator;
     Value     = value;
     IsVarchar = isVarchar;
     LogicOp   = logicOp;
 }
Example #30
0
 public BetweenWhereClause(LogicOperator logicalOperator, string field, string fromValue, string toValue, int level)
 {
     base.LogicalOperator = logicalOperator;
     m_FieldName = field;
     m_FromValue = fromValue;
     m_ToValue = toValue;
     base.Level = level;
 }
Example #31
0
 public WhereClause(string field, Comparison firstCompareOperator, object firstCompareValue, LogicOperator whereConnectorOperator)
 {
     FieldName          = field;
     ComparisonOperator = firstCompareOperator;
     Value = firstCompareValue;
     WhereConnectorOperator = whereConnectorOperator;
     SubClauses             = new List <SubClause>();
 }
Example #32
0
 public GeneralWhereClause(LogicOperator logicalOperator, string field, Comparison firstCompareOperator, object firstCompareValue, int level)
 {
     base.LogicalOperator = logicalOperator;
     m_FieldName = field;
     m_ComparisonOperator = firstCompareOperator;
     m_Value = firstCompareValue;
     base.Level = level;
     //SubClauses = new List<SubClause>();
 }
Example #33
0
 public WhereClause(LogicOperator logicOperator, string table, string column, ComparisonOperator comparisonOperator, object value)
 {
     this.LogicOperator      = logicOperator;
     this.Table              = table;
     this.Column             = column;
     this.ComparisonOperator = comparisonOperator;
     this.Value              = value;
     this.SubClauses         = new List <WhereClause>();
 }
Example #34
0
 public GeneralWhereClause(LogicOperator logicalOperator, string field, Comparison firstCompareOperator, object firstCompareValue, int level)
 {
     base.LogicalOperator = logicalOperator;
     m_FieldName          = field;
     m_ComparisonOperator = firstCompareOperator;
     m_Value    = firstCompareValue;
     base.Level = level;
     //SubClauses = new List<SubClause>();
 }
Example #35
0
 public WhereClause AddWhere(LogicOperator logicalOperator, string field, string fromValue, string toValue, int level)
 {
     WhereClause NewWhereClause = new BetweenWhereClause(logicalOperator, field, fromValue, toValue, level);
     _whereStatement.Add(NewWhereClause);
     return NewWhereClause;
 }
Example #36
0
 private string lgop(LogicOperator lop)
 {
     return lop == LogicOperator.And
                   ? "&&"
                   : "||";
 }
Example #37
0
 public LogicExpression(LogicTerm expr1, LogicTerm expr2, LogicOperator op)
 {
     Expression1 = expr1;
     Expression2 = expr2;
     Operator = op;
 }
Example #38
0
		public void AddClause(LogicOperator logic, Comparison compareOperator, object compareValue)
		{
			SubClause NewSubClause = new SubClause(logic, compareOperator, compareValue);
			SubClauses.Add(NewSubClause);
		}
Example #39
0
 public void addJoinCondition(LogicOperator logicOperator, Table fromTable, string fromColumnName, Comparison @operator, Table toTable, string toColumnName)
 {
     JoinCondition.Add(logicOperator, fromTable.AliasName + "." + fromColumnName, @operator, toTable.AliasName + "." + toColumnName, 0);
 }
		public static string Get(LogicOperator logicOperator) {
		    return logicOperator.ToString();
		}
        private bool PerformTest(LogicOperator logicOperator, params bool[] values)
        {
            var subjects = values.Select(_ => new Subject<bool>()).ToArray();

            var combined = logicOperator(subjects.First(), subjects.Skip(1).ToArray());
            bool? result = null;
            combined.Subscribe(c =>
            {
                result = c;
            });

            foreach (var keyValues in values.Zip(subjects, (value,subject) => new {value,subject}))
            {
               keyValues.subject.OnNext(keyValues.value);
            }
            return result.Value;
        }
Example #42
0
        public BaseOperation getNextOperation(short _codeAdress)
        {
            this.address = _codeAdress;

            // mask Operation-Byte --> xxxx xxxx 0000 0000
            short operation = (short)((short)programMemory[_codeAdress] & 0xFF00);
            // mask Parameter-Byte --> 0000 0000 xxxx xxxx
            short parameter = (short)((short)programMemory[_codeAdress] & 0x00FF);

            if (parameter < 0)
                throw new Exception("negative parameter");

            switch (operation)
            {
                /* ------------------------------------------------------ */
                /* -------- ARITHMETIC OPERATIONS ----------------------- */
                case ParserConstants.ADDWF:
                    // arithmetical operator
                    ArithOp = ArithmeticOperator.PLUS;
                    // target address
                    target = getTargetAddress(parameter);
                    // operating bytes
                    byte1 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    byte2 = registerFileMap.Get(getAddressFromParameter(parameter));
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                case ParserConstants.ADDLW_1:
                case ParserConstants.ADDLW_2:
                    ArithOp = ArithmeticOperator.PLUS;
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    byte1 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    byte2 = getLiteralFromParameter(parameter);
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                case ParserConstants.INCF:
                    ArithOp = ArithmeticOperator.PLUS;
                    target = getTargetAddress(parameter);
                    byte1 = 0x01;
                    byte2 = registerFileMap.Get(getAddressFromParameter(parameter));
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                case ParserConstants.SUBWF:
                    ArithOp = ArithmeticOperator.MINUS;
                    target = getTargetAddress(parameter);
                    byte1 = registerFileMap.Get(getAddressFromParameter(parameter));
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                case ParserConstants.SUBLW_1:
                case ParserConstants.SUBLW_2:
                    ArithOp = ArithmeticOperator.MINUS;
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    byte1 = getLiteralFromParameter(parameter);
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                case ParserConstants.DECF:
                    ArithOp = ArithmeticOperator.MINUS;
                    target = getTargetAddress(parameter);
                    byte1 = registerFileMap.Get(getAddressFromParameter(parameter));
                    byte2 = 0x01;
                    return new ArithmeticOperation(byte1, byte2, ArithOp, target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- BIT OPERATIONS ------------------------------ */
                case ParserConstants.BCF_1:
                case ParserConstants.BCF_2:
                case ParserConstants.BCF_3:
                case ParserConstants.BCF_4:
                    // bit operator
                    BitOp = BitOperator.BITCLEAR;
                    // target address
                    target = getAddressFromParameter(parameter);
                    // bit-number
                    bit = getBitNumberFromOperationCall(operation, parameter);
                    return new BitOperation(target, bit, BitOp, registerFileMap, address);
                case ParserConstants.BSF_1:
                case ParserConstants.BSF_2:
                case ParserConstants.BSF_3:
                case ParserConstants.BSF_4:
                    BitOp = BitOperator.BITSET;
                    target = getAddressFromParameter(parameter);
                    bit = getBitNumberFromOperationCall(operation, parameter);
                    return new BitOperation(target, bit, BitOp, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- CALL OPERATIONS ----------------------------- */
                case ParserConstants.CALL_1:
                case ParserConstants.CALL_2:
                case ParserConstants.CALL_3:
                case ParserConstants.CALL_4:
                case ParserConstants.CALL_5:
                case ParserConstants.CALL_6:
                case ParserConstants.CALL_7:
                case ParserConstants.CALL_8:
                    target = getTargetAddress(operation, parameter);
                    return new CallOperation(target, operationStack, programCounter, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- GOTO OPERATION ------------------------------ */
                case ParserConstants.GOTO_1:
                case ParserConstants.GOTO_2:
                case ParserConstants.GOTO_3:
                case ParserConstants.GOTO_4:
                case ParserConstants.GOTO_5:
                case ParserConstants.GOTO_6:
                case ParserConstants.GOTO_7:
                case ParserConstants.GOTO_8:
                    target = getTargetAddress(operation, parameter);
                    return new GotoOperation(target, programCounter, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- CLEAR OPERATIONS ---------------------------- */
                case ParserConstants.CLRF_CLRW:
                    target = getTargetAddress(parameter);
                    return new ClearOperation(target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- COMPLEMENT OPERATIONS ----------------------- */
                case ParserConstants.COMF:
                    target = getTargetAddress(parameter);
                    if (target == RegisterConstants.WORKING_REGISTER_ADDRESS)
                        return new ComplementOperation(getAddressFromParameter(parameter), target, registerFileMap, address);
                    else
                        return new ComplementOperation(target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- LOGIC OPERATIONS ---------------------------- */
                case ParserConstants.ANDWF:
                    LogOp = LogicOperator.AND;
                    target = getTargetAddress(parameter);
                    byte1 = registerFileMap.Get(getAddressFromParameter(parameter));
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                case ParserConstants.ANDLW:
                    LogOp = LogicOperator.AND;
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    byte1 = getLiteralFromParameter(parameter);
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                case ParserConstants.IORWF:
                    LogOp = LogicOperator.IOR;
                    target = getTargetAddress(parameter);
                    byte1 = registerFileMap.Get(getAddressFromParameter(parameter));
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                case ParserConstants.IORLW:
                    LogOp = LogicOperator.IOR;
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    byte1 = getLiteralFromParameter(parameter);
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                case ParserConstants.XORWF:
                    LogOp = LogicOperator.XOR;
                    target = getTargetAddress(parameter);
                    byte1 = registerFileMap.Get(getAddressFromParameter(parameter));
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                case ParserConstants.XORLW:
                    LogOp = LogicOperator.XOR;
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    byte1 = getLiteralFromParameter(parameter);
                    byte2 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                    return new LogicOperation(byte1, byte2, LogOp, target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- MOVE OPERATIONS ----------------------------- */
                case ParserConstants.MOVF:
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new MoveOperation(source, target, registerFileMap, address);
                case ParserConstants.MOVLW_1:
                case ParserConstants.MOVLW_2:
                case ParserConstants.MOVLW_3:
                case ParserConstants.MOVLW_4:
                    byte1 = getLiteralFromParameter(parameter);
                    target = RegisterConstants.WORKING_REGISTER_ADDRESS;
                    return new MoveOperation(byte1, target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- ROTATE OPERATIONS --------------------------- */
                case ParserConstants.RLF:
                    RotDir = RotationDirection.LEFT;
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new RotateOperation(source, target, RotDir, registerFileMap, address);
                case ParserConstants.RRF:
                    RotDir = RotationDirection.RIGHT;
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new RotateOperation(source, target, RotDir, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- SWAP OPERATIONS ----------------------------- */
                case ParserConstants.SWAPF:
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new SwapOperation(source, target, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- BIT TEST OPERATIONS ----------------------------- */
                case ParserConstants.DECFSZ:
                    TestOp = TestOperator.DECFSZ;
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new TestOperation(source, TestOp, target, programCounter, registerFileMap, address);
                case ParserConstants.INCFSZ:
                    TestOp = TestOperator.INCFSZ;
                    target = getTargetAddress(parameter);
                    source = getAddressFromParameter(parameter);
                    return new TestOperation(source, TestOp, target, programCounter, registerFileMap, address);
                case ParserConstants.BTFSC_1:
                case ParserConstants.BTFSC_2:
                case ParserConstants.BTFSC_3:
                case ParserConstants.BTFSC_4:
                    BitTestOp = BitTestOperator.BTFSC;
                    source = getAddressFromParameter(parameter);
                    bit = getBitNumberFromOperationCall(operation, parameter);
                    return new BitTestOperation(source, bit, BitTestOp, programCounter, registerFileMap, address);
                case ParserConstants.BTFSS_1:
                case ParserConstants.BTFSS_2:
                case ParserConstants.BTFSS_3:
                case ParserConstants.BTFSS_4:
                    BitTestOp = BitTestOperator.BTFSS;
                    source = getAddressFromParameter(parameter);
                    bit = getBitNumberFromOperationCall(operation, parameter);
                    return new BitTestOperation(source, bit, BitTestOp, programCounter, registerFileMap, address);
                /* ------------------------------------------------------ */

                /* ------------------------------------------------------ */
                /* -------- RETURN OPERATIONS --------------------------- */
                case ParserConstants.RETLW_1:
                case ParserConstants.RETLW_2:
                case ParserConstants.RETLW_3:
                case ParserConstants.RETLW_4:
                    RetOp = ReturnOperator.RETLW;
                    byte1 = getLiteralFromParameter(parameter);
                    return new ReturnOperation(programCounter, operationStack, RetOp, byte1, registerFileMap, address);
                /* ------------------------------------------------------ */

                case 0x0000:
                    if(parameter > 127)
                    {
                        // MOVWF
                        target = getAddressFromParameter(parameter);
                        byte1 = registerFileMap.Get(RegisterConstants.WORKING_REGISTER_ADDRESS);
                        return new MoveOperation(byte1, target, registerFileMap, address);
                    }
                    switch (parameter)
                    {
                        case ParserConstants.CLRWDT:
                            return new ClearWdtOperation(pic, registerFileMap, address);
                        case ParserConstants.RETFIE:
                            RetOp = ReturnOperator.RETFIE;
                            return new ReturnOperation(programCounter, operationStack, RetOp, registerFileMap, address);
                        case ParserConstants.RETURN:
                            RetOp = ReturnOperator.RETURN;
                            return new ReturnOperation(programCounter, operationStack, RetOp, registerFileMap, address);
                        case ParserConstants.SLEEP:
                            return new SleepOperation(pic, registerFileMap, address);
                        case ParserConstants.NOP_1:
                        case ParserConstants.NOP_2:
                        case ParserConstants.NOP_3:
                        case ParserConstants.NOP_4:
                            return new NopOperation(registerFileMap, address);
                        default:
                            break;
                    }
                    break;

                default:
                    throw new Exception("unknown operation");
            }

            throw new Exception("unknown error");
        }
Example #43
0
 //public WhereClause AddWhere(Enum field, Comparison @operator, object compareValue) { return AddWhere(logicalOperator, field.ToString(), @operator, compareValue, 1); }
 public WhereClause AddWhere(LogicOperator logicalOperator, string field, Comparison @operator, object compareValue, int level)
 {
     WhereClause NewWhereClause = new GeneralWhereClause(logicalOperator, field, @operator, compareValue, level);
     _whereStatement.Add(NewWhereClause);
     return NewWhereClause;
 }
 /// <summary>
 /// Sets the Logic Operator for the WHERE statement
 /// </summary>
 /// <param name="Operator"></param>
 public void SetWhereOperator(LogicOperator @Operator)
 {
     this.WhereStatement.StatementOperator = @Operator;
 }
Example #45
0
 public LogicChain(LogicOperator op)
 {
     op_ = op;
 }
Example #46
0
        public static Node GenLogicNode(LogicOperator logop, Node left, Node right)
        {
            Type l = left.ContentType;
            Type r = right.ContentType;

            if (l == typeof(int))
            {
                if (r == typeof(int))
                    return new LogicNode<int, int>(logop, (ContentNode<int>)left, (ContentNode<int>)right);
            }
            if (l == typeof(double))
            {
                if (r == typeof(double))
                {
                    return new LogicNode<double, double>(logop, (ContentNode<double>)left, (ContentNode<double>)right);
                }
            }
            if (l == typeof(bool))
            {
                if (r == typeof(bool))
                {
                    return new LogicNode<bool, bool>(logop, (ContentNode<bool>)left, (ContentNode<bool>)right);
                }
            }

            return null;
        }
Example #47
0
 //public void AddWhere(WhereClause clause) { AddWhere(clause, 1); }
 //public void AddWhere(WhereClause clause, int level)
 //{
 //    _whereStatement.Add(clause);
 //}
 public WhereClause AddWhere(LogicOperator logicalOperator, string field, Comparison @operator, object compareValue) { return AddWhere(logicalOperator, field, @operator, compareValue, 1); }
Example #48
0
 public InterTree(LogicOperator op)
 {
     _op = op;
     _isOperator = true;
 }
 /// <summary>
 /// Sets the Logic Operator for the WHERE statement
 /// </summary>
 /// <param name="Operator"></param>
 public void SetHavingOperator(LogicOperator @Operator)
 {
     this.HavingStatement.StatementOperator = @Operator;
 }
Example #50
0
 public virtual string GetLogicOperator(LogicOperator op)
 {
     switch (op) {
         case LogicOperator.And:
             return "and";
         case LogicOperator.Or:
             return "or";
     }
     return null;
 }
Example #51
0
			public SubClause(LogicOperator logic, Comparison compareOperator, object compareValue)
			{
				LogicOperator = logic;
				ComparisonOperator = compareOperator;
				Value = compareValue;
			}