Esempio n. 1
0
        public override ISCType Add(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value + obj.GetValueAs <long>()));
            }

            if (obj.IsOfType <SC_String>())
            {
                return(new SC_String(value + obj.GetValueAs <string>()));
            }

            throw new ArgumentException($"you cant add {obj.GetType()} to a long");
        }
Esempio n. 2
0
        public override ISCType Multiply(ISCType obj)
        {
            if (obj.IsOfType <SC_Int>())
            {
                return(new SC_Long(value * obj.GetValueAs <int>()));
            }

            if (obj.IsOfType <SC_Long>())
            {
                return(new SC_Long(value * obj.GetValueAs <long>()));
            }

            throw new ArgumentException("Sorry you cant multiply a string with an int");
        }
Esempio n. 3
0
        public override ISCType Add(ISCType obj)
        {
            if (obj.IsOfType <SC_Int>())
            {
                return(new SC_Int(value + obj.GetValueAs <int>()));
            }

            if (obj.IsOfType <SC_Long>())
            {
                return(new SC_Long(value + obj.GetValueAs <long>()));
            }

            return(new SC_String(value.ToString() + obj.GetValueAs <string>()));
        }
Esempio n. 4
0
        public override ISCType Subtract(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value - obj.GetValueAs <long>()));
            }

            throw new ArgumentException($"you cant subtract {obj.GetType()} to a long");
        }
Esempio n. 5
0
        public override ISCType Multiply(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                return(new SC_Long(value * obj.GetValueAs <long>()));
            }

            throw new ArgumentException($"you cant multiply {obj.GetType()} to a long");
        }
Esempio n. 6
0
        public override ISCType Multiply(ISCType obj)
        {
            if (obj.IsOfType <SC_Int, SC_Long>())
            {
                string s = "";

                for (int i = 0; i < obj.GetValueAs <int>(); i++)
                {
                    s += value;
                }

                return(new SC_String(s));
            }

            throw new ArgumentException("You cant multiply two strings together!");
        }
Esempio n. 7
0
 public override bool IsLower(ISCType obj)
 {
     return(obj.IsOfType <SC_Int, SC_Long>() && value < obj.GetValueAs <long>());
 }
Esempio n. 8
0
 public override bool IsEqual(ISCType obj)
 {
     return(obj.IsOfType <SC_Long, SC_Int>() && obj.GetValueAs <long>() == value);
 }
Esempio n. 9
0
 public override bool IsEqual(ISCType obj)
 {
     return(obj.IsOfType <SC_String>() && obj.GetValueAs <string>().Equals(value));
 }