using System;
using System.Collections.Generic;
using System.Text;
using CategoryTheory;
using Motion6D;
namespace AggregateLibrary
{
/// <summary>
/// Factory of aggregates
/// </summary>
public class AggregateFactory : IObjectFactory
{
#region Fields
/// <summary>
/// Singleton
/// </summary>
public static readonly IObjectFactory Object = new AggregateFactory();
/// <summary>
/// Names of objects
/// </summary>
public static readonly string[] Names = new string[] { "Rigid body", "Rigid body (Vector Interface)", "Elastic console", "Flywheel" };
#endregion
#region Ctor
/// <summary>
/// Default constructor
/// </summary>
private AggregateFactory()
{
}
#endregion
#region IObjectFactory Members
string[] IObjectFactory.Names
{
get { return Names; }
}
ICategoryObject IObjectFactory.this[string name]
{
get
{
if (name.Equals(Names[0]))
{
return new AggregableWrapper(new RigidBody());
}
if (name.Equals(Names[1]))
{
return new AggregableWrapper(new ForcedRigidBody());
}
if (name.Equals(Names[2]))
{
return new AggregableWrapper(new ElasticConsole());
}
if (name.Equals(Names[3]))
{
return new AggregableWrapper(new FlyWheel());
}
return null;
}
}
#endregion
}
}