Skip to content

T_CodeJam_Ranges_Range_1

andrewvk edited this page Nov 5, 2016 · 5 revisions

Range(T) Structure

Describes a range of the values.

Namespace: CodeJam.Ranges
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)

Syntax

C#

[SerializableAttribute]
public struct Range<T> : IRangeFactory<T, Range<T>>, 
	IRange<T>, IEquatable<Range<T>>, IFormattable

VB

<SerializableAttribute>
Public Structure Range(Of T)
	Implements IRangeFactory(Of T, Range(Of T)), 
	IRange(Of T), IEquatable(Of Range(Of T)), IFormattable

F#

[<SealedAttribute>]
[<SerializableAttribute>]
type Range<'T> =  
    struct
        interface IRangeFactory<'T, Range<'T>>
        interface IRange<'T>
        interface IEquatable<Range<'T>>
        interface IFormattable
    end

Type Parameters

 

T
The type of the value. Should implement or .
  The Range(T) type exposes the following members.

Constructors

 

Name Description
Public method Range(T)(T, T) Creates instance of
Public method Range(T)(RangeBoundaryFrom(T), RangeBoundaryTo(T)) Creates instance of
  Back to Top

Properties

 

Name Description
Public property From Boundary From. Limits the values from the left.
Public property FromValue The value of Boundary From.
Public property IsEmpty The range is empty, ∅.
Public property IsInfinite The range is Infinite range (-∞..+∞).
Public property IsNotEmpty The range is NOT empty, ≠ ∅
Public property IsSinglePoint The range is Zero length range (the values of the boundary From and the boundary To are the same).
Public property To Boundary To. Limits the values from the right.
Public property ToValue The value of Boundary To.
  Back to Top

Methods

 

Name Description
Public method Equals(Object) Indicates whether the current range and a specified object are equal. (Overrides ValueType.Equals(Object).)
Public method Equals(Range(T)) Indicates whether the current range is equal to another.
Public method GetHashCode Returns a hash code for the current range. (Overrides ValueType.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString() Returns string representation of the range. (Overrides ValueType.ToString().)
Public method ToString(IFormatProvider) Returns string representation of the range using the specified format string. If T does not implement the format string is ignored.
Public method ToString(String) Returns string representation of the range using the specified format string. If T does not implement the format string is ignored.
Public method ToString(String, IFormatProvider) Returns string representation of the range using the specified format string. If T does not implement the format string is ignored.
  Back to Top

Operators

 

Name Description
Public operatorStatic member Equality Implements the operator ==.
Public operatorStatic member Inequality Implements the operator !=.
  Back to Top

Fields

 

Name Description
Public fieldStatic member Empty Empty range, ∅
Public fieldStatic member Infinite Infinite range, (-∞..+∞)
  Back to Top

Extension Methods

 

Name Description
Public Extension Method Adjust(T) Adjusts the specified value so that it fits into a range specified. (Defined by RangeExtensions.)
Public Extension Method Contains(T)(T) Overloaded.
Determines whether the range contains the specified value. (Defined by RangeExtensions.)
Public Extension Method Contains(T)(RangeBoundaryFrom(T)) Overloaded.
Determines whether the range contains the specified range boundary. (Defined by RangeExtensions.)
Public Extension Method Contains(T)(RangeBoundaryTo(T)) Overloaded.
Determines whether the range contains the specified range boundary. (Defined by RangeExtensions.)
Public Extension Method Contains(T)(T, T) Overloaded.
Determines whether the range contains another range. (Defined by RangeExtensions.)
Public Extension Method EndsBefore(T)(T) Overloaded.
Determines whether the range ends before the value specified. (Defined by RangeExtensions.)
Public Extension Method EndsBefore(T)(RangeBoundaryFrom(T)) Overloaded.
Determines whether the range ends before the boundary specified. (Defined by RangeExtensions.)
Public Extension Method EndsBefore(T)(RangeBoundaryTo(T)) Overloaded.
Determines whether the range ends before the boundary specified. (Defined by RangeExtensions.)
Public Extension Method ExtendFrom(T)(T) Overloaded.
Extends the range from the left. (Defined by RangeExtensions.)
Public Extension Method ExtendFrom(T)(RangeBoundaryFrom(T)) Overloaded.
Extends the range from the left. (Defined by RangeExtensions.)
Public Extension Method ExtendTo(T)(T) Overloaded.
Extends the range from the right. (Defined by RangeExtensions.)
Public Extension Method ExtendTo(T)(RangeBoundaryTo(T)) Overloaded.
Extends the range from the right. (Defined by RangeExtensions.)
Public Extension Method GetComplementation(T) Returns complementation composite range. Result range contains result of (infinityRange.Exclude(range). (Defined by CompositeRangeExtensions.)
Public Extension Method HasIntersection(T)(T, T) Overloaded.
Determines whether the range has intersection with another range. (Defined by RangeExtensions.)
Public Extension Method HasIntersection(T, TRange)(TRange) Overloaded.
Determines whether the range has intersection with another range. (Defined by RangeExtensions.)
Public Extension Method Intersect(T)(T, T) Overloaded.
Returns an intersection of the the ranges. (Defined by RangeExtensions.)
Public Extension Method Intersect(T, TRange)(TRange) Overloaded.
Returns an intersection of the the ranges. (Defined by RangeExtensions.)
Public Extension Method MakeExclusive(T) Replaces inclusive boundaries with exclusive ones with the values from the selector callbacks (Defined by RangeExtensions.)
Public Extension Method MakeInclusive(T) Replaces exclusive boundaries with inclusive ones with the values from the selector callbacks (Defined by RangeExtensions.)
Public Extension Method StartsAfter(T)(T) Overloaded.
Determines whether the range starts after the value specified. (Defined by RangeExtensions.)
Public Extension Method StartsAfter(T)(RangeBoundaryFrom(T)) Overloaded.
Determines whether the range starts after the boundary specified. (Defined by RangeExtensions.)
Public Extension Method StartsAfter(T)(RangeBoundaryTo(T)) Overloaded.
Determines whether the range starts after the boundary specified. (Defined by RangeExtensions.)
Public Extension Method ToCompositeRange(T) Converts range to the composite range. (Defined by CompositeRangeExtensions.)
Public Extension Method TrimFrom(T)(T) Overloaded.
Trims the range from the left. (Defined by RangeExtensions.)
Public Extension Method TrimFrom(T)(RangeBoundaryFrom(T)) Overloaded.
Trims the range from the left. (Defined by RangeExtensions.)
Public Extension Method TrimTo(T)(T) Overloaded.
Trims the range from the right. (Defined by RangeExtensions.)
Public Extension Method TrimTo(T)(RangeBoundaryTo(T)) Overloaded.
Trims the range from the right. (Defined by RangeExtensions.)
Public Extension Method Union(T)(T, T) Overloaded.
Returns a union range containing both of the ranges. (Defined by RangeExtensions.)
Public Extension Method Union(T, TRange)(TRange) Overloaded.
Returns a union range containing both of the ranges. (Defined by RangeExtensions.)
Public Extension Method WithKey(T, TKey2) Creates a new range with the key specified. (Defined by RangeExtensions.)
Public Extension Method WithValues(T, T2)(Func(T, T2)) Overloaded.
Updates the values of the boundaries of the range. (Defined by RangeExtensions.)
Public Extension Method WithValues(T, T2)(Func(T, T2), Func(T, T2)) Overloaded.
Updates the values of the boundaries of the range. (Defined by RangeExtensions.)
  Back to Top

See Also

Reference

CodeJam.Ranges Namespace
System.IComparable(T)
System.IComparable

Clone this wiki locally