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
-
ObjectBaseSerializableObjectBaseManualSerializationPhysicalValueRange
- 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
value1doubleFirst numerical value
value1isElementboolDetermines if Value1 is an element of this PhysicalValueRange.
value2doubleSecond numerical value
value2isElementboolDetermines if Value2 is an element of this PhysicalValueRange.
measuredQuantityMeasuredQuantityThe measured of the physical value (e.g. length).
namestringThe 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
value1doubleFirst numerical value.
value2doubleSecond numerical value.
measuredQuantityMeasuredQuantityThe measured of the physical value (e.g. length).
namestringOptional 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
value1doubleFirst numerical value
name1stringMeaning of value1.
value1isElementboolDetermines if Value1 is an element of this PhysicalValueRange.
value2doubleSecond numerical value
name2stringMeaning of value2.
value2isElementboolDetermines if Value2 is an element of this PhysicalValueRange.
measuredQuantityMeasuredQuantityThe 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
value1PhysicalValueFirst physical value
value1isElementboolDetermines if Value1 is an element of this PhysicalValueRange.
value2PhysicalValueSecond physical value
value2isElementboolDetermines if Value2 is an element of this PhysicalValueRange.
PhysicalValueRange(PhysicalValue, PhysicalValue)
Constructor with physical value parameters.
public PhysicalValueRange(PhysicalValue value1, PhysicalValue value2)
Parameters
value1PhysicalValueFirst physical value.
value2PhysicalValueSecond physical value.
PhysicalValueRange(PhysicalValueRange)
Copy constructor.
public PhysicalValueRange(PhysicalValueRange range)
Parameters
rangePhysicalValueRangePhysical value range to copy.
Properties
Center
Gets the center value of the range.
public double Center { get; }
Property Value
CommonName
public string CommonName { get; }
Property Value
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
Name2
Meaning of Value2.
public string Name2 { get; set; }
Property Value
PhysicalProperty
The unit of the physical value.
public PhysicalProperty PhysicalProperty { get; set; }
Property Value
PhysicalValue1
The value of the first physical value.
public PhysicalValue PhysicalValue1 { get; }
Property Value
PhysicalValue2
The value of the second physical value.
public PhysicalValue PhysicalValue2 { get; }
Property Value
SignedValueRange
public double SignedValueRange { get; }
Property Value
Value1
First numerical value.
public double Value1 { get; set; }
Property Value
Value1IsElementOfRange
Determines if Value1 is an element of the PhysicalValueRange.
public bool Value1IsElementOfRange { get; set; }
Property Value
Value2
Second numerical value.
public double Value2 { get; set; }
Property Value
Value2IsElementOfRange
Determines if Value2 is an element of the PhysicalValueRange.
public bool Value2IsElementOfRange { get; set; }
Property Value
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
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
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
valueRangePhysicalValueRangeThe 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
rangePhysicalValueRangeRange 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,
nullis returned.
Exceptions
OverlappingRange_within2PI(PhysicalValueRange)
Method that returns the overlap of this and a given PhysicalValueRange.
public PhysicalValueRange? OverlappingRange_within2PI(PhysicalValueRange range)
Parameters
rangePhysicalValueRangeRange 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,
nullis returned.
Exceptions
RangeContainsDoubleValue(double, bool)
Method that checks whether a given double value is contained by this range.
public bool RangeContainsDoubleValue(double value, bool permissiveCheck)
Parameters
valuedoubleValue to check for lying inside the range
permissiveCheckboolIf 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
valuedoubleValue to check for lying inside the range
epsilondoubleThe check will allow the value to lie in a small epsilon outside the range.
Returns
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
rangePhysicalValueRangeRange to be checked if it lies inside this.
Returns
- bool
trueif 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
rangePhysicalValueRangeRange to be checked if it lies inside this.
epsilondoubleEpsilon (= relative deviation) to be used for comparison.
Returns
- bool
trueif range lies inside this.
RangesOverlap(PhysicalValueRange)
Method that checks whether a given PhysicalValueRange overlaps with this.
public bool RangesOverlap(PhysicalValueRange range)
Parameters
rangePhysicalValueRange
Returns
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
valueRangeToSwapPhysicalValueRangeValue 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
numberOfSignificantDigitsintThe 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
range1PhysicalValueRangeFirst PhysicalValueRange object to compare.
range2PhysicalValueRangeSecond 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
value1PhysicalValueRangeFirst PhysicalValueRange object to compare.
value2PhysicalValueRangeSecond PhysicalValueRange object to compare.
Returns
- bool
Returns true if the two objects are unequal.