Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/17 22:59:37 (7 years ago)
Author:
mkommend
Message:

#2774: Merged r14877 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Optimization

  • stable/HeuristicLab.Optimization/3.3/BasicProblems/Individuals/SingleEncodingIndividual.cs

    r14186 r15116  
    3232    }
    3333
    34     public override IItem this[string name] {
    35       get {
    36         if (Name != name) throw new ArgumentException(string.Format("{0} is not part of the individual.", name));
    37         return ExtractScopeValue(Name, Scope);
    38       }
    39       set {
    40         if (Name != name) throw new ArgumentException(string.Format("{0} is not part of the individual.", name));
    41         SetScopeValue(Name, Scope, value);
    42       }
     34    private SingleEncodingIndividual(SingleEncodingIndividual copy) : base(copy.Encoding, new Scope()) {
     35      copy.CopyToScope(Scope);
     36    }
     37    public override Individual Copy() {
     38      return new SingleEncodingIndividual(this);
    4339    }
    4440
     
    4844      return encoding;
    4945    }
    50 
    51     public override Individual CopyToScope(IScope scope) {
    52       SetScopeValue(Name, scope, (IItem)this[Name].Clone());
    53       return new SingleEncodingIndividual(Encoding, scope);
    54     }
    5546  }
    5647
Note: See TracChangeset for help on using the changeset viewer.