Table of Contents

Class PhysicalValueComplex

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

Class for a complex value with a physical unit.

[Serializable]
public class PhysicalValueComplex : PhysicalValueBase, IEquatable<IObjectBase>, ISerializable, IDeserializationCallback, ICloneable, IFormattable
Inheritance
ObjectBase
SerializableObjectBase
ManualSerialization
PhysicalValueComplex
Implements
IEquatable<IObjectBase>
Inherited Members

Constructors

PhysicalValueComplex(Complex, MeasuredQuantity)

Default constructor

public PhysicalValueComplex(Complex value, MeasuredQuantity measuredQuantity)

Parameters

value Complex

The value of the PhysicalValue.

measuredQuantity MeasuredQuantity

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

PhysicalValueComplex(Complex, MeasuredQuantity, string)

Constructor with a comment string.

public PhysicalValueComplex(Complex value, MeasuredQuantity measuredQuantity, string comment)

Parameters

value Complex

The value of the PhysicalValue.

measuredQuantity MeasuredQuantity

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

comment string

A comment specifying what the PhysicalValue actually is.

Properties

Value

The value of the PhysicalValue.

public Complex Value { get; set; }

Property Value

Complex

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)

Overridden Equals functionality.

public override bool Equals(object obj, EqualityIntent equalityIntent)

Parameters

obj object

The object to compare for equality.

equalityIntent EqualityIntent

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

Returns

bool

TRUE: The objects are equal. FALSE: The objects are not equal.

ExtractFieldQuantity(FieldQuantity)

Extracts the given field quantity.

public PhysicalValue ExtractFieldQuantity(FieldQuantity fieldQuantity)

Parameters

fieldQuantity FieldQuantity

The field quantity to extract.

Returns

PhysicalValue

The given field quantity as double-valued PhysicalValue.

Exceptions

NotImplementedException

Extraction of the given field quantity is not implemented.

ToString()

Overridden ToString function. The PhysicalValue is formatted like "1 nm".

public override string ToString()

Returns

string

The formatted value.

ToString(int)

Overridden ToString function. The PhysicalValue is formatted like "1 nm".

public override string ToString(int significantDigits)

Parameters

significantDigits int

The number of significant digits.

Returns

string

The formatted value.

ToString(int, ComplexToStringConversionFormat)

Overridden ToString function. The PhysicalValue is formatted like "1 nm".

public string ToString(int significantDigits, ComplexToStringConversionFormat complexNumberRepresentation)

Parameters

significantDigits int

The number of significant digits.

complexNumberRepresentation ComplexToStringConversionFormat

Type of string conversion format.

Returns

string

The formatted value.

ToString(string, IFormatProvider)

Overridden ToString function provided by the IFormattable interface. Returns a string that represents this instance.

public override 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". You can add further formatting commands after a comma, but these are ignored. This behavior ensures that the same formatting strings can be used for both PhysicalValue and PhysicalValueComplex.
For any other string the ToString(format, formatProvider) of the Value is used.

formatProvider IFormatProvider

Optional culture specific format provider. Not used.

Returns

string

A string that represents this instance.

Operators

operator ==(PhysicalValueComplex, PhysicalValueComplex)

Compares two PhysicalValueComplex for equality. The comparison will be done by comparing the values, units, and comments, respectively.

public static bool operator ==(PhysicalValueComplex value1, PhysicalValueComplex value2)

Parameters

value1 PhysicalValueComplex

First PhysicalValueComplex object to compare.

value2 PhysicalValueComplex

Second PhysicalValueComplex object to compare.

Returns

bool

Returns true if the two objects are equal.

operator !=(PhysicalValueComplex, PhysicalValueComplex)

Compares two PhysicalValueComplex for inequality. The comparison will be done by comparing the values, units, and comments, respectively.

public static bool operator !=(PhysicalValueComplex value1, PhysicalValueComplex value2)

Parameters

value1 PhysicalValueComplex

First PhysicalValueComplex object to compare.

value2 PhysicalValueComplex

Second PhysicalValueComplex object to compare.

Returns

bool

Returns true if the two objects are unequal.