Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/15 12:11:55 (9 years ago)
Author:
mkommend
Message:

#2025:Merged all changes regarding the new item dialog into stable.
#2387: Merged all changes regarding the type selector into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Core

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/HLScript/HeuristicLab.Coremergedeligible
      /trunk/sources/HeuristicLab.Coremergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Core10321-10322
      /branches/Algorithms.GradientDescent/HeuristicLab.Core5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Core6917-7005
      /branches/CloningRefactoring/HeuristicLab.Core4656-4721
      /branches/CodeEditor/HeuristicLab.Core11700-11806
      /branches/DataAnalysis Refactoring/HeuristicLab.Core5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Core5815-6180
      /branches/DataAnalysis/HeuristicLab.Core4458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Core10085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Core6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Core5060
      /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Core11570-12508
      /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Core6123-9799
      /branches/LogResidualEvaluator/HeuristicLab.Core10202-10483
      /branches/NET40/sources/HeuristicLab.Core5138-5162
      /branches/NSGA-II Changes/HeuristicLab.Core12033-12122
      /branches/NewItemDialog/HeuristicLab.Core12240,​12246
      /branches/ParallelEngine/HeuristicLab.Core5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Core7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Core6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Core6828
      /branches/RuntimeOptimizer/HeuristicLab.Core8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Core7787-8333
      /branches/SlaveShutdown/HeuristicLab.Core8944-8956
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Core10204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Core5370-5682
      /branches/Trunk/HeuristicLab.Core6829-6865
      /branches/UnloadJobs/HeuristicLab.Core9168-9215
      /branches/VNS/HeuristicLab.Core5594-5752
      /branches/histogram/HeuristicLab.Core5959-6341
  • stable/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs

    r12009 r12708  
    2121
    2222using System;
     23using System.Collections.Generic;
     24using System.Linq;
    2325
    2426namespace HeuristicLab.Core {
    2527  [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
    2628  public sealed class CreatableAttribute : Attribute {
     29    #region Predefined Categories
     30    public static class Categories {
     31      public const string SplitToken = "###";
     32      public const string OrderToken = "$$$";
     33
     34      public const string Algorithms = "1" + OrderToken + "Algorithms";
     35      public const string PopulationBasedAlgorithms = Algorithms + SplitToken + "1" + OrderToken + "Population Based";
     36      public const string SingleSolutionAlgorithms = Algorithms + SplitToken + "2" + OrderToken + "Single Solution";
     37
     38      public const string Problems = "2" + OrderToken + "Problems";
     39      public const string CombinatorialProblems = Problems + SplitToken + "1" + OrderToken + "Combinatorial";
     40      public const string GeneticProgrammingProblems = Problems + SplitToken + "2" + OrderToken + "Genetic Programming";
     41      public const string ExternalEvaluationProblems = Problems + SplitToken + "3" + OrderToken + "External Evaluation";
     42
     43      public const string DataAnalysis = "3" + OrderToken + "Data Analysis";
     44      public const string DataAnalysisRegression = DataAnalysis + SplitToken + "1" + OrderToken + "Regression";
     45      public const string DataAnalysisClassification = DataAnalysis + SplitToken + "2" + OrderToken + "Classification";
     46      public const string DataAnalysisEnsembles = DataAnalysis + SplitToken + "3" + OrderToken + "Ensembles";
     47
     48      public const string TestingAndAnalysis = "4" + OrderToken + "Testing & Analysis";
     49      public const string TestingAndAnalysisOKB = TestingAndAnalysis + SplitToken + "1" + OrderToken + "OKB";
     50
     51      public const string Scripts = "5" + OrderToken + "Scripts";
     52
     53      public static string GetFullName(string rawName) {
     54        return string.Join(SplitToken, GetTokens(rawName));
     55      }
     56      public static string GetName(string rawName) {
     57        return GetTokens(rawName).Last();
     58      }
     59      public static IEnumerable<string> GetParentRawNames(string rawName) {
     60        var tokens = GetTokensWithOrdering(rawName).ToList();
     61        return tokens.Take(tokens.Count - 1);
     62      }
     63      private static IEnumerable<string> GetTokensWithOrdering(string rawName) {
     64        return rawName.Split(new[] { SplitToken }, StringSplitOptions.RemoveEmptyEntries);
     65      }
     66      private static IEnumerable<string> GetTokens(string rawName) {
     67        return GetTokensWithOrdering(rawName)
     68          .Select(t => t.Split(new[] { OrderToken }, StringSplitOptions.RemoveEmptyEntries).Last());
     69      }
     70    }
     71    #endregion
     72
    2773    private string category;
    2874    public string Category {
     
    3682    }
    3783
     84    public int Priority { get; set; }
     85
    3886    public CreatableAttribute() {
    3987      Category = "Other Items";
     88      Priority = int.MaxValue;
    4089    }
    4190    public CreatableAttribute(string category)
     
    53102      else return null;
    54103    }
     104    public static int GetPriority(Type type) {
     105      var attribs = type.GetCustomAttributes(typeof(CreatableAttribute), false);
     106      if (attribs.Length > 0) return ((CreatableAttribute)attribs[0]).Priority;
     107      else return int.MaxValue;
     108    }
    55109  }
    56110}
Note: See TracChangeset for help on using the changeset viewer.