Exemplo n.º 1
0
        public string ToPromela()
        {
            StringBuilder buf = new StringBuilder();

            if (Lhs is ArithmeticExpression)
            {
                buf.Append("(" + IntLhs ?? Lhs.ToPromela() + ")");
            }
            else
            {
                buf.Append(IntLhs == null ? Lhs.ToPromela() : IntLhs.ToString());
            }

            switch (Operator)
            {
            case PromelaArithmeticOperator.PLUS: buf.Append(" + "); break;

            case PromelaArithmeticOperator.MINUS: buf.Append(" - "); break;

            case PromelaArithmeticOperator.TIMES: buf.Append(" * "); break;

            case PromelaArithmeticOperator.DIVIDES: buf.Append(" / "); break;
            }

            if (Rhs is ArithmeticExpression)
            {
                buf.Append("(" + IntRhs ?? Rhs.ToPromela() + ")");
            }
            else
            {
                buf.Append(IntRhs == null ? Rhs.ToPromela() : IntRhs.ToString());
            }

            return(buf.ToString());
        }
Exemplo n.º 2
0
        public string ToPromela()
        {
            StringBuilder buf = new StringBuilder();

            bool lparant = false;

            if (Lhs is CompositeCondition)
            {
                if ((Lhs as CompositeCondition).Op != Op)
                {
                    lparant = true;
                }
            }

            bool rparant = false;

            if (Rhs is CompositeCondition)
            {
                if ((Rhs as CompositeCondition).Op != Op)
                {
                    rparant = true;
                }
            }

            if (lparant)
            {
                buf.Append("(");
            }
            buf.Append(Lhs.ToPromela());
            if (lparant)
            {
                buf.Append(")");
            }
            buf.Append(" ").Append(LogicalOpToString(Op)).Append(" ");
            if (rparant)
            {
                buf.Append("(");
            }
            buf.Append(Rhs.ToPromela());
            if (rparant)
            {
                buf.Append(")");
            }
            return(buf.ToString());
        }