public static IEnumerable <IFluentPathValue> IntegerEval(this IEnumerable <IFluentPathValue> focus) { if (focus.JustValues().Count() == 1) { var val = focus.Single().Value; if (val != null) { if (val is long) { return(FhirValueList.Create((long)val)); } //if (val is decimal) return (Int64)Math.Round((decimal)val); if (val is string) { long result; if (Int64.TryParse((string)val, out result)) { return(FhirValueList.Create(result)); } } } } return(FhirValueList.Empty()); }
public static IEnumerable <IFluentPathValue> Create(params object[] values) { if (values != null) { return(values.Select(value => value == null ? null : value is IFluentPathValue ? (IFluentPathValue)value : new TypedValue(value))); } else { return(FhirValueList.Empty()); } }
public static IEnumerable <IFluentPathValue> Substring(this IEnumerable <IFluentPathValue> focus, long start, long?length) { if (focus.Count() == 1) { if (focus.First().Value != null) { var str = focus.First().AsStringRepresentation(); if (length.HasValue) { return(FhirValueList.Create(str.Substring((int)start, (int)length.Value))); } else { return(FhirValueList.Create(str.Substring((int)start))); } } } return(FhirValueList.Empty()); }