Line | |
---|
1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.SimulationCore {
|
---|
5 | [StorableClass]
|
---|
6 | public sealed class Event<TModel> : IEvent<TModel> where TModel : IModel {
|
---|
7 | private double time;
|
---|
8 | public double Time { get { return time; } }
|
---|
9 |
|
---|
10 | public IAction<TModel> Action { get; private set; }
|
---|
11 |
|
---|
12 | #region Storable Properties
|
---|
13 | // ReSharper disable UnusedMember.Local
|
---|
14 | // ReSharper disable UnusedParameter.Local
|
---|
15 | [Storable]
|
---|
16 | private double StorableTime {
|
---|
17 | get { return time; }
|
---|
18 | set { time = value; }
|
---|
19 | }
|
---|
20 | [Storable]
|
---|
21 | private IAction<TModel> StorableActions {
|
---|
22 | get { return Action; }
|
---|
23 | set { Action = value; }
|
---|
24 | }
|
---|
25 | [StorableConstructor]
|
---|
26 | private Event(bool deserializing) { }
|
---|
27 | // ReSharper restore UnusedParameter.Local
|
---|
28 | // ReSharper restore UnusedMember.Local
|
---|
29 | #endregion
|
---|
30 |
|
---|
31 | private Event(Event<TModel> original, Cloner cloner) {
|
---|
32 | cloner.RegisterClonedObject(original, this);
|
---|
33 | time = original.time;
|
---|
34 | Action = cloner.Clone(original.Action);
|
---|
35 | }
|
---|
36 | public Event(double time) {
|
---|
37 | this.time = time;
|
---|
38 | }
|
---|
39 | public Event(double time, IAction<TModel> action) {
|
---|
40 | this.time = time;
|
---|
41 | this.Action = action;
|
---|
42 | }
|
---|
43 |
|
---|
44 | public object Clone() { return Clone(new Cloner()); }
|
---|
45 | public IDeepCloneable Clone(Cloner cloner) {
|
---|
46 | return new Event<TModel>(this, cloner);
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.