#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HeuristicLab.Core;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
using HeuristicLab.Common;
using HeuristicLab.Parameters;
using HeuristicLab.Data;
namespace HeuristicLab.Problems.Scheduling {
[Item("Indexed Tasklist", "Represents a list of tasks.")]
[StorableClass]
public class IndexedTaskList : ParameterizedNamedItem {
[StorableConstructor]
protected IndexedTaskList(bool deserializing) : base(deserializing) { }
protected IndexedTaskList(IndexedTaskList original, Cloner cloner)
: base(original, cloner) {
this.Index = cloner.Clone(original.Index);
this.Tasks = cloner.Clone(original.Tasks);
}
public override IDeepCloneable Clone(Cloner cloner) {
return new IndexedTaskList(this, cloner);
}
#region Parameter Properties
public ValueParameter IndexParameter {
get { return (ValueParameter)Parameters["Index"]; }
}
public ValueParameter> TasksParameter {
get { return (ValueParameter>)Parameters["Tasks"]; }
}
#endregion
#region Properties
public IntValue Index {
get { return IndexParameter.Value; }
set { IndexParameter.Value = value; }
}
public ItemList Tasks {
get { return TasksParameter.Value; }
set { TasksParameter.Value = value; }
}
#endregion
public IndexedTaskList (IntValue index) : base (){
Parameters.Add(new ValueParameter("Index", "The index of the resource in the associated Scheduling Problem.", new IntValue()));
Parameters.Add(new ValueParameter>("Tasks", "Taskdata defining duration, start-time and resource assignment of the tasks.", new ItemList()));
Index = index;
}
public override string ToString() {
StringBuilder sb = new StringBuilder();
sb.Append("TaskList#" + Index + " [ ");
foreach (JSSPTask t in Tasks) {
sb.Append(t.ToString() + " ");
}
sb.Append("]");
return sb.ToString();
}
}
}