1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 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.ComponentModel;
|
---|
24 | using HeuristicLab.Common;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.Clients.Hive {
|
---|
27 | public partial class Job : IDeepCloneable, IContent {
|
---|
28 |
|
---|
29 | private bool isPrivileged;
|
---|
30 | public bool IsPrivileged {
|
---|
31 | get { return isPrivileged; }
|
---|
32 | set { isPrivileged = value; }
|
---|
33 | }
|
---|
34 |
|
---|
35 | #region Constructors and Cloning
|
---|
36 | public Job() {
|
---|
37 | this.ResourceNames = "HEAL";
|
---|
38 | this.DateCreated = DateTime.Now;
|
---|
39 | this.Permission = Permission.Full;
|
---|
40 | }
|
---|
41 |
|
---|
42 | protected Job(Job original, Cloner cloner) {
|
---|
43 | cloner.RegisterClonedObject(original, this);
|
---|
44 | this.OwnerUserId = original.OwnerUserId;
|
---|
45 | this.DateCreated = original.DateCreated;
|
---|
46 | this.ResourceNames = original.ResourceNames;
|
---|
47 | this.Name = original.Name;
|
---|
48 | this.Description = original.Description;
|
---|
49 | this.Id = original.Id;
|
---|
50 | this.IsPrivileged = original.IsPrivileged;
|
---|
51 | this.Permission = original.Permission;
|
---|
52 | }
|
---|
53 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
54 | return new Job(this, cloner);
|
---|
55 | }
|
---|
56 | #endregion
|
---|
57 |
|
---|
58 | #region Events
|
---|
59 | public event EventHandler StateLogListChanged;
|
---|
60 | private void OnStateLogListChanged() {
|
---|
61 | var handler = StateLogListChanged;
|
---|
62 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
63 | }
|
---|
64 | #endregion
|
---|
65 |
|
---|
66 | protected override void OnPropertyChanged(PropertyChangedEventArgs e) {
|
---|
67 | base.OnPropertyChanged(e);
|
---|
68 | if (e.PropertyName == "Name") {
|
---|
69 | OnToStringChanged();
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | protected override void RaisePropertyChanged(string propertyName) {
|
---|
74 | if (!(propertyName == "ExecutionTime")
|
---|
75 | && !(propertyName == "JobCount")
|
---|
76 | && !(propertyName == "CalculatingCount")
|
---|
77 | && !(propertyName == "FinishedCount")) {
|
---|
78 | base.RaisePropertyChanged(propertyName);
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 | public override string ToString() {
|
---|
83 | return Name;
|
---|
84 | }
|
---|
85 | }
|
---|
86 | }
|
---|