zaaReloaded2/zaaReloaded2/LabModel/Laboratory.cs

72 lines
2.0 KiB
C#
Raw Normal View History

2015-07-06 13:48:43 +00:00
/* Laboratory.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace zaaReloaded2.LabModel
{
/// <summary>
/// Holds laboratory items grouped by time points.
/// </summary>
public class Laboratory
{
#region Properties
public SortedDictionary<DateTime, TimePoint> TimePoints { get; set; }
#endregion
2015-07-11 14:51:02 +00:00
#region Constructor
public Laboratory()
{
TimePoints = new SortedDictionary<DateTime, TimePoint>();
}
#endregion
#region Methods
/// <summary>
/// Adds a new time point with laboratory items to the laboratory.
/// If a time point with same time stamp exists already, the new
/// items will be added to the existing ones.
/// </summary>
/// <param name="timePoint">Time point to add to the laboratory.</param>
public void AddTimePoint(TimePoint timePoint)
{
if (timePoint == null)
throw new ArgumentNullException("timePoint");
TimePoint tp;
if (TimePoints.TryGetValue(timePoint.TimeStamp, out tp))
{
tp.MergeItems(timePoint);
}
else
{
TimePoints[timePoint.TimeStamp] = timePoint;
}
}
#endregion
2015-07-06 13:48:43 +00:00
}
}