Changeset 12512 for trunk/sources/HeuristicLab.Core/3.3/Attributes
- Timestamp:
- 06/25/15 15:02:26 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs
r12506 r12512 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 24 26 namespace HeuristicLab.Core { … … 49 51 public const string Scripts = "5" + OrderToken + "Scripts"; 50 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 } 51 63 64 private static IEnumerable<string> GetTokensWithOrdering(string rawName) { 65 return rawName.Split(new[] { SplitToken }, StringSplitOptions.RemoveEmptyEntries); 66 } 67 private static IEnumerable<string> GetTokens(string rawName) { 68 return GetTokensWithOrdering(rawName) 69 .Select(t => t.Split(new[] { OrderToken }, StringSplitOptions.RemoveEmptyEntries).Last()); 70 } 52 71 } 53 72 #endregion
Note: See TracChangeset
for help on using the changeset viewer.