Table of Contents

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

string

Duration

Duration of the interval

TimeSpan Duration { get; }

Property Value

TimeSpan

End

End time of the interval

DateTime End { get; }

Property Value

DateTime

Id

Unique identifier for this time interval

Guid Id { get; }

Property Value

Guid

Start

Start time of the interval

DateTime Start { get; }

Property Value

DateTime

Methods

Contains(ITimeInterval)

Checks if this interval completely contains another interval

bool Contains(ITimeInterval other)

Parameters

other ITimeInterval

The 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

moment DateTime

The 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

List<string>

List of validation error messages

IsAdjacentTo(ITimeInterval)

Checks if this interval is adjacent to another (touching but not overlapping)

bool IsAdjacentTo(ITimeInterval other)

Parameters

other ITimeInterval

The 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

other ITimeInterval

The 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

other ITimeInterval

The other interval to check

Returns

bool

True if intervals overlap, false otherwise