Free cookie consent management tool by TermsFeed Policy Generator

source: branches/1955_DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/DomainModel/BaseObject.cs @ 16654

Last change on this file since 16654 was 8670, checked in by svonolfe, 12 years ago

Added first version of the dynamic vehicle routing addon (#1955)

File size: 963 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
7using HeuristicLab.Common;
8
9namespace HeuristicLab.PDPSimulation.DomainModel {
10  [StorableClass]
11  public abstract class BaseObject: Item {
12    [Storable]
13    public Guid Id { get; set; }
14
15    public BaseObject() {
16      Id = Guid.NewGuid();
17    }
18
19    [StorableConstructor]
20    protected BaseObject(bool deserializing) : base(deserializing) { }
21    protected BaseObject(BaseObject original, Cloner cloner)
22      : base(original, cloner) {
23        Id = original.Id;
24    }
25
26    public override bool Equals(object obj) {
27      if (obj is BaseObject) {
28        return Id == (obj as BaseObject).Id;
29      } else {
30        return base.Equals(obj);
31      }
32    }
33
34    public override int GetHashCode() {
35      return Id.GetHashCode();
36    }
37  }
38}
Note: See TracBrowser for help on using the repository browser.