Table of Contents

Class PhysicalValueRange

Namespace
VirtualLabAPI.Core.Numerics
Assembly
VirtualLabAPI.dll

Class for a range of physical values.

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

Constructors

PhysicalValueRange(double, bool, double, bool, MeasuredQuantity, string)

Constructor with all parameters but with a single name.

public PhysicalValueRange(double value1, bool value1isElement, double value2, bool value2isElement, MeasuredQuantity measuredQuantity, string name)

Parameters

value1 double

First numerical value

value1isElement bool

Determines if Value1 is an element of this PhysicalValueRange.

value2 double

Second numerical value

value2isElement bool

Determines if Value2 is an element of this PhysicalValueRange.

measuredQuantity MeasuredQuantity

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

name string

The name describing the physical value range.

PhysicalValueRange(double, double, MeasuredQuantity, string)

Constructor with the most important parameters.

public PhysicalValueRange(double value1, double value2, MeasuredQuantity measuredQuantity, string name = "")

Parameters

value1 double

First numerical value.

value2 double

Second numerical value.

measuredQuantity MeasuredQuantity

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

name string

Optional name describing the physical value range.

PhysicalValueRange(double, string, bool, double, string, bool, MeasuredQuantity)

Constructor with all parameters.

public PhysicalValueRange(double value1, string name1, bool value1isElement, double value2, string name2, bool value2isElement, MeasuredQuantity measuredQuantity)

Parameters

value1 double

First numerical value

name1 string

Meaning of value1.

value1isElement bool

Determines if Value1 is an element of this PhysicalValueRange.

value2 double

Second numerical value

name2 string

Meaning of value2.

value2isElement bool

Determines if Value2 is an element of this PhysicalValueRange.

measuredQuantity MeasuredQuantity

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

PhysicalValueRange(PhysicalValue, bool, PhysicalValue, bool)

Constructor with physical value parameters and inclusion information

public PhysicalValueRange(PhysicalValue value1, bool value1isElement, PhysicalValue value2, bool value2isElement)

Parameters

value1 PhysicalValue

First physical value

value1isElement bool

Determines if Value1 is an element of this PhysicalValueRange.

value2 PhysicalValue

Second physical value

value2isElement bool

Determines if Value2 is an element of this PhysicalValueRange.

PhysicalValueRange(PhysicalValue, PhysicalValue)

Constructor with physical value parameters.

public PhysicalValueRange(PhysicalValue value1, PhysicalValue value2)

Parameters

value1 PhysicalValue

First physical value.

value2 PhysicalValue

Second physical value.

PhysicalValueRange(PhysicalValueRange)

Copy constructor.

public PhysicalValueRange(PhysicalValueRange range)

Parameters

range PhysicalValueRange

Physical value range to copy.

Properties

Center

Gets the center value of the range.

public double Center { get; }

Property Value

double

CommonName

Gets the common name if Name1 and Name2 are equal. Else null is returned.

public string CommonName { get; }

Property Value

string

MeasuredQuantity

Gets and sets the measured quantity, which in the future will replace the PhysicalProperty.

public MeasuredQuantity MeasuredQuantity { get; set; }

Property Value

MeasuredQuantity

Name1

Meaning of Value1.

public string Name1 { get; set; }

Property Value

string

Name2

Meaning of Value2.

public string Name2 { get; set; }

Property Value

string

PhysicalProperty

The unit of the physical value.

public PhysicalProperty PhysicalProperty { get; set; }

Property Value

PhysicalProperty

PhysicalValue1

The value of the first physical value.

public PhysicalValue PhysicalValue1 { get; }

Property Value

PhysicalValue

PhysicalValue2

The value of the second physical value.

public PhysicalValue PhysicalValue2 { get; }

Property Value

PhysicalValue

SignedValueRange

Gets the difference between Value2 and Value1.

public double SignedValueRange { get; }

Property Value

double

Value1

First numerical value.

public double Value1 { get; set; }

Property Value

double

Value1IsElementOfRange

Determines if Value1 is an element of the PhysicalValueRange.

public bool Value1IsElementOfRange { get; set; }

Property Value

bool

Value2

Second numerical value.

public double Value2 { get; set; }

Property Value

double

Value2IsElementOfRange

Determines if Value2 is an element of the PhysicalValueRange.

public bool Value2IsElementOfRange { get; set; }

Property Value

bool

Methods

Clone()

Clones the current object.

public override object Clone()

Returns

object

Deep copy of this object.

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.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetOrderedRange(PhysicalValueRange)

