Skip to content

T_CodeJam_Ranges_RangeBoundaryTo_1

Andrew Koryavchenko edited this page Jun 17, 2018 · 4 revisions

RangeBoundaryTo(T) Structure

The To boundary of the range.

The To boundary of the range.

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

Syntax

C#

[SerializableAttribute]
public struct RangeBoundaryTo<T> : IEquatable<RangeBoundaryTo<T>>, 
	IComparable<RangeBoundaryTo<T>>, IComparable<RangeBoundaryFrom<T>>, IComparable<T>, 
	IComparable, IFormattable

VB

<SerializableAttribute>
Public Structure RangeBoundaryTo(Of T)
	Implements IEquatable(Of RangeBoundaryTo(Of T)), IComparable(Of RangeBoundaryTo(Of T)), 
	IComparable(Of RangeBoundaryFrom(Of T)), IComparable(Of T), IComparable, 
	IFormattable

F#

[<SealedAttribute>]
[<SerializableAttribute>]
type RangeBoundaryTo<'T> =  
    struct
        interface IEquatable<RangeBoundaryTo<'T>>
        interface IComparable<RangeBoundaryTo<'T>>
        interface IComparable<RangeBoundaryFrom<'T>>
        interface IComparable<'T>
        interface IComparable
        interface IFormattable
    end

Type Parameters

 

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

Constructors

 

Name Description
Public method RangeBoundaryTo(T) Creates a new range boundary.
  Back to Top

Properties

 

Name Description
Public property HasValue The boundary has a value (is not an infinite boundary).
Public property IsEmpty The boundary == ∅.
Public property IsExclusiveBoundary The boundary has value (is not an infinite boundary) but does not include the value.
Public property IsInclusiveBoundary The boundary has value (is not an infinite boundary) and does include the value.
Public property IsNotEmpty The boundary != ∅.
Public property IsPositiveInfinity The boundary == +∞.
Public property Kind The kind of the boundary.
Public property Value The value of the boundary.
  Back to Top

Methods

 

Name Description
Public methodStatic member AdjustAndCreate Infrastructure helper method to create a boundary that handles default and infinite values. The boundaryKind should be either Inclusive or Exclusive
Public method CompareTo(T) Compares the current boundary with the value of another To boundary. Following order is used: '∅' < '+∞' < 'a)' < '[a' == 'a]' < '(a' < '-∞'.
Public method CompareTo(RangeBoundaryFrom(T)) Compares the current boundary with another one. Following order is used: '∅' < '+∞' < 'a)' < '[a' == 'a]' < '(a' < '-∞'.
Public method CompareTo(RangeBoundaryTo(T)) Compares the current boundary with another one. Following order is used: '∅' < '+∞' < 'a)' < '[a' == 'a]' < '(a' < '-∞'.
Public method Equals(Object) Indicates whether the current boundary and a specified object are equal. (Overrides ValueType.Equals(Object).)
Public method Equals(RangeBoundaryTo(T)) Indicates whether the current boundary is equal to another.
Public method GetComplementation Returns complementation for the boundary. The conversions are: * 'a]' -> '(a' * '[a' -> 'a)' * 'a)' -> '[a' * '(a' -> 'a]' Empty or infinite boundaries will throw. Check the HasValue before calling the method.
Public method GetHashCode Returns the hash code for the current boundary. (Overrides ValueType.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValueOrDefault() The value of the boundary or the default(T) if HasValue property equals to false.
Public method GetValueOrDefault(T) The value of the boundary or the defaultValue if HasValue property equals to false.
Public method IsComplementationFor Checks that the boundary is complementation for specified boundary.
Public methodStatic member IsValid Infrastructure helper method to check if the value can be used as the value of the boundary.
Public method ToExclusive Creates a new boundary with exclusive boundary kind if the current boundary has a value. The original boundary is returned otherwise.
Public method ToInclusive Creates a new boundary with inclusive boundary kind if the current boundary has a value. The original boundary is returned otherwise.
Public method ToString() Returns string representation of the boundary. (Overrides ValueType.ToString().)
Public method ToString(String) Returns string representation of the boundary 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 boundary using the specified format string. If T does not implement the format string is ignored
Public method WithValue(Func(T, T)) Creates a new boundary with updated value (if the current boundary has one). If the boundary has no value the method returns the boundary unchanged.
Public method WithValue(T2)(Func(T, T2)) Creates a new boundary with updated value (if the current boundary has one). If the boundary has no value the method returns the boundary unchanged.
  Back to Top

Operators

 

Name Description
Public operatorStatic member Equality Implements the operator ==.
Public operatorStatic member GreaterThan(T, RangeBoundaryTo(T)) Implements the operator >.
Public operatorStatic member GreaterThan(RangeBoundaryTo(T), RangeBoundaryFrom(T)) Implements the operator >.
Public operatorStatic member GreaterThan(RangeBoundaryTo(T), RangeBoundaryTo(T)) Implements the operator >.
Public operatorStatic member GreaterThan(RangeBoundaryTo(T), T) Implements the operator >.
Public operatorStatic member GreaterThanOrEqual(T, RangeBoundaryTo(T)) Implements the operator >=.
Public operatorStatic member GreaterThanOrEqual(RangeBoundaryTo(T), RangeBoundaryFrom(T)) Implements the operator >=.
Public operatorStatic member GreaterThanOrEqual(RangeBoundaryTo(T), RangeBoundaryTo(T)) Implements the operator >=.
Public operatorStatic member GreaterThanOrEqual(RangeBoundaryTo(T), T) Implements the operator >=.
Public operatorStatic member Inequality Implements the operator !=.
Public operatorStatic member LessThan(T, RangeBoundaryTo(T)) Implements the operator <.
Public operatorStatic member LessThan(RangeBoundaryTo(T), RangeBoundaryFrom(T)) Implements the operator <.
Public operatorStatic member LessThan(RangeBoundaryTo(T), RangeBoundaryTo(T)) Implements the operator <.
Public operatorStatic member LessThan(RangeBoundaryTo(T), T) Implements the operator <.
Public operatorStatic member LessThanOrEqual(T, RangeBoundaryTo(T)) Implements the operator <=.
Public operatorStatic member LessThanOrEqual(RangeBoundaryTo(T), RangeBoundaryFrom(T)) Implements the operator <=.
Public operatorStatic member LessThanOrEqual(RangeBoundaryTo(T), RangeBoundaryTo(T)) Implements the operator <=.
Public operatorStatic member LessThanOrEqual(RangeBoundaryTo(T), T) Implements the operator <=.
  Back to Top

Fields

 

Name Description
Public fieldStatic member Empty Empty range boundary, ∅.
Public fieldStatic member PositiveInfinity Positive infinity, +∞.
  Back to Top

Remarks

Heavy tuned to be as fast as it is possible. The order of borders is the following: '∅' < '+∞' < 'a)' < '[a' == 'a]' < '(a' < '-∞'.

See Also

Reference

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

Clone this wiki locally