예제 #1
0
        public FilterRecord(FieldFilter filter)
        {
            Name        = filter.ID;
            Comparison  = filter.Comparison;
            LookupIndex = MemoryCoordinator.RegisterStaticInteger(filter.Value);
            RuleIndex   = filter.RuleIndex;
            SwitchValue = 0;

            var protocolSwitch = filter.Parent.Parent.Switch;

            if (protocolSwitch == null)
            {
                return;
            }

            //need to check for empty protocols, and give these a switch of 0
            if (protocolSwitch.Cases.Select(c => c.Filter).ToList().Contains(Name))
            {
                SwitchValue = ProtocolLibrary.GetProtocol(protocolSwitch.Cases.Find(switchCase => switchCase.Filter == Name).Protocol).Identifier;
            }
        }
        public MultTransaction(MultiplicationString input)
        {
            this.Transactions = new List <ExpressionReadTransaction>();
            foreach (var a in input.List)
            {
                if (a.List.Count == 1)
                {
                    ExpressionAtom            atom = a.List[0];
                    ExpressionReadTransaction tmp;
                    switch (atom.AtomType)
                    {
                    case ExpressionAtomType.Static:
                        var stat = (StaticAtom)atom;
                        tmp = new ExpressionReadTransaction(ExprInLoc.Lookup, MemoryCoordinator.RegisterStaticInteger(stat.Value));
                        break;

                    case ExpressionAtomType.Register:
                        var sysreg = (RegisterAtom)atom;
                        tmp = new ExpressionReadTransaction(ExprInLoc.SystemReg, sysreg.RegisterValue);
                        break;

                    case ExpressionAtomType.SubExpression:
                        var sub = (SubExpressionAtom)atom;
                        tmp = new ExpressionReadTransaction(ExprInLoc.RegisterBank, sub.Expression.RegisterIndex);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    Transactions.Add(tmp);
                }
                else
                {
                    throw new Exception("AddTransaction Error: Subtraction not supported in simple strings");
                }
            }
        }