@@ -16,7 +16,7 @@ namespace Microsoft.ML.Runtime.Data
16
16
public static class LambdaFilter
17
17
{
18
18
public static IDataView Create < TSrc > ( IHostEnvironment env , string name , IDataView input ,
19
- string src , ColumnType typeSrc , RefPredicate < TSrc > predicate )
19
+ string src , ColumnType typeSrc , InPredicate < TSrc > predicate )
20
20
{
21
21
Contracts . CheckValue ( env , nameof ( env ) ) ;
22
22
env . CheckNonEmpty ( name , nameof ( name ) ) ;
@@ -58,7 +58,7 @@ public static IDataView Create<TSrc>(IHostEnvironment env, string name, IDataVie
58
58
else
59
59
{
60
60
Func < IHostEnvironment , string , IDataView , int ,
61
- RefPredicate < int > , ValueMapper < int , int > , Impl < int , int > > del = CreateImpl < int , int > ;
61
+ InPredicate < int > , ValueMapper < int , int > , Impl < int , int > > del = CreateImpl < int , int > ;
62
62
var meth = del . GetMethodInfo ( ) . GetGenericMethodDefinition ( )
63
63
. MakeGenericMethod ( typeOrig . RawType , typeof ( TSrc ) ) ;
64
64
impl = ( IDataView ) meth . Invoke ( null , new object [ ] { env , name , input , colSrc , predicate , conv } ) ;
@@ -69,19 +69,19 @@ public static IDataView Create<TSrc>(IHostEnvironment env, string name, IDataVie
69
69
70
70
private static Impl < T1 , T2 > CreateImpl < T1 , T2 > (
71
71
IHostEnvironment env , string name , IDataView input , int colSrc ,
72
- RefPredicate < T2 > pred , ValueMapper < T1 , T2 > conv )
72
+ InPredicate < T2 > pred , ValueMapper < T1 , T2 > conv )
73
73
{
74
74
return new Impl < T1 , T2 > ( env , name , input , colSrc , pred , conv ) ;
75
75
}
76
76
77
77
private sealed class Impl < T1 , T2 > : FilterBase
78
78
{
79
79
private readonly int _colSrc ;
80
- private readonly RefPredicate < T2 > _pred ;
80
+ private readonly InPredicate < T2 > _pred ;
81
81
private readonly ValueMapper < T1 , T2 > _conv ;
82
82
83
83
public Impl ( IHostEnvironment env , string name , IDataView input ,
84
- int colSrc , RefPredicate < T2 > pred , ValueMapper < T1 , T2 > conv = null )
84
+ int colSrc , InPredicate < T2 > pred , ValueMapper < T1 , T2 > conv = null )
85
85
: base ( env , name , input )
86
86
{
87
87
Host . AssertValue ( pred ) ;
@@ -150,7 +150,7 @@ private Func<int, bool> GetActive(Func<int, bool> predicate, out bool[] active)
150
150
private sealed class RowCursor : LinkedRowFilterCursorBase
151
151
{
152
152
private readonly ValueGetter < T1 > _getSrc ;
153
- private readonly RefPredicate < T1 > _pred ;
153
+ private readonly InPredicate < T1 > _pred ;
154
154
private T1 _src ;
155
155
156
156
public RowCursor ( Impl < T1 , T2 > parent , IRowCursor input , bool [ ] active )
@@ -160,26 +160,26 @@ public RowCursor(Impl<T1, T2> parent, IRowCursor input, bool[] active)
160
160
if ( parent . _conv == null )
161
161
{
162
162
Ch . Assert ( typeof ( T1 ) == typeof ( T2 ) ) ;
163
- _pred = ( RefPredicate < T1 > ) ( Delegate ) parent . _pred ;
163
+ _pred = ( InPredicate < T1 > ) ( Delegate ) parent . _pred ;
164
164
}
165
165
else
166
166
{
167
167
T2 val = default ( T2 ) ;
168
168
var pred = parent . _pred ;
169
169
var conv = parent . _conv ;
170
170
_pred =
171
- ( ref T1 src ) =>
171
+ ( in T1 src ) =>
172
172
{
173
173
conv ( ref _src , ref val ) ;
174
- return pred ( ref val ) ;
174
+ return pred ( in val ) ;
175
175
} ;
176
176
}
177
177
}
178
178
179
179
protected override bool Accept ( )
180
180
{
181
181
_getSrc ( ref _src ) ;
182
- return _pred ( ref _src ) ;
182
+ return _pred ( in _src ) ;
183
183
}
184
184
}
185
185
0 commit comments