Ejemplo n.º 1
0
        public object AsObject()
        {
            switch (TypeCode)
            {
            case ElaTypeCode.Boolean: return(I4 == 1);

            case ElaTypeCode.Char: return((Char)I4);

            case ElaTypeCode.Double: return(Ref.AsDouble());

            case ElaTypeCode.Integer: return(I4);

            case ElaTypeCode.Long: return(Ref.AsLong());

            case ElaTypeCode.Single: return(DirectGetSingle());

            case ElaTypeCode.String: return(DirectGetString());

            case ElaTypeCode.Unit: return(null);

            case ElaTypeCode.Lazy:
                return(Ref.Force(this, ElaObject.DummyContext).Ref);

            default:
                return(Ref);
            }
        }
Ejemplo n.º 2
0
 internal double GetDouble()
 {
     return(TypeCode == ElaTypeCode.Double ? Ref.AsDouble() :
            TypeCode == ElaTypeCode.Single ? DirectGetSingle() :
            TypeCode == ElaTypeCode.Long ? Ref.AsLong() :
            (Double)I4);
 }
Ejemplo n.º 3
0
        public double AsDouble()
        {
            if (TypeCode == ElaTypeCode.Double)
            {
                return(Ref.AsDouble());
            }

            throw InvalidCast(typeof(Double));
        }
Ejemplo n.º 4
0
        internal int GetInt()
        {
            if (TypeCode == ElaTypeCode.Long)
            {
                return((Int32)Ref.AsLong());
            }
            else if (TypeCode == ElaTypeCode.Double)
            {
                return((Int32)Ref.AsDouble());
            }
            else if (TypeCode == ElaTypeCode.Single)
            {
                return((Int32)DirectGetSingle());
            }

            return(I4);
        }
Ejemplo n.º 5
0
        internal long GetLong()
        {
            if (TypeCode == ElaTypeCode.Long)
            {
                return(Ref.AsLong());
            }
            else if (TypeCode == ElaTypeCode.Double)
            {
                return((Int64)Ref.AsDouble());
            }
            else if (TypeCode == ElaTypeCode.Single)
            {
                return((Int64)DirectGetSingle());
            }

            return((Int64)I4);
        }
Ejemplo n.º 6
0
        internal float GetSingle()
        {
            if (TypeCode == ElaTypeCode.Integer)
            {
                return((Single)I4);
            }
            else if (TypeCode == ElaTypeCode.Long)
            {
                return((Single)Ref.AsLong());
            }
            else if (TypeCode == ElaTypeCode.Double)
            {
                return((Single)Ref.AsDouble());
            }

            return(DirectGetSingle());
        }