Class Interval<T>
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.dll
public abstract class Interval<T>
Type Parameters
| Name | Description |
|---|---|
T |
- Inheritance
-
objectInterval<T>
- Derived
Constructors
Interval(IComparer<T>)
protected Interval(IComparer<T> comparer)
Parameters
| Name | Type | Description |
|---|---|---|
comparer |
IComparer<T> |
Interval(T, BoundType, T, BoundType, IComparer<T>)
protected Interval(T lowerBound, BoundType lowerBoundType, T upperBound, BoundType upperBoundType, IComparer<T> comparer)
Parameters
| Name | Type | Description |
|---|---|---|
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
UpperBound
public T UpperBound { get; set; }
Property Value
- T
UpperBoundType
public BoundType UpperBoundType { get; set; }
Property Value
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
| Name | Type | Description |
|---|---|---|
a |
T | |
b |
T |
Returns
- int
Contains(T)
Determines whether the interval range contains the specified value.
public bool Contains(T value)
Parameters
| Name | Type | Description |
|---|---|---|
value |
T |
Returns
- bool
Exceptions
- ArgumentNullException
Thrown if
valueis null.
Equals(Interval<T>)
public bool Equals(Interval<T> other)
Parameters
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
obj |
object | The object to compare with the current object. |
Returns
FromString(string)
Parses the interval from a string.
protected virtual void FromString(string source)
Parameters
| Name | Type | Description |
|---|---|---|
source |
string |
Remarks
ParseString uses the ValuePattern to identify the value.
Exceptions
- FormatException
Thrown if the
sourceis 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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
notation |
NotationType |
Returns
- string
ToStringIntervalNotation()
protected virtual string ToStringIntervalNotation()
Returns
- string
ToStringOperatorNotation()
protected virtual string ToStringOperatorNotation()
Returns
- string