using System; using System.Collections.Generic; using System.Linq; using HeuristicLab.Common; using HeuristicLab.SimulationCore; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Simulation { [StorableClass] partial class Model1 : IModel { [Storable] public double CurrentTime { get; set; } private Model1(Model1 original, Cloner cloner) { cloner.RegisterClonedObject(original, this); CurrentTime = original.CurrentTime; } public Model1() { } public object Clone() { return Clone(new Cloner()); } public IDeepCloneable Clone(Cloner cloner) { return new Model1(this, cloner); } } [StorableClass] partial class Activity1 : HeuristicLab.SimulationCore.Activity { public override IEnumerable MonitoredActions { get { return new[] { typeof(Action4) }; } } [StorableConstructor] private Activity1(bool deserializing) : base(deserializing) { } private Activity1(Activity1 original, Cloner cloner) : base(original, cloner) { } public Activity1() : base(new SortedListEventQueue()) { } public override void ManageEvents(Model1 model, IAction lastAction) { if (lastAction is Action4) ProcessAction4(model, (Action4)lastAction); } private void EnqueueAction1(double time, Action1 action) { EventQueue.Push(time, action); } public override IDeepCloneable Clone(Cloner cloner) { return new Activity1(this, cloner); } } [StorableClass] partial class Activity2 : HeuristicLab.SimulationCore.Activity { public override IEnumerable MonitoredActions { get { return new[] { typeof(Action1) }; } } [StorableConstructor] private Activity2(bool deserializing) : base(deserializing) { } private Activity2(Activity2 original, Cloner cloner) : base(original, cloner) { } public Activity2() : base(new SortedListEventQueue()) { } public override void ManageEvents(Model1 model, IAction lastAction) { if (lastAction is Action1) ProcessAction1(model, (Action1)lastAction); } private void EnqueueAction2(double time, Action2 action) { EventQueue.Push(time, action); } private void EnqueueAction3(double time, Action3 action) { EventQueue.Push(time, action); } public override IDeepCloneable Clone(Cloner cloner) { return new Activity2(this, cloner); } } [StorableClass] partial class Activity3 : HeuristicLab.SimulationCore.Activity { public override IEnumerable MonitoredActions { get { return new[] { typeof(Action1), typeof(Action2) }; } } [StorableConstructor] private Activity3(bool deserializing) : base(deserializing) { } private Activity3(Activity3 original, Cloner cloner) : base(original, cloner) { } public Activity3() : base(new SortedListEventQueue()) { } public override void ManageEvents(Model1 model, IAction lastAction) { if (lastAction is Action1) ProcessAction1(model, (Action1)lastAction); if (lastAction is Action2) ProcessAction2(model, (Action2)lastAction); } private void EnqueueAction4(double time, Action4 action) { EventQueue.Push(time, action); } public override IDeepCloneable Clone(Cloner cloner) { return new Activity3(this, cloner); } } [StorableClass] partial class Action1 : HeuristicLab.SimulationCore.Action { private Action1(Action1 original, Cloner cloner) : base(original, cloner) { } public Action1() { } public override IDeepCloneable Clone(Cloner cloner) { return new Action1(this, cloner); } } [StorableClass] partial class Action2 : HeuristicLab.SimulationCore.Action { private Action2(Action2 original, Cloner cloner) : base(original, cloner) { } public Action2() { } public override IDeepCloneable Clone(Cloner cloner) { return new Action2(this, cloner); } } [StorableClass] partial class Action3 : HeuristicLab.SimulationCore.Action { private Action3(Action3 original, Cloner cloner) : base(original, cloner) { } public Action3() { } public override IDeepCloneable Clone(Cloner cloner) { return new Action3(this, cloner); } } [StorableClass] partial class Action4 : HeuristicLab.SimulationCore.Action { private Action4(Action4 original, Cloner cloner) : base(original, cloner) { } public Action4() { } public override IDeepCloneable Clone(Cloner cloner) { return new Action4(this, cloner); } } }