Class RealInterval
Represents a real (double) interval with bounded/unbounded and inclusive/exclusive end points.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public class RealInterval : Interval<double, double, IntervalEndpoint<double>, RealInterval>, IInterval<double, double, IntervalEndpoint<double>, RealInterval>
Constructors
View SourceRealInterval(IntervalEndpoint<Double>, IntervalEndpoint<Double>)
Initializes a new instance of the RealInterval class.
Declaration
public RealInterval(IntervalEndpoint<double> leftEndpoint, IntervalEndpoint<double> rightEndpoint)
Parameters
Type | Name | Description |
---|---|---|
IntervalEndpoint<System.Double> | leftEndpoint | Left endpoint. |
IntervalEndpoint<System.Double> | rightEndpoint | Right endpoint. |
RealInterval(Double, Boolean, Boolean, Double, Boolean, Boolean)
Initializes a new instance of the RealInterval class.
Declaration
public RealInterval(double leftPoint, bool leftInclusive, bool leftBounded, double rightPoint, bool rightInclusive, bool rightBounded)
Parameters
Type | Name | Description |
---|---|---|
System.Double | leftPoint | Left bound point (or min value if unbound). |
System.Boolean | leftInclusive | Whether left point is inclusive (always false if unbound). |
System.Boolean | leftBounded | Whether left point is bounded. |
System.Double | rightPoint | Right bound point (or min value if unbound). |
System.Boolean | rightInclusive | Whether right point is inclusive (always false if unbound). |
System.Boolean | rightBounded | Whether right point is bounded. |
RealInterval(Double, Boolean, Double, Boolean)
Initializes a new instance of the RealInterval class.
Declaration
public RealInterval(double leftPoint, bool leftInclusive, double rightPoint, bool rightInclusive)
Parameters
Type | Name | Description |
---|---|---|
System.Double | leftPoint | Left bound point. |
System.Boolean | leftInclusive | Whether left point is inclusive. |
System.Double | rightPoint | Right bound point. |
System.Boolean | rightInclusive | Whether right point is inclusive. |
RealInterval(Double, Double)
Initializes a new instance of the RealInterval class.
Declaration
public RealInterval(double leftPoint, double rightPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | leftPoint | Left bound point. |
System.Double | rightPoint | Right bound point. |
Remarks
Defaults to inclusive.
Fields
View SourceEmpty
Canonical empty instance (bounded, non-inclusive, single point).
Declaration
public static readonly RealInterval Empty
Field Value
Type | Description |
---|---|
RealInterval |
Infinite
Canonical infinite interval (unbounded on both ends).
Declaration
public static readonly RealInterval Infinite
Field Value
Type | Description |
---|---|
RealInterval |
Zero
Zero interval (unbounded but inclusive, zero value).
Declaration
public static readonly RealInterval Zero
Field Value
Type | Description |
---|---|
RealInterval |
Properties
View SourcePointMaxValue
Gets the point maximum value.
Declaration
protected override double PointMaxValue { get; }
Property Value
Type | Description |
---|---|
System.Double |
Overrides
PointMinValue
Gets the point minimum value.
Declaration
protected override double PointMinValue { get; }
Property Value
Type | Description |
---|---|
System.Double |
Overrides
SpanMaxValue
Gets the span maximum value.
Declaration
protected override double SpanMaxValue { get; }
Property Value
Type | Description |
---|---|
System.Double |
Overrides
SpanMinValue
Gets the span minimum value.
Declaration
protected override double SpanMinValue { get; }
Property Value
Type | Description |
---|---|
System.Double |
Overrides
SpanZeroValue
Gets the span zero value.
Declaration
protected override double SpanZeroValue { get; }
Property Value
Type | Description |
---|---|
System.Double |
Overrides
Methods
View SourceComparePoints(Double, Double)
Compare points.
Declaration
protected override int ComparePoints(double a, double b)
Parameters
Type | Name | Description |
---|---|---|
System.Double | a | First point. |
System.Double | b | Second point. |
Returns
Type | Description |
---|---|
System.Int32 | Less (-1), greater (+1) or equal (0). |
Overrides
Coverage(IEnumerable<RealInterval>)
Determine coverage from minimum left to maximum right for a set of given intervals.
Declaration
public static RealInterval Coverage(IEnumerable<RealInterval> intervals)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<RealInterval> | intervals | The set of intervals. |
Returns
Type | Description |
---|---|
RealInterval | Interval from minimum left to maximum right value. |
Remarks
Returns empty interval when sequence is empty or contains only empty intervals.
Difference(Double, Double)
Determine span between two given points.
Declaration
protected override double Difference(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | First point. |
System.Double | y | Second point. |
Returns
Type | Description |
---|---|
System.Double | Span between points. |
Overrides
LeftBounded(Double)
Constructor helper for left-bound instances.
Declaration
public static RealInterval LeftBounded(double left)
Parameters
Type | Name | Description |
---|---|---|
System.Double | left | Left bound point. |
Returns
Type | Description |
---|---|
RealInterval | A left-bound instance of the RealInterval class. |
Remarks
Defaults to inclusive.
LeftBounded(Double, Boolean)
Constructor helper for left-bound instances.
Declaration
public static RealInterval LeftBounded(double left, bool inclusive)
Parameters
Type | Name | Description |
---|---|---|
System.Double | left | Left bound point. |
System.Boolean | inclusive | Whether left point is inclusive. |
Returns
Type | Description |
---|---|
RealInterval | A left-bound instance of the RealInterval class. |
Merge(IEnumerable<RealInterval>)
Merges a specified set of real intervals into a set of non-overlapping real intervals that cover the specified intervals.
Declaration
public static IEnumerable<RealInterval> Merge(IEnumerable<RealInterval> intervals)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<RealInterval> | intervals | A set of intervals to cover. |
Returns
Type | Description |
---|---|
IEnumerable<RealInterval> | Set of non-overlapping intervals that cover the given intervals. |
NegateSpan(Double)
Negate span.
Declaration
protected override double NegateSpan(double span)
Parameters
Type | Name | Description |
---|---|---|
System.Double | span | Span to be negated. |
Returns
Type | Description |
---|---|
System.Double | Negated span. |
Overrides
RightBounded(Double)
Constructor helper for right-bound instances.
Declaration
public static RealInterval RightBounded(double right)
Parameters
Type | Name | Description |
---|---|---|
System.Double | right | Right bound point. |
Returns
Type | Description |
---|---|
RealInterval | A right-bound instance of the RealInterval class. |
Remarks
Defaults to inclusive.
RightBounded(Double, Boolean)
Constructor helper for right-bound instances.
Declaration
public static RealInterval RightBounded(double right, bool inclusive)
Parameters
Type | Name | Description |
---|---|---|
System.Double | right | Right bound point. |
System.Boolean | inclusive | Whether right point is inclusive. |
Returns
Type | Description |
---|---|
RealInterval | A right-bound instance of the RealInterval class. |
Scale(Double, Double)
Scale endpoints by span distances.
Declaration
public override RealInterval Scale(double left, double right)
Parameters
Type | Name | Description |
---|---|---|
System.Double | left | Span by which to scale left. |
System.Double | right | Span by which to scale right. |
Returns
Type | Description |
---|---|
RealInterval | Scaled interval. |
Overrides
Scale(Single, Single)
Scale endpoints by factors.
Declaration
public override RealInterval Scale(float left, float right)
Parameters
Type | Name | Description |
---|---|---|
Single | left | Factor by which to scale left. |
Single | right | Factor by which to scale right. |
Returns
Type | Description |
---|---|
RealInterval | Scaled interval. |
Overrides
ScaleSpan(Double, Double)
Scale a span by a given factor.
Declaration
protected override double ScaleSpan(double span, double factor)
Parameters
Type | Name | Description |
---|---|---|
System.Double | span | Span value. |
System.Double | factor | Factor by which to scale. |
Returns
Type | Description |
---|---|
System.Double | Scaled span. |
Overrides
Translate(Double)
Translate by a span distance.
Declaration
public override RealInterval Translate(double span)
Parameters
Type | Name | Description |
---|---|---|
System.Double | span | Span by which to translate. |
Returns
Type | Description |
---|---|
RealInterval | Translated interval. |
Overrides
Remarks
Unbound points do not change.
TranslatePoint(Double, Double)
Translate point by given span.
Declaration
protected override double TranslatePoint(double point, double span)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | Point value. |
System.Double | span | Span by which to translate. |
Returns
Type | Description |
---|---|
System.Double | Translated point. |