Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/08 02:08:02 (17 years ago)
Author:
swagner
Message:

Worked on ticket #41

  • added generic ItemList<T>
Location:
trunk/sources/HeuristicLab.Constraints
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Constraints/AndConstraint.cs

    r2 r40  
    2929namespace HeuristicLab.Constraints {
    3030  public class AndConstraint : ConstraintBase, IViewable {
    31     private ItemList clauses;
    32     public ItemList Clauses {
     31    private ItemList<IConstraint> clauses;
     32    public ItemList<IConstraint> Clauses {
    3333      get { return clauses; }
    3434      set {
     
    4545
    4646    public AndConstraint() {
    47       clauses = new ItemList();
    48       clauses.ItemType = typeof(IConstraint);
     47      clauses = new ItemList<IConstraint>();
    4948    }
    5049
     
    5251      bool result = true;
    5352      for (int i = 0 ; i < clauses.Count ; i++) {
    54         result = ((IConstraint)clauses[i]).Check(data);
     53        result = clauses[i].Check(data);
    5554        if (!result) return false;
    5655      }
     
    6564      AndConstraint clone = new AndConstraint();
    6665      clonedObjects.Add(Guid, clone);
    67       clone.Clauses = (ItemList)Auxiliary.Clone(Clauses, clonedObjects);
     66      clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects);
    6867      return clone;
    6968    }
     
    8483    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    8584      base.Populate(node, restoredObjects);
    86       clauses = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     85      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
    8786    }
    8887    #endregion persistence
  • trunk/sources/HeuristicLab.Constraints/AndConstraintView.Designer.cs

    r2 r40  
    4646    /// </summary>
    4747    private void InitializeComponent() {
    48       this.clausesItemListView = new HeuristicLab.Data.ItemListView();
     48      this.clausesItemListView = new HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint>();
    4949      this.SuspendLayout();
    5050      //
     
    7373    #endregion
    7474
    75     private HeuristicLab.Data.ItemListView clausesItemListView;
     75    private HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint> clausesItemListView;
    7676
    7777  }
  • trunk/sources/HeuristicLab.Constraints/ItemTypeConstraint.cs

    r2 r40  
    8181      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    8282      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);
    8784      node.Attributes.Append(itemTypeAttribute);
    8885      return node;
  • trunk/sources/HeuristicLab.Constraints/OrConstraint.cs

    r2 r40  
    2929namespace HeuristicLab.Constraints {
    3030  public class OrConstraint : ConstraintBase, IViewable {
    31     private ItemList clauses;
    32     public ItemList Clauses {
     31    private ItemList<IConstraint> clauses;
     32    public ItemList<IConstraint> Clauses {
    3333      get { return clauses; }
    3434      set {
     
    4545
    4646    public OrConstraint() {
    47       clauses = new ItemList();
    48       clauses.ItemType = typeof(IConstraint);
     47      clauses = new ItemList<IConstraint>();
    4948    }
    5049
     
    5251      bool result = false;
    5352      for (int i = 0 ; i < clauses.Count ; i++) {
    54         result = ((IConstraint)clauses[i]).Check(data);
     53        result = clauses[i].Check(data);
    5554        if (result) return true;
    5655      }
     
    6564      OrConstraint clone = new OrConstraint();
    6665      clonedObjects.Add(Guid, clone);
    67       clone.Clauses = (ItemList)Auxiliary.Clone(Clauses, clonedObjects);
     66      clone.Clauses = (ItemList<IConstraint>)Auxiliary.Clone(Clauses, clonedObjects);
    6867      return clone;
    6968    }
     
    8584    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    8685      base.Populate(node, restoredObjects);
    87       clauses = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     86      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
    8887    }
    8988    #endregion persistence
  • trunk/sources/HeuristicLab.Constraints/OrConstraintView.Designer.cs

    r2 r40  
    4646    /// </summary>
    4747    private void InitializeComponent() {
    48       this.clausesItemListView = new HeuristicLab.Data.ItemListView();
     48      this.clausesItemListView = new HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint>();
    4949      this.SuspendLayout();
    5050      //
     
    7373    #endregion
    7474
    75     private HeuristicLab.Data.ItemListView clausesItemListView;
     75    private HeuristicLab.Data.ItemListView<HeuristicLab.Core.IConstraint> clausesItemListView;
    7676  }
    7777}
Note: See TracChangeset for help on using the changeset viewer.