示例#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);
            }
        }
示例#2
0
 internal double GetDouble()
 {
     return(TypeCode == ElaTypeCode.Double ? Ref.AsDouble() :
            TypeCode == ElaTypeCode.Single ? DirectGetSingle() :
            TypeCode == ElaTypeCode.Long ? Ref.AsLong() :
            (Double)I4);
 }
示例#3
0
        public double AsDouble()
        {
            if (TypeCode == ElaTypeCode.Double)
            {
                return(Ref.AsDouble());
            }

            throw InvalidCast(typeof(Double));
        }
示例#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);
        }
示例#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);
        }
示例#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());
        }