Changeset 40 for trunk/sources/HeuristicLab.Constraints
- Timestamp:
- 03/05/08 02:08:02 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.Constraints
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Constraints/AndConstraint.cs
r2 r40 29 29 namespace HeuristicLab.Constraints { 30 30 public class AndConstraint : ConstraintBase, IViewable { 31 private ItemList clauses;32 public ItemList Clauses {31 private ItemList<IConstraint> clauses; 32 public ItemList<IConstraint> Clauses { 33 33 get { return clauses; } 34 34 set { … … 45 45 46 46 public AndConstraint() { 47 clauses = new ItemList(); 48 clauses.ItemType = typeof(IConstraint); 47 clauses = new ItemList<IConstraint>(); 49 48 } 50 49 … … 52 51 bool result = true; 53 52 for (int i = 0 ; i < clauses.Count ; i++) { 54 result = ((IConstraint)clauses[i]).Check(data);53 result = clauses[i].Check(data); 55 54 if (!result) return false; 56 55 } … … 65 64 AndConstraint clone = new AndConstraint(); 66 65 clonedObjects.Add(Guid, clone); 67 clone.Clauses = (ItemList )Auxiliary.Clone(Clauses, clonedObjects);66 clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects); 68 67 return clone; 69 68 } … … 84 83 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 85 84 base.Populate(node, restoredObjects); 86 clauses = (ItemList )PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);85 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 87 86 } 88 87 #endregion persistence -
trunk/sources/HeuristicLab.Constraints/AndConstraintView.Designer.cs
r2 r40 46 46 /// </summary> 47 47 private void InitializeComponent() { 48 this.clausesItemListView = new HeuristicLab.Data.ItemListView ();48 this.clausesItemListView = new HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint>(); 49 49 this.SuspendLayout(); 50 50 // … … 73 73 #endregion 74 74 75 private HeuristicLab.Data.ItemListView clausesItemListView;75 private HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint> clausesItemListView; 76 76 77 77 } -
trunk/sources/HeuristicLab.Constraints/ItemTypeConstraint.cs
r2 r40 81 81 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 82 82 XmlAttribute itemTypeAttribute = document.CreateAttribute("ItemType"); 83 string typeString = Type.AssemblyQualifiedName; 84 string[] tokens = typeString.Split(new string[] { ", " }, StringSplitOptions.None); 85 typeString = tokens[0] + ", " + tokens[1]; 86 itemTypeAttribute.Value = typeString; 83 itemTypeAttribute.Value = PersistenceManager.BuildTypeString(Type); 87 84 node.Attributes.Append(itemTypeAttribute); 88 85 return node; -
trunk/sources/HeuristicLab.Constraints/OrConstraint.cs
r2 r40 29 29 namespace HeuristicLab.Constraints { 30 30 public class OrConstraint : ConstraintBase, IViewable { 31 private ItemList clauses;32 public ItemList Clauses {31 private ItemList<IConstraint> clauses; 32 public ItemList<IConstraint> Clauses { 33 33 get { return clauses; } 34 34 set { … … 45 45 46 46 public OrConstraint() { 47 clauses = new ItemList(); 48 clauses.ItemType = typeof(IConstraint); 47 clauses = new ItemList<IConstraint>(); 49 48 } 50 49 … … 52 51 bool result = false; 53 52 for (int i = 0 ; i < clauses.Count ; i++) { 54 result = ((IConstraint)clauses[i]).Check(data);53 result = clauses[i].Check(data); 55 54 if (result) return true; 56 55 } … … 65 64 OrConstraint clone = new OrConstraint(); 66 65 clonedObjects.Add(Guid, clone); 67 clone.Clauses = (ItemList )Auxiliary.Clone(Clauses, clonedObjects);66 clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects); 68 67 return clone; 69 68 } … … 85 84 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 86 85 base.Populate(node, restoredObjects); 87 clauses = (ItemList )PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);86 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 88 87 } 89 88 #endregion persistence -
trunk/sources/HeuristicLab.Constraints/OrConstraintView.Designer.cs
r2 r40 46 46 /// </summary> 47 47 private void InitializeComponent() { 48 this.clausesItemListView = new HeuristicLab.Data.ItemListView ();48 this.clausesItemListView = new HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint>(); 49 49 this.SuspendLayout(); 50 50 // … … 73 73 #endregion 74 74 75 private HeuristicLab.Data.ItemListView clausesItemListView;75 private HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint> clausesItemListView; 76 76 } 77 77 }
Note: See TracChangeset
for help on using the changeset viewer.