Changeset 5286 for branches/OKB/HeuristicLab.Services.OKB/3.3/Filters/AlgorithmParameterBlobValueDataTypeNameFilter.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/AlgorithmParameterBlobValueDataTypeNameFilter.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 … … 28 30 public DataTransfer.SetComparison Comparison { get; set; } 29 31 public string Value { get; set; } 32 33 public Expression<Func<Run, bool>> Expression { 34 get { 35 switch (Comparison) { 36 case DataTransfer.SetComparison.Equal: 37 return x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && (y.DataType.Name == Value)); 38 case DataTransfer.SetComparison.NotEqual: 39 return x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && (y.DataType.Name != Value)); 40 case DataTransfer.SetComparison.Contains: 41 return x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && y.DataType.Name.Contains(Value)); 42 case DataTransfer.SetComparison.NotContains: 43 return x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && !y.DataType.Name.Contains(Value)); 44 default: 45 return x => true; 46 } 47 } 48 } 30 49 31 50 public AlgorithmParameterBlobValueDataTypeNameFilter(string name, DataTransfer.SetComparison comparison, string value) { … … 39 58 Value = filter.Value; 40 59 } 41 42 public IQueryable<Run> Apply(IQueryable<Run> source) {43 switch (Comparison) {44 case DataTransfer.SetComparison.Equal:45 return source.Where(x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && (y.DataType.Name == Value)));46 case DataTransfer.SetComparison.NotEqual:47 return source.Where(x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && (y.DataType.Name != Value)));48 case DataTransfer.SetComparison.Contains:49 return source.Where(x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && y.DataType.Name.Contains(Value)));50 case DataTransfer.SetComparison.NotContains:51 return source.Where(x => x.Experiment.AlgorithmParameterBlobValues.Any(y => ((y.AlgorithmParameter.Name == Name) || (y.AlgorithmParameter.Alias == Name)) && !y.DataType.Name.Contains(Value)));52 default:53 return source;54 }55 }56 60 } 57 61 }
Note: See TracChangeset
for help on using the changeset viewer.