Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12148 for trunk/sources


Ignore:
Timestamp:
03/06/15 12:54:17 (10 years ago)
Author:
mkommend
Message:

#2327: Changed behavior of enumvalue to avoid subclassing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data/3.3/EnumValue.cs

    r12037 r12148  
    2929  [Item("EnumValue", "An abstract base class for representing values of enum types.")]
    3030  [StorableClass]
    31   public abstract class EnumValue<T> : ValueTypeValue<T>, IComparable<EnumValue<T>> where T : struct, IComparable {
     31  public sealed class EnumValue<T> : ValueTypeValue<T>, IComparable<EnumValue<T>> where T : struct, IComparable {
    3232    public static new Image StaticItemImage {
    3333      get { return HeuristicLab.Common.Resources.VSImageLibrary.Enum; }
     
    3939    }
    4040
     41    public EnumValue() {
     42      this.value = default(T);
     43      this.readOnly = false;
     44    }
     45    public EnumValue(T value) {
     46      this.value = value;
     47      this.readOnly = false;
     48    }
     49
    4150    [StorableConstructor]
    42     protected EnumValue(bool deserializing) : base(deserializing) { }
    43     protected EnumValue(EnumValue<T> original, Cloner cloner)
     51    private EnumValue(bool deserializing) : base(deserializing) { }
     52    private EnumValue(EnumValue<T> original, Cloner cloner)
    4453      : base(original, cloner) {
    4554      this.value = original.value;
    4655      this.readOnly = original.readOnly;
    4756    }
    48     protected EnumValue() {
    49       this.value = default(T);
    50       this.readOnly = false;
    51     }
    52     protected EnumValue(T value) {
    53       this.value = value;
    54       this.readOnly = false;
     57
     58    public override IDeepCloneable Clone(Cloner cloner) {
     59      return new EnumValue<T>(this, cloner);
    5560    }
    5661
    57     public virtual int CompareTo(EnumValue<T> other) {
     62    public int CompareTo(EnumValue<T> other) {
    5863      return Value.CompareTo(other.Value);
    5964    }
Note: See TracChangeset for help on using the changeset viewer.