1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.ComponentModel;
|
---|
25 | using HeuristicLab.Common;
|
---|
26 |
|
---|
27 | namespace HeuristicLab.Clients.Hive {
|
---|
28 | public partial class Job : IDeepCloneable, IContent {
|
---|
29 | public List<Guid> ResourceIds { get; set; }
|
---|
30 |
|
---|
31 | #region Constructors and Cloning
|
---|
32 | public Job() {
|
---|
33 | ProjectId = Guid.Empty;
|
---|
34 | DateCreated = DateTime.Now;
|
---|
35 | Permission = Permission.Full;
|
---|
36 | }
|
---|
37 |
|
---|
38 | protected Job(Job original, Cloner cloner) {
|
---|
39 | cloner.RegisterClonedObject(original, this);
|
---|
40 | this.OwnerUserId = original.OwnerUserId;
|
---|
41 | this.DateCreated = original.DateCreated;
|
---|
42 | this.ProjectId = original.ProjectId;
|
---|
43 | this.Name = original.Name;
|
---|
44 | this.Description = original.Description;
|
---|
45 | this.Id = original.Id;
|
---|
46 | this.Permission = original.Permission;
|
---|
47 | this.ResourceIds = original.ResourceIds;
|
---|
48 | }
|
---|
49 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
50 | return new Job(this, cloner);
|
---|
51 | }
|
---|
52 | #endregion
|
---|
53 |
|
---|
54 | #region Events
|
---|
55 | public event EventHandler StateLogListChanged;
|
---|
56 | private void OnStateLogListChanged() {
|
---|
57 | var handler = StateLogListChanged;
|
---|
58 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
59 | }
|
---|
60 | #endregion
|
---|
61 |
|
---|
62 | protected override void OnPropertyChanged(PropertyChangedEventArgs e) {
|
---|
63 | base.OnPropertyChanged(e);
|
---|
64 | if (e.PropertyName == "Name") {
|
---|
65 | OnToStringChanged();
|
---|
66 | }
|
---|
67 | }
|
---|
68 |
|
---|
69 | protected override void RaisePropertyChanged(string propertyName) {
|
---|
70 | if (!(propertyName == "ExecutionTime")
|
---|
71 | && !(propertyName == "JobCount")
|
---|
72 | && !(propertyName == "CalculatingCount")
|
---|
73 | && !(propertyName == "FinishedCount")) {
|
---|
74 | base.RaisePropertyChanged(propertyName);
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|
78 | public override string ToString() {
|
---|
79 | return Name;
|
---|
80 | }
|
---|
81 | }
|
---|
82 | }
|
---|