Ejemplo n.º 1
0
        public override SIUnit Add(SIUnit x)
        {
            if(x is Area)
                return new Area(_value + x.Value);

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 2
0
        public override SIUnit Multiply(SIUnit x)
        {
            if (x is Length)
            {
                return new Area(_value * x.Value);
            }

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 3
0
        public override SIUnit Subtract(SIUnit x)
        {
            if(x is Length)
                return new Length(_value - x.Value);

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 4
0
        public override dynamic Divide(SIUnit x)
        {
            if (x is Length)
            {
                return _value/x.Value;
            }

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 5
0
        public override SIUnit Modulo(SIUnit x)
        {
            if(x is Length)
                return new Length(_value % x.Value);

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 6
0
        public override SIUnit Multiply(SIUnit x)
        {
            if (x is Length)
            {
                //return a volume
                return new Volume(_value * x.Value);
            }

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 7
0
 public override SIUnit Multiply(SIUnit x)
 {
     throw new UnitsException(GetType(), x.GetType());
 }
Ejemplo n.º 8
0
        public override SIUnit Modulo(SIUnit x)
        {
            if (x is Volume)
            {
                return new Volume(_value % x.Value);
            }

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 9
0
        public override dynamic Divide(SIUnit x)
        {
            if (x is Length)
            {
                return new Area(_value/x.Value);
            }
            else if (x is Area)
            {
                return new Length(_value/x.Value);
            }

            throw new UnitsException(GetType(), x.GetType());
        }
Ejemplo n.º 10
0
        public override dynamic Divide(SIUnit x)
        {
            if (x is Area)
            {
                //return a double
                return _value/x.Value;
            }

            if (x is Length)
            {
                //return length
                return new Length(_value/x.Value);
            }

            throw new UnitsException(GetType(), x.GetType());
        }