public DefineQuantitiesAttribute(params object[] quantitiesInfo) { int n = quantitiesInfo.Length; System.Diagnostics.Trace.Assert(n % 3 == 0); for (int i = 0; i < n; i += 3) { Quantities.DefineQuantity(quantitiesInfo[i], quantitiesInfo[i + 1], quantitiesInfo[i + 2]); } }
public static ValueInfo Create(string quantityName, string dimension, string substance, string location, bool mayReturnNull = false) { var quantity = Quantities.GetQuantity(quantityName, mayReturnNull); if (quantity == null) { return(null); } var unit = (dimension == null) ? quantity.DefaultDimensionUnit : Quantities.GetOrDefineUnit(dimension); return(new ValueInfo(quantity, unit, substance, location)); }
public static bool IsDescriptor(string s) { var p = s.Split('_'); return(2 <= p.Length && p.Length <= 4 && Quantities.IsQuantity(p[1]) && (p.Length < 4 || Quantities.IsDimension(p[3]))); }