Interface ITimeInterval
- Namespace
- Core.CliniCore.Scheduling
- Assembly
- Core.CliniCore.dll
Interface defining contract for objects representing distinct intervals in time
public interface ITimeInterval
Properties
Description
Description or title of this time interval
string Description { get; }
Property Value
Duration
Duration of the interval
TimeSpan Duration { get; }
Property Value
End
End time of the interval
DateTime End { get; }
Property Value
Id
Unique identifier for this time interval
Guid Id { get; }
Property Value
Start
Start time of the interval
DateTime Start { get; }
Property Value
Methods
Contains(ITimeInterval)
Checks if this interval completely contains another interval
bool Contains(ITimeInterval other)
Parameters
otherITimeIntervalThe other interval to check
Returns
- bool
True if this interval completely contains the other
Contains(DateTime)
Checks if this interval contains a specific point in time
bool Contains(DateTime moment)
Parameters
momentDateTimeThe point in time to check
Returns
- bool
True if the moment is within this interval
GetValidationErrors()
Gets validation errors if the interval is not valid
List<string> GetValidationErrors()
Returns
IsAdjacentTo(ITimeInterval)
Checks if this interval is adjacent to another (touching but not overlapping)
bool IsAdjacentTo(ITimeInterval other)
Parameters
otherITimeIntervalThe other interval to check
Returns
- bool
True if intervals are adjacent
IsValid()
Validates that the interval is valid (end after start, reasonable duration, etc.)
bool IsValid()
Returns
- bool
True if valid, false otherwise
IsWithinBusinessHours()
Checks if this interval occurs within business hours
bool IsWithinBusinessHours()
Returns
- bool
True if within business hours (M-F 8am-5pm)
MergeWith(ITimeInterval)
Attempts to merge with another interval if they overlap or are adjacent
ITimeInterval? MergeWith(ITimeInterval other)
Parameters
otherITimeIntervalThe other interval to merge with
Returns
- ITimeInterval
A new merged interval if possible, null otherwise
Overlaps(ITimeInterval)
Checks if this interval overlaps with another
bool Overlaps(ITimeInterval other)
Parameters
otherITimeIntervalThe other interval to check
Returns
- bool
True if intervals overlap, false otherwise