Changeset 5286 for branches/OKB/HeuristicLab.Services.OKB/3.3/Filters/AlgorithmParameterNameFilter.cs
- Timestamp:
- 01/12/11 04:10:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Services.OKB/3.3/Filters/AlgorithmParameterNameFilter.cs
r5269 r5286 20 20 #endregion 21 21 22 using System; 22 23 using System.Linq; 24 using System.Linq.Expressions; 23 25 using HeuristicLab.Services.OKB.DataAccess; 24 26 … … 27 29 public DataTransfer.SetComparison Comparison { get; set; } 28 30 public string Value { get; set; } 31 32 public Expression<Func<Run, bool>> Expression { 33 get { 34 switch (Comparison) { 35 case DataTransfer.SetComparison.Equal: 36 return x => x.Experiment.Algorithm.AlgorithmParameters.Any(y => (y.Name == Value) || (y.Alias == Value)); 37 case DataTransfer.SetComparison.NotEqual: 38 return x => x.Experiment.Algorithm.AlgorithmParameters.All(y => (y.Name != Value) && (y.Alias != Value)); 39 case DataTransfer.SetComparison.Contains: 40 return x => x.Experiment.Algorithm.AlgorithmParameters.Any(y => y.Name.Contains(Value) || y.Alias.Contains(Value)); 41 case DataTransfer.SetComparison.NotContains: 42 return x => x.Experiment.Algorithm.AlgorithmParameters.All(y => !y.Name.Contains(Value) && !y.Alias.Contains(Value)); 43 default: 44 return x => true; 45 } 46 } 47 } 29 48 30 49 public AlgorithmParameterNameFilter(DataTransfer.SetComparison comparison, string value) { … … 36 55 Value = filter.Value; 37 56 } 38 39 public IQueryable<Run> Apply(IQueryable<Run> source) {40 switch (Comparison) {41 case DataTransfer.SetComparison.Equal:42 return source.Where(x => x.Experiment.Algorithm.AlgorithmParameters.Any(y => (y.Name == Value) || (y.Alias == Value)));43 case DataTransfer.SetComparison.NotEqual:44 return source.Where(x => x.Experiment.Algorithm.AlgorithmParameters.All(y => (y.Name != Value) && (y.Alias != Value)));45 case DataTransfer.SetComparison.Contains:46 return source.Where(x => x.Experiment.Algorithm.AlgorithmParameters.Any(y => y.Name.Contains(Value) || y.Alias.Contains(Value)));47 case DataTransfer.SetComparison.NotContains:48 return source.Where(x => x.Experiment.Algorithm.AlgorithmParameters.All(y => !y.Name.Contains(Value) && !y.Alias.Contains(Value)));49 default:50 return source;51 }52 }53 57 } 54 58 }
Note: See TracChangeset
for help on using the changeset viewer.