Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4559


Ignore:
Timestamp:
10/06/10 03:27:57 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs

    r4549 r4559  
    2727using HeuristicLab.Common;
    2828using HeuristicLab.Core;
     29using HeuristicLab.Optimization;
    2930using HeuristicLab.PluginInfrastructure;
    3031
     
    157158      }
    158159    }
     160    public bool Store(long algorithmId, long probleId, Run run) {
     161      return true;
     162    }
    159163    #endregion
    160164
  • branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs

    r4558 r4559  
    277277        Algorithm.Started += new EventHandler(algorithm_Started);
    278278        Algorithm.Stopped += new EventHandler(algorithm_Stopped);
     279        Algorithm.Runs.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
    279280      }
    280281    }
     
    289290        Algorithm.Started -= new EventHandler(algorithm_Started);
    290291        Algorithm.Stopped -= new EventHandler(algorithm_Stopped);
     292        Algorithm.Runs.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<IRun>(Runs_ItemsAdded);
    291293      }
    292294    }
     
    314316    private void algorithm_Stopped(object sender, EventArgs e) {
    315317      OnStopped();
     318    }
     319    private void Runs_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IRun> e) {
     320      try {
     321        foreach (Run run in e.Items)
     322          OKBClient.Instance.Store(AlgorithmId, ProblemId, run);
     323      }
     324      catch (Exception ex) {
     325        OnExceptionOccurred(ex);
     326      }
    316327    }
    317328    #endregion
  • branches/OKB/HeuristicLab.Services.OKB.DataTransfer/3.3/HeuristicLab.Services.OKB.DataTransfer-3.3.csproj

    r4481 r4559  
    5151    <Compile Include="Algorithm.cs" />
    5252    <Compile Include="AlgorithmData.cs" />
     53    <Compile Include="AlgorithmParameter.cs" />
     54    <Compile Include="Run.cs" />
     55    <Compile Include="Experiment.cs" />
     56    <Compile Include="Result.cs" />
     57    <Compile Include="ProblemParameter.cs" />
    5358    <Compile Include="ProblemData.cs" />
    5459    <Compile Include="Problem.cs" />
  • branches/OKB/HeuristicLab.Services.OKB/3.3/Convert.cs

    r4481 r4559  
    101101    #endregion
    102102
     103    #region AlgorithmParameter
     104    public static DT.AlgorithmParameter ToDto(DA.AlgorithmParameter source) {
     105      if (source == null) return null;
     106      return new DT.AlgorithmParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
     107    }
     108    public static DA.AlgorithmParameter ToEntity(DT.AlgorithmParameter source) {
     109      if (source == null) return null;
     110      return new DA.AlgorithmParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
     111    }
     112    public static void ToEntity(DT.AlgorithmParameter source, DA.AlgorithmParameter target) {
     113      if ((source != null) && (target != null))
     114        target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId;
     115    }
     116    #endregion
     117
    103118    #region ProblemClass
    104119    public static DT.ProblemClass ToDto(DA.ProblemClass source) {
     
    116131    #endregion
    117132
    118     #region Algorithm
     133    #region Problem
    119134    public static DT.Problem ToDto(DA.Problem source) {
    120135      if (source == null) return null;
     
    145160    }
    146161    #endregion
     162
     163    #region ProblemParameter
     164    public static DT.ProblemParameter ToDto(DA.ProblemParameter source) {
     165      if (source == null) return null;
     166      return new DT.ProblemParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, ProblemId = source.ProblemId, DataTypeId = source.DataTypeId };
     167    }
     168    public static DA.ProblemParameter ToEntity(DT.ProblemParameter source) {
     169      if (source == null) return null;
     170      return new DA.ProblemParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, ProblemId = source.ProblemId, DataTypeId = source.DataTypeId };
     171    }
     172    public static void ToEntity(DT.ProblemParameter source, DA.ProblemParameter target) {
     173      if ((source != null) && (target != null))
     174        target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.ProblemId = source.ProblemId; target.DataTypeId = source.DataTypeId;
     175    }
     176    #endregion
     177
     178    #region Result
     179    public static DT.Result ToDto(DA.Result source) {
     180      if (source == null) return null;
     181      return new DT.Result { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
     182    }
     183    public static DA.Result ToEntity(DT.Result source) {
     184      if (source == null) return null;
     185      return new DA.Result { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
     186    }
     187    public static void ToEntity(DT.Result source, DA.Result target) {
     188      if ((source != null) && (target != null))
     189        target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId;
     190    }
     191    #endregion
     192
     193    #region Experiment
     194    public static DT.Experiment ToDto(DA.Experiment source) {
     195      if (source == null) return null;
     196      return new DT.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId };
     197    }
     198    public static DA.Experiment ToEntity(DT.Experiment source) {
     199      if (source == null) return null;
     200      return new DA.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId };
     201    }
     202    public static void ToEntity(DT.Experiment source, DA.Experiment target) {
     203      if ((source != null) && (target != null))
     204        target.Id = source.Id; target.AlgorithmId = source.AlgorithmId; target.ProblemId = source.ProblemId;
     205    }
     206    #endregion
     207
     208    #region Run
     209    public static DT.Run ToDto(DA.Run source) {
     210      if (source == null) return null;
     211      return new DT.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId };
     212    }
     213    public static DA.Run ToEntity(DT.Run source) {
     214      if (source == null) return null;
     215      return new DA.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId };
     216    }
     217    public static void ToEntity(DT.Run source, DA.Run target) {
     218      if ((source != null) && (target != null))
     219        target.Id = source.Id; target.RandomSeed = source.RandomSeed; target.FinishedDate = source.FinishedDate; target.ExperimentId = source.ExperimentId; target.UserId = source.UserId; target.ClientId = source.ClientId;
     220
     221    }
     222    #endregion
    147223  }
    148224}
Note: See TracChangeset for help on using the changeset viewer.