Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/15/14 22:34:05 (11 years ago)
Author:
abeham
Message:

#2174: minor refactorings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SimSharp/HeuristicLab.Encodings.ParameterVector/ParameterVectorBuilder.cs

    r10753 r10754  
    3232
    3333    public ParameterVectorBuilder() {
    34       booleanParameters = new HashSet<string>();
    35       integerParameters = new Dictionary<string, Tuple<int, int, int?>>();
    36       realParameters = new Dictionary<string, Tuple<double, double>>();
     34      booleanParameters = null;
     35      integerParameters = null;
     36      realParameters = null;
    3737      permutationParameter = null;
    3838    }
    3939
    4040    public ParameterVectorBuilder AddBoolean(string name) {
     41      if (booleanParameters == null) booleanParameters = new HashSet<string>();
    4142      booleanParameters.Add(name);
    4243      return this;
     
    4445
    4546    public ParameterVectorBuilder AddInteger(string name, int min, int max, int? step = null) {
     47      if (integerParameters == null) integerParameters = new Dictionary<string, Tuple<int, int, int?>>();
    4648      integerParameters.Add(name, Tuple.Create(min, max, step));
    4749      return this;
     
    4951
    5052    public ParameterVectorBuilder AddReal(string name, double min, double max) {
     53      if (realParameters == null) realParameters = new Dictionary<string, Tuple<double, double>>();
    5154      realParameters.Add(name, Tuple.Create(min, max));
    5255      return this;
Note: See TracChangeset for help on using the changeset viewer.