Ejemplo n.º 1
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     try  {
         return(new IntegerData(int.Parse(data.value_Renamed)));
     }
     catch (FormatException nfe)
     {
         throw new InvalidOperationException("Invalid cast of data [" + data.value_Renamed + "] to type Decimal");
     }
 }
Ejemplo n.º 2
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     try
     {
         return(new DecimalData(Double.Parse(data.value_Renamed)));
     }
     catch (FormatException nfe)
     {
         throw new ArgumentException("Invalid cast of data [" + data.Value + "] to type Decimal");
     }
 }
Ejemplo n.º 3
0
 public virtual IntegerData cast(UncastData data)
 {
     try
     {
         return(new IntegerData(System.Int32.Parse(data.value_Renamed)));
     }
     catch (System.FormatException nfe)
     {
         throw new System.ArgumentException("Invalid cast of data [" + data.value_Renamed + "] to type Decimal");
     }
 }
Ejemplo n.º 4
0
 public virtual LongData cast(UncastData data)
 {
     try
     {
         return(new LongData(System.Int64.Parse(data.value_Renamed)));
     }
     catch (System.FormatException nfe)
     {
         throw new System.ArgumentException("Invalid cast of data [" + data.value_Renamed + "] to type Long");
     }
 }
Ejemplo n.º 5
0
        IAnswerData IAnswerData.cast(UncastData data)
        {
            System.DateTime ret = DateUtils.parseTime(data.value_Renamed);
            //UPGRADE_TODO: The 'System.DateTime' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
            if (ret != null)
            {
                //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'"
                return(new TimeData(ref ret));
            }

            throw new System.ArgumentException("Invalid cast of data [" + data.value_Renamed + "] to type Time");
        }
Ejemplo n.º 6
0
        IAnswerData IAnswerData.cast(UncastData data)
        {
            List <Selection> v = new List <Selection>();

            List <String> choices = DateUtils.split(data.Value.ToString(), " ", true);

            foreach (String s in choices)
            {
                v.Add(new Selection(s));
            }
            return(new SelectMultiData(v));
        }
Ejemplo n.º 7
0
        public virtual BooleanData cast(UncastData data)
        {
            if ("1".Equals(data))
            {
                return(new BooleanData(true));
            }

            if ("0".Equals(data))
            {
                return(new BooleanData(false));
            }

            throw new System.ArgumentException("Invalid cast of data [" + data.value_Renamed + "] to type Boolean");
        }
Ejemplo n.º 8
0
        IAnswerData IAnswerData.cast(UncastData data)
        {
            double[] ret = new double[4];

            List <String> choices = DateUtils.split(data.Value.ToString(), " ", true);
            int           i       = 0;

            foreach (String s in choices)
            {
                double d = Double.Parse(s);
                ret[i] = d;
                ++i;
            }
            return(new GeoPointData(ret));
        }
Ejemplo n.º 9
0
        public virtual GeoShapeData cast(UncastData data)
        {
            System.String[] parts = data.value_Renamed.split(";");

            // silly...
            GeoPointData t = new GeoPointData();

            GeoShapeData d = new GeoShapeData();

            for (String part: parts)
            {
                // allow for arbitrary surrounding whitespace
                d.points.add(t.cast(new UncastData(part.trim())));
            }
            return(d);
        }
Ejemplo n.º 10
0
        public virtual GeoPointData cast(UncastData data)
        {
            double[] ret = new double[4];
            // make sure that missing data is flagged as absent...
            for (int i = REQUIRED_ARRAY_SIZE; i < ret.Length; ++i)
            {
                ret[i] = MISSING_VALUE;
            }


            int i2 = 0;

            for (String s: choices)
            {
                double d = Double.parseDouble(s);
                ret[i2] = d;
                ++i2;
            }
            return(new GeoPointData(ret));
        }
Ejemplo n.º 11
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(null);
 }
Ejemplo n.º 12
0
 public virtual StringData cast(UncastData data)
 {
     return(new StringData(data.value_Renamed));
 }
Ejemplo n.º 13
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(new StringData(data.value_Renamed));
 }
Ejemplo n.º 14
0
 public virtual SelectOneData cast(UncastData data)
 {
     return(new SelectOneData(new Selection(data.value_Renamed)));
 }
Ejemplo n.º 15
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(new SelectOneData(new Selection(data.value_Renamed)));
 }
Ejemplo n.º 16
0
 public virtual PointerAnswerData cast(UncastData data)
 {
     return(null);
 }