Table of Contents

Class Interval<T>

Namespace
ArcanaDevelopment.adTempus.Shared
Assembly
ArcanaDevelopment.adTempus.Shared.dll
public abstract class Interval<T>

Type Parameters

NameDescription
T
Inheritance
object
Interval<T>
Derived

Constructors

Interval(IComparer<T>)

protected Interval(IComparer<T> comparer)

Parameters

NameTypeDescription
comparer IComparer<T>

Interval(T, BoundType, T, BoundType, IComparer<T>)

protected Interval(T lowerBound, BoundType lowerBoundType, T upperBound, BoundType upperBoundType, IComparer<T> comparer)

Parameters

NameTypeDescription
lowerBound T
lowerBoundType BoundType
upperBound T
upperBoundType BoundType
comparer IComparer<T>

Properties

HasLowerBound

public bool HasLowerBound { get; }

Property Value

bool

HasUpperBound

public bool HasUpperBound { get; }

Property Value

bool

LowerBound

public T LowerBound { get; set; }

Property Value

T

LowerBoundType

public BoundType LowerBoundType { get; set; }

Property Value

BoundType

UpperBound

public T UpperBound { get; set; }

Property Value

T

UpperBoundType

public BoundType UpperBoundType { get; set; }

Property Value

BoundType

ValuePattern

Gets the Regex pattern that is used to match a value when parsing from a string.

protected abstract string ValuePattern { get; }

Property Value

string

Remarks

For example, for an integer, the ValuePattern would be "\d+".

Methods

Compare(T, T)

protected virtual int Compare(T a, T b)

Parameters

NameTypeDescription
a T
b T

Returns

int

Contains(T)

Determines whether the interval range contains the specified value.

public bool Contains(T value)

Parameters

NameTypeDescription
value T

Returns

bool

Exceptions

ArgumentNullException

Thrown if value is null.

Equals(Interval<T>)

public bool Equals(Interval<T> other)

Parameters

NameTypeDescription
other Interval<T>

Returns

bool

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

NameTypeDescription
obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

FromString(string)

Parses the interval from a string.

protected virtual void FromString(string source)

Parameters

NameTypeDescription
source string

Remarks

ParseString uses the ValuePattern to identify the value.

Exceptions

FormatException

Thrown if the source is not a valid interval representation.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ParseValue(string)

Parses a value of type T from a string value.

protected abstract T ParseValue(string value)

Parameters

NameTypeDescription
value string

Returns

T

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToString(NotationType)

public string ToString(NotationType notation)

Parameters

NameTypeDescription
notation NotationType

Returns

string

ToStringIntervalNotation()

protected virtual string ToStringIntervalNotation()

Returns

string

ToStringOperatorNotation()

protected virtual string ToStringOperatorNotation()

Returns

string