zaaReloaded2/zaaReloaded2/Formatter/TimePointFormatter.cs

77 lines
2.3 KiB
C#
Raw Normal View History

2015-07-13 21:57:35 +00:00
/* TimePointFormatter.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;
using zaaReloaded2.LabModel;
namespace zaaReloaded2.Formatter
{
/// <summary>
/// Creates a list of ItemFormatter objects from a TimePoint.
/// </summary>
public class TimePointFormatter
{
#region Properties
/// <summary>
/// Gets the time stamp of the <see cref="TimePoint"/> from which this
/// TimePointFormatter was built.
/// </summary>
public DateTime TimeStamp { get; private set; }
/// <summary>
/// Gets a dictionary of ItemFormatter objects that wrap LabItems.
/// The QualifiedName of each LabItem is used as key.
/// </summary>
public IItemFormatterDictionary ItemFormatters { get; private set; }
#endregion
#region Constructor
/// <summary>
/// Creates a new TimePointFormatter object using a given
/// <paramref name="timePoint"/>.
/// </summary>
/// <param name="timePoint">TimePoint whose LabItems will be
/// used to create ItemFormatter objects.</param>
public TimePointFormatter(TimePoint timePoint, ReferenceStyle referenceStyle)
{
TimeStamp = timePoint.TimeStamp;
ItemFormatters = new ItemFormatterDictionary();
foreach (LabItem item in timePoint.Items.Values)
{
ItemFormatters[item.QualifiedName] = new ItemFormatter(item, referenceStyle);
}
}
#endregion
#region Methods
public bool ContainsItem(string itemName)
{
return ItemFormatters.ContainsKey(itemName);
}
#endregion
}
}