Gets the input range whereas it is ensured that value 1 is not larger than value 2.

public static PhysicalValueRange GetOrderedRange(PhysicalValueRange valueRange)

Parameters

valueRange PhysicalValueRange

The value range.

Returns

PhysicalValueRange

The value range with swapped values if value 1 of the input range is larger than its value 2. Otherwise a copy of the original value range.

OverlappingRange(PhysicalValueRange)

Method that returns the overlap of this and a given PhysicalValueRange.

public PhysicalValueRange OverlappingRange(PhysicalValueRange range)

Parameters

range PhysicalValueRange

Range with which to calculate the overlap with this instance.

Returns

PhysicalValueRange

The range overlap. The physical properties are determined by this. In case of no overlap, null is returned.

Exceptions

ArgumentNullException

OverlappingRange_within2PI(PhysicalValueRange)

Method that returns the overlap of this and a given PhysicalValueRange.

public PhysicalValueRange? OverlappingRange_within2PI(PhysicalValueRange range)

Parameters

range PhysicalValueRange

Range with which to calculate the overlap with this instance.

Returns

PhysicalValueRange

The range overlap. The physical properties are determined by this. In case of no overlap, null is returned.

Exceptions

ArgumentNullException

RangeContainsDoubleValue(double, bool)

Method that checks whether a given double value is contained by this range.

public bool RangeContainsDoubleValue(double value, bool permissiveCheck)

Parameters

value double

Value to check for lying inside the range

permissiveCheck bool

If true, the check will allow the value to be in a small epsilon outside the range.

Returns

bool

TRUE if double value is contained by this range, otherwise FALSE

RangeContainsDoubleValue(double, double)

Method that checks whether a given double value is contained by this range.

public bool RangeContainsDoubleValue(double value, double epsilon)

Parameters

value double

Value to check for lying inside the range

epsilon double

The check will allow the value to lie in a small epsilon outside the range.

Returns

bool

true if double value is contained by this range, otherwise false.

RangeContainsRange(PhysicalValueRange)

Method that checks whether a given PhysicalValueRange is contained (completely) by this, using the Globals.Epsilon value.

public bool RangeContainsRange(PhysicalValueRange range)

Parameters

range PhysicalValueRange

Range to be checked if it lies inside this.

Returns

bool

true if range lies inside this.

RangeContainsRange(PhysicalValueRange, double)

Method that checks whether a given PhysicalValueRange is contained (completely) by this, using a given epsilon value.

public bool RangeContainsRange(PhysicalValueRange range, double epsilon)

Parameters

range PhysicalValueRange

Range to be checked if it lies inside this.

epsilon double

Epsilon (= relative deviation) to be used for comparison.

Returns

bool

true if range lies inside this.

RangesOverlap(PhysicalValueRange)

Method that checks whether a given PhysicalValueRange overlaps with this.

public bool RangesOverlap(PhysicalValueRange range)

Parameters

range PhysicalValueRange

Returns

bool

SuggestAxisFormat()

Suggest an axis format for this.

public AxisNumberFormat SuggestAxisFormat()

Returns

AxisNumberFormat

The suggest axis number format (scientific, standard, or engineering).

SwapValues(PhysicalValueRange)

Method that returns a new physical value range with swapped values.

public static PhysicalValueRange SwapValues(PhysicalValueRange valueRangeToSwap)

Parameters

valueRangeToSwap PhysicalValueRange

Value range whose values are to be swapped.

Returns

PhysicalValueRange

Value range with swapped values.

ToString()

Overridden ToString function.

public override string ToString()

Returns

string

The formatted value.

ToString(int)

Gets a string representing this instance.

public string ToString(int numberOfSignificantDigits)

Parameters

numberOfSignificantDigits int

The number of digits used for formatting of the floating point numbers.

Returns

string

The formatted value.

Operators

operator ==(PhysicalValueRange, PhysicalValueRange)

Compares two PhysicalValueRange for equality.

public static bool operator ==(PhysicalValueRange range1, PhysicalValueRange range2)

Parameters

range1 PhysicalValueRange

First PhysicalValueRange object to compare.

range2 PhysicalValueRange

Second PhysicalValueRange object to compare.

Returns

bool

Returns true if the two objects are equal.

operator !=(PhysicalValueRange, PhysicalValueRange)

Compares two PhysicalValueRange for inequality.

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

Parameters

value1 PhysicalValueRange

First PhysicalValueRange object to compare.

value2 PhysicalValueRange

Second PhysicalValueRange object to compare.

Returns

bool

Returns true if the two objects are unequal.