Last change
on this file since 10450 was
10450,
checked in by abeham, 10 years ago
|
#1610: Added a base infrastructure for discrete event simulation
|
File size:
1.0 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using HeuristicLab.Common;
|
---|
3 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.SimulationCore {
|
---|
6 | [StorableClass]
|
---|
7 | public sealed class ModelTimeUpdateAction<TModel> : Action<TModel> where TModel : IModel {
|
---|
8 | public static readonly Guid Id = new Guid("1dd664ec-809d-494b-a96b-567696a59a5b");
|
---|
9 | public override Guid ActionId {
|
---|
10 | get { return Id; }
|
---|
11 | }
|
---|
12 |
|
---|
13 | public double NextTime { get; private set; }
|
---|
14 |
|
---|
15 | [StorableConstructor]
|
---|
16 | private ModelTimeUpdateAction(bool deserializing) : base(deserializing) { }
|
---|
17 | private ModelTimeUpdateAction(Action<TModel> original, Cloner cloner) : base(original, cloner) { }
|
---|
18 | public ModelTimeUpdateAction(IActivity<TModel> mandate, double nextTime)
|
---|
19 | : base(mandate) {
|
---|
20 | NextTime = nextTime;
|
---|
21 | }
|
---|
22 |
|
---|
23 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
24 | return new ModelTimeUpdateAction<TModel>(this, cloner);
|
---|
25 | }
|
---|
26 |
|
---|
27 | public override void Execute(TModel model) {
|
---|
28 | model.CurrentTime = NextTime;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.