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"); } }
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"); } }
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"); } }
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"); } }
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"); }
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)); }
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"); }
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)); }
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); }
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)); }
IAnswerData IAnswerData.cast(UncastData data) { return(null); }
public virtual StringData cast(UncastData data) { return(new StringData(data.value_Renamed)); }
IAnswerData IAnswerData.cast(UncastData data) { return(new StringData(data.value_Renamed)); }
public virtual SelectOneData cast(UncastData data) { return(new SelectOneData(new Selection(data.value_Renamed))); }
IAnswerData IAnswerData.cast(UncastData data) { return(new SelectOneData(new Selection(data.value_Renamed))); }
public virtual PointerAnswerData cast(UncastData data) { return(null); }