Interface IInterval<TPoint, TSpan, TEndpoint, T>
Represents an interval with bounded/unbounded and inclusive/exclusive end points.
Namespace: Microsoft.Psi
Assembly: Microsoft.Psi.dll
Syntax
public interface IInterval<TPoint, TSpan, TEndpoint, T>
where TPoint : IComparable where TEndpoint : IIntervalEndpoint<TPoint>
Type Parameters
Name | Description |
---|---|
TPoint | Type of point values. |
TSpan | Type of spans between point values. |
TEndpoint | Explicit endpoint type (instance of IIntervalEndpoint{TPoint}). |
T | Concrete type implementing this interface. |
Properties
View SourceCenter
Gets a value indicating the center of the interval.
Declaration
TPoint Center { get; }
Property Value
Type | Description |
---|---|
TPoint |
Remarks
Throws when interval is unbounded.
IsClosed
Gets a value indicating whether Left and Right are both inclusive.
Declaration
bool IsClosed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsDegenerate
Gets a value indicating whether the interval represents a single point.
Declaration
bool IsDegenerate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Same as !IsProper.
IsEmpty
Gets a value indicating whether the interval represents a single point with closed endpoints.
Declaration
bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Same as !IsProper.
IsFinite
Gets a value indicating whether the interval is bounded at both ends.
Declaration
bool IsFinite { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsHalfBounded
Gets a value indicating whether the interval is unbounded at one end.
Declaration
bool IsHalfBounded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Same as !Left.Bounded || !Right.Bounded.
IsNegative
Gets a value indicating whether the interval is negative.
Declaration
bool IsNegative { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsOpen
Gets a value indicating whether neither Left nor Right are inclusive.
Declaration
bool IsOpen { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Left
Gets left endpoint value.
Declaration
TPoint Left { get; }
Property Value
Type | Description |
---|---|
TPoint |
Remarks
For convenience (same as LeftEnpoint.Point).
LeftEndpoint
Gets left interval endpoint.
Declaration
TEndpoint LeftEndpoint { get; }
Property Value
Type | Description |
---|---|
TEndpoint |
Right
Gets right endpoint value.
Declaration
TPoint Right { get; }
Property Value
Type | Description |
---|---|
TPoint |
Remarks
For convenience (same as RightEnpoint.Point).
RightEndpoint
Gets right interval endpoint.
Declaration
TEndpoint RightEndpoint { get; }
Property Value
Type | Description |
---|---|
TEndpoint |
Span
Gets the span (or "diameter") of the interval.
Declaration
TSpan Span { get; }
Property Value
Type | Description |
---|---|
TSpan |
Methods
View SourceIntersectsWith(IInterval<TPoint, TSpan, TEndpoint, T>)
Determine whether this interval intersects another.
Declaration
bool IntersectsWith(IInterval<TPoint, TSpan, TEndpoint, T> other)
Parameters
Type | Name | Description |
---|---|---|
IInterval<TPoint, TSpan, TEndpoint, T> | other | Other interval. |
Returns
Type | Description |
---|---|
System.Boolean | Whether there is an intersection. |
Remarks
Same as !Disjoint(...)
IsDisjointFrom(IInterval<TPoint, TSpan, TEndpoint, T>)
Determine whether this interval is disjoint with another.
Declaration
bool IsDisjointFrom(IInterval<TPoint, TSpan, TEndpoint, T> other)
Parameters
Type | Name | Description |
---|---|---|
IInterval<TPoint, TSpan, TEndpoint, T> | other | Other interval. |
Returns
Type | Description |
---|---|
System.Boolean | Whether there is an intersection. |
Remarks
Same as !Intersects(...)
IsProperSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T>)
Determine whether this interval is a proper subset of another.
Declaration
bool IsProperSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T> other)
Parameters
Type | Name | Description |
---|---|---|
IInterval<TPoint, TSpan, TEndpoint, T> | other | Other interval. |
Returns
Type | Description |
---|---|
System.Boolean | Whether this is a subset of the other. |
Remarks
Subset and not equal (see IsSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T>)).
IsSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T>)
Determine whether this interval is a subset of another.
Declaration
bool IsSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T> other)
Parameters
Type | Name | Description |
---|---|---|
IInterval<TPoint, TSpan, TEndpoint, T> | other | Other interval. |
Returns
Type | Description |
---|---|
System.Boolean | Whether this is a subset of the other. |
Remarks
Subset may be equal (see IsProperSubsetOf(IInterval<TPoint, TSpan, TEndpoint, T>)).
PointIsWithin(TPoint)
Determines whether a point is within the interval.
Declaration
bool PointIsWithin(TPoint point)
Parameters
Type | Name | Description |
---|---|---|
TPoint | point | Point value to be tested. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the point is within the interval. |
Remarks
Taking into account the inclusive/exclusive endpoints.
Scale(TSpan, TSpan)
Scale from left point by a span distance.
Declaration
T Scale(TSpan left, TSpan right)
Parameters
Type | Name | Description |
---|---|---|
TSpan | left | Span by which to scale left. |
TSpan | right | Span by which to scale right. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
Scale(Single, Single)
Scale from left point by a factor.
Declaration
T 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 |
---|---|
T | Scaled interval. |
ScaleCenter(TSpan)
Scale from center point by a span distance.
Declaration
T ScaleCenter(TSpan span)
Parameters
Type | Name | Description |
---|---|---|
TSpan | span | Span by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
ScaleCenter(Single)
Scale from center point by a factor.
Declaration
T ScaleCenter(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor | Factor by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
ScaleLeft(TSpan)
Scale from left point by a span distance.
Declaration
T ScaleLeft(TSpan span)
Parameters
Type | Name | Description |
---|---|---|
TSpan | span | Span by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
ScaleLeft(Single)
Scale from left point by a factor.
Declaration
T ScaleLeft(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor | Factor by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
ScaleRight(TSpan)
Scale from right point by a span distance.
Declaration
T ScaleRight(TSpan span)
Parameters
Type | Name | Description |
---|---|---|
TSpan | span | Span by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
ScaleRight(Single)
Scale from right point by a factor.
Declaration
T ScaleRight(float factor)
Parameters
Type | Name | Description |
---|---|---|
Single | factor | Factor by which to scale. |
Returns
Type | Description |
---|---|
T | Scaled interval. |
Translate(TSpan)
Translate by a span distance.
Declaration
T Translate(TSpan span)
Parameters
Type | Name | Description |
---|---|---|
TSpan | span | Span by which to translate. |
Returns
Type | Description |
---|---|
T | Translated interval. |
Remarks
Unbound points do not change.