@@ -16,7 +16,7 @@ namespace Microsoft.ML.Runtime.Data
1616 public static class LambdaFilter
1717 {
1818 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 )
2020 {
2121 Contracts . CheckValue ( env , nameof ( env ) ) ;
2222 env . CheckNonEmpty ( name , nameof ( name ) ) ;
@@ -58,7 +58,7 @@ public static IDataView Create<TSrc>(IHostEnvironment env, string name, IDataVie
5858 else
5959 {
6060 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 > ;
6262 var meth = del . GetMethodInfo ( ) . GetGenericMethodDefinition ( )
6363 . MakeGenericMethod ( typeOrig . RawType , typeof ( TSrc ) ) ;
6464 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
6969
7070 private static Impl < T1 , T2 > CreateImpl < T1 , T2 > (
7171 IHostEnvironment env , string name , IDataView input , int colSrc ,
72- RefPredicate < T2 > pred , ValueMapper < T1 , T2 > conv )
72+ InPredicate < T2 > pred , ValueMapper < T1 , T2 > conv )
7373 {
7474 return new Impl < T1 , T2 > ( env , name , input , colSrc , pred , conv ) ;
7575 }
7676
7777 private sealed class Impl < T1 , T2 > : FilterBase
7878 {
7979 private readonly int _colSrc ;
80- private readonly RefPredicate < T2 > _pred ;
80+ private readonly InPredicate < T2 > _pred ;
8181 private readonly ValueMapper < T1 , T2 > _conv ;
8282
8383 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 )
8585 : base ( env , name , input )
8686 {
8787 Host . AssertValue ( pred ) ;
@@ -150,7 +150,7 @@ private Func<int, bool> GetActive(Func<int, bool> predicate, out bool[] active)
150150 private sealed class RowCursor : LinkedRowFilterCursorBase
151151 {
152152 private readonly ValueGetter < T1 > _getSrc ;
153- private readonly RefPredicate < T1 > _pred ;
153+ private readonly InPredicate < T1 > _pred ;
154154 private T1 _src ;
155155
156156 public RowCursor ( Impl < T1 , T2 > parent , IRowCursor input , bool [ ] active )
@@ -160,26 +160,26 @@ public RowCursor(Impl<T1, T2> parent, IRowCursor input, bool[] active)
160160 if ( parent . _conv == null )
161161 {
162162 Ch . Assert ( typeof ( T1 ) == typeof ( T2 ) ) ;
163- _pred = ( RefPredicate < T1 > ) ( Delegate ) parent . _pred ;
163+ _pred = ( InPredicate < T1 > ) ( Delegate ) parent . _pred ;
164164 }
165165 else
166166 {
167167 T2 val = default ( T2 ) ;
168168 var pred = parent . _pred ;
169169 var conv = parent . _conv ;
170170 _pred =
171- ( ref T1 src ) =>
171+ ( in T1 src ) =>
172172 {
173173 conv ( ref _src , ref val ) ;
174- return pred ( ref val ) ;
174+ return pred ( in val ) ;
175175 } ;
176176 }
177177 }
178178
179179 protected override bool Accept ( )
180180 {
181181 _getSrc ( ref _src ) ;
182- return _pred ( ref _src ) ;
182+ return _pred ( in _src ) ;
183183 }
184184 }
185185
0 commit comments