Table of Contents

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
ObjectBase
SerializableObjectBase
ManualSerialization
PhysicalValueBase
Implements
IEquatable<IObjectBase>
Derived
Inherited Members

Constructors

PhysicalValueBase(MeasuredQuantity, string)

Standard constructor.

public PhysicalValueBase(MeasuredQuantity measuredQuantity, string comment)

Parameters

measuredQuantity MeasuredQuantity

The measured quantity of the physical value (e.g. length).

comment string

A comment specifying what the PhysicalValue actually is.

PhysicalValueBase(PhysicalValueBase)

Copy constructor.

public PhysicalValueBase(PhysicalValueBase physicalValueBase)

Parameters

physicalValueBase PhysicalValueBase

PhysicalValueBase object to copy.

Properties

ActualParameterRunResult

Gets the actual parameter run result.

public object ActualParameterRunResult { get; }

Property Value

object

Comment

A comment specifying what the PhysicalValue actually is.

public string Comment { get; set; }

Property Value

string

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

PhysicalProperty

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

otherObject object

The object to compare with this instance.

equalityIntent EqualityIntent

Defines what kind of equality you want to check when comparing two objects, for example all values or just physical equality.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

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

showPhysicalUnits bool

If set to true physical units shall be shown in the formatted string.

numberOfDigits int

The number of digits. Should be in the range 1 ... 15. Otherwise the global digit precision is used.

complexNumberFormat ComplexToStringConversionFormat?

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

significantDigits int

The significant digits.

Returns

string

A string that represents this instance.

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

format string

The 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.

formatProvider IFormatProvider

Optional culture specific format provider used for formatting the value (if format is not "U" or "F").

Returns

string

A string that represents this instance.