예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #5
0
파일: TimeData.cs 프로젝트: ryanbehr/csrosa
        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");
        }
예제 #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));
        }
예제 #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");
        }
예제 #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));
        }
예제 #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);
        }
예제 #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));
        }
예제 #11
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(null);
 }
예제 #12
0
 public virtual StringData cast(UncastData data)
 {
     return(new StringData(data.value_Renamed));
 }
예제 #13
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(new StringData(data.value_Renamed));
 }
예제 #14
0
 public virtual SelectOneData cast(UncastData data)
 {
     return(new SelectOneData(new Selection(data.value_Renamed)));
 }
예제 #15
0
 IAnswerData IAnswerData.cast(UncastData data)
 {
     return(new SelectOneData(new Selection(data.value_Renamed)));
 }
예제 #16
0
 public virtual PointerAnswerData cast(UncastData data)
 {
     return(null);
 }