Class PhysicalValueBase
- Namespace
- VirtualLabAPI.Core.Numerics
- Assembly
- VirtualLabAPI.dll
Base class for a complex or double value with a physical unit.
[Serializable]
public abstract class PhysicalValueBase : ManualSerialization, IEquatable<IObjectBase>, ISerializable, IDeserializationCallback, ICloneable, IFormattable
- Inheritance
-
ObjectBaseSerializableObjectBaseManualSerializationPhysicalValueBase
- Implements
-
IEquatable<IObjectBase>
- Derived
- Inherited Members
Constructors
PhysicalValueBase(MeasuredQuantity, string)
Standard constructor.
public PhysicalValueBase(MeasuredQuantity measuredQuantity, string comment)
Parameters
measuredQuantityMeasuredQuantityThe measured quantity of the physical value (e.g. length).
commentstringA comment specifying what the PhysicalValue actually is.
PhysicalValueBase(PhysicalValueBase)
Copy constructor.
public PhysicalValueBase(PhysicalValueBase physicalValueBase)
Parameters
physicalValueBasePhysicalValueBasePhysicalValueBase object to copy.
Properties
ActualParameterRunResult
Gets the actual parameter run result.
public object ActualParameterRunResult { get; }
Property Value
Comment
A comment specifying what the PhysicalValue actually is.
public string Comment { get; set; }
Property Value
MeasuredQuantity
Gets and sets the measured quantity (e.g. length) of the physical value.
public MeasuredQuantity MeasuredQuantity { get; set; }
Property Value
- MeasuredQuantity
PhysicalProperty
The unit of the PhysicalValue.
public virtual PhysicalProperty PhysicalProperty { get; set; }
Property Value
Methods
Clone()
Creates a new object that is a copy of the current instance.
public override object Clone()
Returns
- object
A new object that is a copy of this instance.
Equals(object, EqualityIntent)
Determines whether the specified object is equal to this instance.
public override bool Equals(object otherObject, EqualityIntent equalityIntent)
Parameters
otherObjectobjectThe object to compare with this instance.
equalityIntentEqualityIntentDefines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.
Returns
GetComplexValue()
Gets the actual value as a complex number.
public Complex GetComplexValue()
Returns
- Complex
The actual value of this physical value.
GetFormatString(bool, int, ComplexToStringConversionFormat?)
Gets the format string which can be used for the ToString method.
public static string GetFormatString(bool showPhysicalUnits, int numberOfDigits, ComplexToStringConversionFormat? complexNumberFormat = null)
Parameters
showPhysicalUnitsboolIf set to
truephysical units shall be shown in the formatted string.numberOfDigitsintThe number of digits. Should be in the range 1 ... 15. Otherwise the global digit precision is used.
complexNumberFormatComplexToStringConversionFormat?The complex number format (RealImaginary, AmplitudePhase or SinusCosinus). Can be omitted for real-valued physical values.
Returns
- string
The format string.
ToString(int)
Returns a string that represents this instance.
public abstract string ToString(int significantDigits)
Parameters
significantDigitsintThe significant digits.
Returns
ToString(string, IFormatProvider)
ToString function provided by the IFormattable interface. Returns a string that represents this instance.
public abstract string ToString(string format, IFormatProvider formatProvider = null)
Parameters
formatstringThe format. "U" or an empty string means that the string is formatted with units (e.g. "1 nm"). "G" means that the string is formatted without units (e.g. "1e-9"). "F" means that the string is formatted as "{Comment} of {Value with units}" (e.g. "wavelength of 300 nm").
In all cases you can add a number to specify the number of digits that shall be used. E.g. "U3" results in "1.23 nm", while "U4" results in "1.234 nm". After a comma you can add the ComplexToStringConversionFormat for complex physical values. The GetFormatString method can be used to generate a matching format string.
For any other string the ToString(format, formatProvider) of the Value is used.formatProviderIFormatProviderOptional culture specific format provider used for formatting the value (if format is not "U" or "F").