75 lines
No EOL
2.4 KiB
C#
75 lines
No EOL
2.4 KiB
C#
namespace ExamCalendar;
|
|
|
|
/// <summary>
|
|
/// Represents a linked list of exams
|
|
/// </summary>
|
|
public sealed class ExamList
|
|
{
|
|
//private Node? _head;
|
|
|
|
/// <summary>
|
|
/// Gets the number of exams currently stored in the list
|
|
/// </summary>
|
|
public int Count { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Insert a new exam into the list. Exams are stored sorted by their date.
|
|
/// Exams cannot occur on weekends, must have a subject and cannot be null.
|
|
/// There also cannot be two exams at the same day.
|
|
/// </summary>
|
|
/// <param name="exam">Exam to add</param>
|
|
/// <returns>True if the exam could be added; false otherwise</returns>
|
|
public bool Insert(Exam? exam)
|
|
{
|
|
// TODO
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the exam at the specified position if there is any
|
|
/// </summary>
|
|
/// <param name="position">Index of the exam in the list</param>
|
|
/// <returns>The exam at this position or null if there is none</returns>
|
|
public Exam? GetAt(int position)
|
|
{
|
|
// TODO
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns an array containing the exams stored in this list.
|
|
/// This array contains the references, not copies.
|
|
/// </summary>
|
|
/// <returns>An array containing the elements of the list</returns>
|
|
public Exam[] ToArray()
|
|
{
|
|
// TODO
|
|
return [];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns exams within the specified time frame
|
|
/// </summary>
|
|
/// <param name="from">Inclusive lower bound</param>
|
|
/// <param name="to">Inclusive upper bound</param>
|
|
/// <returns>An array of exams which are planned in the specified time frame</returns>
|
|
public Exam[] GetTestsInInterval(DateTime from, DateTime to)
|
|
{
|
|
// TODO
|
|
return [];
|
|
}
|
|
|
|
/// <summary>
|
|
/// Removes and returns the exam which is planned at the specified date from the list.
|
|
/// Exam can only be removed if it exists.
|
|
/// </summary>
|
|
/// <param name="removeDate">Date of the exam which to remove</param>
|
|
/// <param name="removedTest">Reference to the removed exam, if any</param>
|
|
/// <returns>True if the exam could be removed; false otherwise</returns>
|
|
public bool Remove(DateTime removeDate, out Exam? removedTest)
|
|
{
|
|
// TODO
|
|
removedTest = null;
|
|
return false;
|
|
}
|
|
} |