/// <summary> /// Extract the FSO references. /// </summary> /// <param name="valueBase"></param> /// <returns></returns> private IEnumerable <FinalStateObject> ExtractFSOReference(IValueBase valueBase) { if (valueBase is PhysicalValue) { return(ExtractFSOReferences(valueBase as PhysicalValue)); } else if (valueBase is SinglePhysicalQuantity) { return(ExtractFSOReferences(valueBase as SinglePhysicalQuantity)); } else if (valueBase is FunctionPhysicalQuantity) { return(ExtractFSOReferences(valueBase as FunctionPhysicalQuantity)); } else { throw new NotImplementedException(); } }
/// <summary> /// General purpose IValueBase emitter. /// </summary> /// <param name="v"></param> /// <param name="wr"></param> /// <returns></returns> public static string Emit(this IValueBase v, TextWriter wr) { if (v is PhysicalValue) { return((v as PhysicalValue).Emit(wr)); } else if (v is SinglePhysicalQuantity) { return((v as SinglePhysicalQuantity).Emit(wr)); } else if (v is FunctionPhysicalQuantity) { return((v as FunctionPhysicalQuantity).Emit(wr)); } else { throw new ArgumentException($"Do not know how to emit type '{v.GetType().Name}'"); } }
/// <summary> /// Extract the FSO references. /// </summary> /// <param name="valueBase"></param> /// <returns></returns> private IEnumerable<FinalStateObject> ExtractFSOReference(IValueBase valueBase) { if (valueBase is PhysicalValue) { return ExtractFSOReferences(valueBase as PhysicalValue); } else if (valueBase is SinglePhysicalQuantity) { return ExtractFSOReferences(valueBase as SinglePhysicalQuantity); } else if (valueBase is FunctionPhysicalQuantity) { return ExtractFSOReferences(valueBase as FunctionPhysicalQuantity); } else { throw new NotImplementedException(); } }