Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6228 for branches


Ignore:
Timestamp:
05/17/11 17:16:33 (14 years ago)
Author:
epitzer
Message:

check hooks by method name only (#1530)

Location:
branches/PersistenceSpeedUp
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r6182 r6228  
    5151      Problem = new ClassificationProblem();
    5252    }
    53     [StorableHook(HookType.AfterDeserialization)]
    54     private void AfterDeserialization() { }
    5553
    5654    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r6182 r6228  
    5252      Problem = new RegressionProblem();
    5353    }
    54     [StorableHook(HookType.AfterDeserialization)]
    55     private void AfterDeserialization() { }
    5654
    5755    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r6182 r6228  
    102102      Parameters.Add(new ValueParameter<DoubleValue>(GammaParameterName, "The value of the gamma parameter in the kernel function.", new DoubleValue(1.0)));
    103103    }
    104     [StorableHook(HookType.AfterDeserialization)]
    105     private void AfterDeserialization() { }
    106104
    107105    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r6182 r6228  
    110110      Parameters.Add(new ValueParameter<DoubleValue>(EpsilonParameterName, "The value of the epsilon parameter for epsilon-SVR.", new DoubleValue(0.1)));
    111111    }
    112     [StorableHook(HookType.AfterDeserialization)]
    113     private void AfterDeserialization() { }
    114112
    115113    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.DataAnalysis/3.4/kMeans/KMeansClustering.cs

    r6182 r6228  
    6969      Problem = new ClusteringProblem();
    7070    }
    71     [StorableHook(HookType.AfterDeserialization)]
    72     private void AfterDeserialization() { }
    7371
    7472    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r5809 r6228  
    306306    #region Helpers
    307307    [StorableHook(HookType.AfterDeserialization)]
     308    private void AfterDeserialization() {
     309      AttachEventHandlers();
     310    }
     311
    308312    private void AttachEventHandlers() {
    309313      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
  • branches/PersistenceSpeedUp/HeuristicLab.Analysis/3.3/ValueAnalysis/MinAverageMaxValueAnalyzer.cs

    r5445 r6228  
    147147
    148148    [StorableHook(HookType.AfterDeserialization)]
     149    private void AfterDeserialization() {
     150      Initialize();
     151    }
     152
    149153    private void Initialize() {
    150154      ValueParameter.DepthChanged += new EventHandler(ValueParameter_DepthChanged);
     
    193197      else if (!CollectMaxValueInResults.Value && maxValueParameter != null)
    194198        resultsCollector.CollectedValues.Remove(maxValueParameter);
    195       }
     199    }
    196200
    197201    private void CollectMinValueInResultsParameter_ValueChanged(object sender, EventArgs e) {
  • branches/PersistenceSpeedUp/HeuristicLab.Encodings.RealVectorEncoding/3.3/ParticleOperators/RealVectorSwarmUpdater.cs

    r5911 r6228  
    217217
    218218    [StorableHook(HookType.AfterDeserialization)]
     219    private void AfterDeserialization() {
     220      RegisterEvents();
     221    }
     222
    219223    private void RegisterEvents() {
    220224      VelocityBoundsStartValueParameter.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_ValueChanged);
     
    223227
    224228    void VelocityBoundsStartValueParameter_Value_ValueChanged(object sender, EventArgs e) {
    225       UpdateVelocityBoundsParamater(); 
     229      UpdateVelocityBoundsParamater();
    226230    }
    227231
     
    245249        VelocityBoundsStartValueParameter.Value.ValueChanged += new EventHandler(VelocityBoundsStartValueParameter_Value_ValueChanged);
    246250      }
    247       UpdateVelocityBoundsParamater(); 
     251      UpdateVelocityBoundsParamater();
    248252    }
    249253
  • branches/PersistenceSpeedUp/HeuristicLab.Optimization.Operators/3.3/MultiObjective/CrowdingDistanceAssignment.cs

    r5445 r6228  
    5757
    5858    [StorableHook(HookType.AfterDeserialization)]
     59    private void AfterDeserialization() {
     60      AttachEventHandlers();
     61    }
     62
    5963    private void AttachEventHandlers() {
    6064      QualitiesParameter.DepthChanged += new EventHandler(QualitiesParameter_DepthChanged);
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs

    r6224 r6228  
    139139      if (methodInfo.ReturnType != typeof(void) || methodInfo.GetParameters().Length > 0)
    140140        return;
    141       var attribute = (StorableHookAttribute)methodInfo.GetCustomAttributes(typeof(StorableHookAttribute), false).SingleOrDefault();
    142       if (attribute != null)
    143         typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, attribute.HookType));
     141      switch (methodInfo.Name) {
     142        case "AfterDeserialization":
     143          typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, HookType.AfterDeserialization));
     144          break;
     145        case "BeforeSerialization":
     146          typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, HookType.BeforeSerialization));
     147          break;
     148        default: break;
     149      }
    144150    }
    145151  }
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Tests/UseCases.cs

    r6224 r6228  
    798798      public bool WasSerialized { get; private set; }
    799799      [StorableHook(HookType.BeforeSerialization)]
    800       void PreSerializationHook() {
     800      void BeforeSerialization() {
    801801        WasSerialized = true;
    802802      }
    803803      [StorableHook(HookType.AfterDeserialization)]
    804       void PostDeserializationHook() {
     804      void AfterDeserialization() {
    805805        sum = a + b;
    806806      }
     
    896896      public object link;
    897897      [StorableHook(HookType.AfterDeserialization)]
    898       private void relink() {
     898      private void AfterDeserialization() {
    899899        link = a;
    900900      }
     
    906906      public object b;
    907907      [StorableHook(HookType.AfterDeserialization)]
    908       private void relink() {
     908      private void AfterDeserialization() {
    909909        Assert.AreSame(a, link);
    910910        link = b;
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionOverfittingAnalyzer.cs

    r5863 r6228  
    9090      Parameters.Add(new LookupParameter<BoolValue>(OverfittingParameterName, "Boolean indicator for overfitting."));
    9191      Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The results collection."));
    92     }
    93 
    94     [StorableHook(HookType.AfterDeserialization)]
    95     private void AfterDeserialization() {
    96     }
     92    }   
    9793
    9894    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionValidationAnalyzer.cs

    r5445 r6228  
    134134      Parameters.Add(new ValueLookupParameter<DoubleValue>(LowerEstimationLimitParameterName, "The lower estimation limit that was set for the evaluation of the symbolic expression trees."));
    135135    }
    136 
    137     [StorableHook(HookType.AfterDeserialization)]
    138     private void AfterDeserialization() { }
    139 
     136   
    140137    public override IOperation Apply() {
    141138      var trees = SymbolicExpressionTree.ToArray();
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblem.cs

    r5809 r6228  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.PluginInfrastructure;
    3031using HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers;
    31 using HeuristicLab.PluginInfrastructure;
    3232
    3333namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
     
    138138    #region Helpers
    139139    [StorableHook(HookType.AfterDeserialization)]
    140     private void AfterDeserializationHook() {
     140    private void AfterDeserialization() {
    141141      // BackwardsCompatibility3.3
    142142      #region Backwards compatible code (remove with 3.4)
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r5809 r6228  
    265265    #region Helpers
    266266    [StorableHook(HookType.AfterDeserialization)]
    267     private void AfterDeserializationHook() {
     267    private void AfterDeserialization() {
    268268      // BackwardsCompatibility3.3
    269269      #region Backwards compatible code (remove with 3.4)
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Clustering/ClusteringProblemData.cs

    r5809 r6228  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.IO;
    25 using System.Linq;
    2624using HeuristicLab.Common;
    2725using HeuristicLab.Core;
    28 using HeuristicLab.Data;
    29 using HeuristicLab.Parameters;
    3026using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3127
     
    7672    [StorableConstructor]
    7773    private ClusteringProblemData(bool deserializing) : base(deserializing) { }
    78     [StorableHook(HookType.AfterDeserialization)]
    79     private void AfterDeserialization() {
    80     }
    81 
    8274
    8375    private ClusteringProblemData(ClusteringProblemData original, Cloner cloner)
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r6189 r6228  
    127127    [StorableConstructor]
    128128    private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { }
    129     [StorableHook(HookType.AfterDeserialization)]
    130     private void AfterDeserializationHook() {
    131       AttachEventHandlers();
    132     }
    133129
    134130    private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner)
     
    158154    [StorableHook(HookType.AfterDeserialization)]
    159155    private void AfterDeserialization() {
     156      AttachEventHandlers();
    160157      // BackwardsCompatibility3.3
    161158      #region Backwards compatible code, remove with 3.4
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/Analyzers/BestVRPSolutionAnalyzer.cs

    r5445 r6228  
    9595    public BestVRPSolutionAnalyzer()
    9696      : base() {
    97         Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
     97      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
    9898      Parameters.Add(new LookupParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities."));
    9999      Parameters.Add(new LookupParameter<DoubleMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities."));
     
    121121
    122122    [StorableHook(HookType.AfterDeserialization)]
    123     private void AfterDeserializationHook() {
     123    private void AfterDeserialization() {
    124124      #region Backwards Compatibility
    125125      if (!Parameters.ContainsKey("BestKnownQuality")) {
  • branches/PersistenceSpeedUp/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r6042 r6228  
    436436    #region Helpers
    437437    [StorableHook(HookType.AfterDeserialization)]
    438     private void AfterDeserializationHook() {
     438    private void AfterDeserialization() {
    439439      #region Backwards Compatibility
    440440      if (!Parameters.ContainsKey("BestKnownSolution")) {
Note: See TracChangeset for help on using the changeset viewer.