Crystal AI  1.0.0
Crystal.Interval< T > Class Template Reference

Represents an interval of the form [a, b] or (a, b) or any combination of exclusive and inclusive end points. More...

Public Member Functions

bool Contains (T point)
 Check if given point lies within the interval. More...
 
override string ToString ()
 Convert to mathematical notation using open and closed parenthesis: (, ), [, and ]. More...
 
 Interval (T lowerbound, T upperbound, IntervalType lowerboundIntervalType=IntervalType.Closed, IntervalType upperboundIntervalType=IntervalType.Closed)
 Initializes a new instance of the Interval<T> struct. More...
 

Static Public Member Functions

static Interval< int > Create (int lowerbound, int upperbound, IntervalType lowerboundIntervalType=IntervalType.Closed, IntervalType upperboundIntervalType=IntervalType.Closed)
 Creates an interval of integers. More...
 
static Interval< float > Create (float lowerbound, float upperbound, IntervalType lowerboundIntervalType=IntervalType.Closed, IntervalType upperboundIntervalType=IntervalType.Closed)
 Creates an interval of single precision floating point numbers. More...
 
static Interval< double > Create (double lowerbound, double upperbound, IntervalType lowerboundIntervalType=IntervalType.Closed, IntervalType upperboundIntervalType=IntervalType.Closed)
 Creates an interval of double precision floating point numbers. More...
 

Properties

LowerBound [get]
 Lower bound of the interval. More...
 
UpperBound [get]
 Upper bound of the interval. More...
 
IntervalType LowerBoundType [get]
 The type of the lower bound of this interval. This can either be F:Crystal.IntervalType.Open or F:Crystal.IntervalType.Closed. More...
 
IntervalType UpperBoundType [get]
 The type of the upper bound of this interval. This can either be F:Crystal.IntervalType.Open or F:Crystal.IntervalType.Closed. More...
 

Detailed Description

Represents an interval of the form [a, b] or (a, b) or any combination of exclusive and inclusive end points.

Static class to generate regular Intervals using common types.

This is a vector-less interval, therefore if the end element is larger than the start element, the interval will swap the two ends around such that a is always lt; b.

Type Constraints
T :struct 
T :IComparable 

Constructor & Destructor Documentation

Crystal.Interval< T >.Interval ( lowerbound,
upperbound,
IntervalType  lowerboundIntervalType = IntervalType.Closed,
IntervalType  upperboundIntervalType = IntervalType.Closed 
)
inline

Initializes a new instance of the Interval<T> struct.

Parameters
lowerboundThe lower bound.
upperboundThe upper bound.
lowerboundIntervalTypeType of the lower bound of the interval.
upperboundIntervalTypeType of the upper bound of the interval.

Member Function Documentation

bool Crystal.Interval< T >.Contains ( point)
inline

Check if given point lies within the interval.

Parameters
pointPoint to check
Returns
True if point lies within the interval, otherwise false
static Interval<int> Crystal.Interval< T >.Create ( int  lowerbound,
int  upperbound,
IntervalType  lowerboundIntervalType = IntervalType.Closed,
IntervalType  upperboundIntervalType = IntervalType.Closed 
)
inlinestatic

Creates an interval of integers.

Parameters
lowerboundThe lower bound.
upperboundThe upper bound.
lowerboundIntervalTypeType of the lower bound of the interval.
upperboundIntervalTypeType of the upper bound of the interval.
Returns
static Interval<float> Crystal.Interval< T >.Create ( float  lowerbound,
float  upperbound,
IntervalType  lowerboundIntervalType = IntervalType.Closed,
IntervalType  upperboundIntervalType = IntervalType.Closed 
)
inlinestatic

Creates an interval of single precision floating point numbers.

Parameters
lowerboundThe lower bound.
upperboundThe upper bound.
lowerboundIntervalTypeType of the lower bound of the interval.
upperboundIntervalTypeType of the upper bound of the interval.
Returns
static Interval<double> Crystal.Interval< T >.Create ( double  lowerbound,
double  upperbound,
IntervalType  lowerboundIntervalType = IntervalType.Closed,
IntervalType  upperboundIntervalType = IntervalType.Closed 
)
inlinestatic

Creates an interval of double precision floating point numbers.

Parameters
lowerboundThe lower bound.
upperboundThe upper bound.
lowerboundIntervalTypeType of the lower bound of the interval.
upperboundIntervalTypeType of the upper bound of the interval.
Returns
override string Crystal.Interval< T >.ToString ( )
inline

Convert to mathematical notation using open and closed parenthesis: (, ), [, and ].

Returns

Property Documentation

T Crystal.Interval< T >.LowerBound
get

Lower bound of the interval.

IntervalType Crystal.Interval< T >.LowerBoundType
get

The type of the lower bound of this interval. This can either be F:Crystal.IntervalType.Open or F:Crystal.IntervalType.Closed.

T Crystal.Interval< T >.UpperBound
get

Upper bound of the interval.

IntervalType Crystal.Interval< T >.UpperBoundType
get

The type of the upper bound of this interval. This can either be F:Crystal.IntervalType.Open or F:Crystal.IntervalType.Closed.


The documentation for this class was generated from the following file: