Ejemplo n.º 1
0
        internal static string ToString(string str1, string str2, TwoOperatorType v)
        {
            switch (v)
            {
            case TwoOperatorType.Plus:
            case TwoOperatorType.Minus:
                return($"{str1} {ToChar(v)} {str2}");

            case TwoOperatorType.Multiply:
            case TwoOperatorType.Divide:
            case TwoOperatorType.Pow:
                return($"{str1}{ToChar(v)}{str2}");

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        internal static bool IsSequence(TwoOperatorType v)
        {
            switch (v)
            {
            case TwoOperatorType.Minus:
            case TwoOperatorType.Divide:
            case TwoOperatorType.Pow:
                return(true);

            case TwoOperatorType.Plus:
            case TwoOperatorType.Multiply:
                return(false);

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 3
0
        internal static int GetPriority(TwoOperatorType v)
        {
            switch (v)
            {
            case TwoOperatorType.Plus:
            case TwoOperatorType.Minus:
                return(1);

            case TwoOperatorType.Multiply:
            case TwoOperatorType.Divide:
                return(2);

            case TwoOperatorType.Pow:
                return(3);

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 4
0
        internal static char ToChar(TwoOperatorType v)
        {
            switch (v)
            {
            case TwoOperatorType.Plus:
                return('+');

            case TwoOperatorType.Minus:
                return('-');

            case TwoOperatorType.Multiply:
                return('*');

            case TwoOperatorType.Divide:
                return('/');

            case TwoOperatorType.Pow:
                return('^');

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 5
0
 internal static Block Create(Block a, Block b, TwoOperatorType type)
 {
     return(new TwoOperatorBlock(a, b, type));
 }
Ejemplo n.º 6
0
 private TwoOperatorBlock(Block a, Block b, TwoOperatorType type)
 {
     this.a    = a;
     this.b    = b;
     this.type = type;
 }