Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/09/11 11:01:08 (13 years ago)
Author:
mkommend
Message:

#1479: Updated grammar editor branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Encodings.PermutationEncoding/3.3/Permutation.cs

    r5445 r6647  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
     
    3637    public PermutationTypes PermutationType {
    3738      get { return permutationType; }
     39      set {
     40        bool changed = (permutationType != value);
     41        permutationType = value;
     42        if (changed) OnPermutationTypeChanged();
     43      }
    3844    }
    3945
     
    4551    }
    4652    public Permutation() : this(PermutationTypes.RelativeUndirected) { }
    47     public Permutation(PermutationTypes type) : base() {
     53    public Permutation(PermutationTypes type)
     54      : base() {
    4855      permutationType = type;
    4956    }
     
    5865      Randomize(random);
    5966    }
    60     public Permutation(PermutationTypes type, int[] elements) : base(elements) {
     67    public Permutation(PermutationTypes type, int[] elements)
     68      : base(elements) {
    6169      permutationType = type;
    6270    }
    63     public Permutation(PermutationTypes type, IntArray elements) : this(type, elements.Length) {
     71    public Permutation(PermutationTypes type, IntArray elements)
     72      : this(type, elements.Length) {
    6473      for (int i = 0; i < array.Length; i++)
    6574        array[i] = elements[i];
     
    111120      return this[position];
    112121    }
     122
     123    public event EventHandler PermutationTypeChanged;
     124
     125    protected virtual void OnPermutationTypeChanged() {
     126      var handler = PermutationTypeChanged;
     127      if (handler != null) handler(this, EventArgs.Empty);
     128    }
    113129  }
    114130}
Note: See TracChangeset for help on using the changeset viewer.