Пример #1
0
        public override bool Equals(ExpressionAtom other)
        {
            if (AtomType != other.AtomType)
            {
                return(false);
            }
            var tmp = (SubExpressionAtom)other;

            return(Expression == tmp.Expression);
        }
Пример #2
0
        public override bool Equals(ExpressionAtom other)
        {
            if (AtomType != other.AtomType)
            {
                return(false);
            }
            var tmp = (StaticAtom)other;

            return(Value == tmp.Value);
        }
Пример #3
0
        public override bool Equals(ExpressionAtom other)
        {
            if (AtomType != other.AtomType)
            {
                return(false);
            }
            var tmp = (RegisterAtom)other;

            return(Register == tmp.Register);
        }
        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");
                }
            }
        }