@@ -7,21 +7,21 @@ namespace Semmle.Extraction.CIL
77 /// A factory and a cache for mapping source entities to target entities.
88 /// Could be considered as a memoizer.
99 /// </summary>
10- /// <typeparam name="SrcType ">The type of the source.</typeparam>
11- /// <typeparam name="TargetType ">The type of the generated object.</typeparam>
12- public class CachedFunction < SrcType , TargetType > where SrcType : notnull
10+ /// <typeparam name="TSrc ">The type of the source.</typeparam>
11+ /// <typeparam name="TTarget ">The type of the generated object.</typeparam>
12+ public class CachedFunction < TSrc , TTarget > where TSrc : notnull
1313 {
14- private readonly Func < SrcType , TargetType > generator ;
15- private readonly Dictionary < SrcType , TargetType > cache ;
14+ private readonly Func < TSrc , TTarget > generator ;
15+ private readonly Dictionary < TSrc , TTarget > cache ;
1616
1717 /// <summary>
1818 /// Initializes the factory with a given mapping.
1919 /// </summary>
2020 /// <param name="g">The mapping.</param>
21- public CachedFunction ( Func < SrcType , TargetType > g )
21+ public CachedFunction ( Func < TSrc , TTarget > g )
2222 {
2323 generator = g ;
24- cache = new Dictionary < SrcType , TargetType > ( ) ;
24+ cache = new Dictionary < TSrc , TTarget > ( ) ;
2525 }
2626
2727 /// <summary>
@@ -30,7 +30,7 @@ public CachedFunction(Func<SrcType, TargetType> g)
3030 /// </summary>
3131 /// <param name="src">The source object.</param>
3232 /// <returns>The created object.</returns>
33- public TargetType this [ SrcType src ]
33+ public TTarget this [ TSrc src ]
3434 {
3535 get
3636 {
@@ -47,22 +47,22 @@ public TargetType this[SrcType src]
4747 /// <summary>
4848 /// A factory for mapping a pair of source entities to a target entity.
4949 /// </summary>
50- /// <typeparam name="Src1 ">Source entity type 1.</typeparam>
51- /// <typeparam name="Src2 ">Source entity type 2.</typeparam>
52- /// <typeparam name="Target ">The target type.</typeparam>
53- public class CachedFunction < Src1 , Src2 , Target >
50+ /// <typeparam name="TSrcEntity1 ">Source entity type 1.</typeparam>
51+ /// <typeparam name="TSrcEntity2 ">Source entity type 2.</typeparam>
52+ /// <typeparam name="TTarget ">The target type.</typeparam>
53+ public class CachedFunction < TSrcEntity1 , TSrcEntity2 , TTarget >
5454 {
55- private readonly CachedFunction < ( Src1 , Src2 ) , Target > factory ;
55+ private readonly CachedFunction < ( TSrcEntity1 , TSrcEntity2 ) , TTarget > factory ;
5656
5757 /// <summary>
5858 /// Initializes the factory with a given mapping.
5959 /// </summary>
6060 /// <param name="g">The mapping.</param>
61- public CachedFunction ( Func < Src1 , Src2 , Target > g )
61+ public CachedFunction ( Func < TSrcEntity1 , TSrcEntity2 , TTarget > g )
6262 {
63- factory = new CachedFunction < ( Src1 , Src2 ) , Target > ( p => g ( p . Item1 , p . Item2 ) ) ;
63+ factory = new CachedFunction < ( TSrcEntity1 , TSrcEntity2 ) , TTarget > ( p => g ( p . Item1 , p . Item2 ) ) ;
6464 }
6565
66- public Target this [ Src1 s1 , Src2 s2 ] => factory [ ( s1 , s2 ) ] ;
66+ public TTarget this [ TSrcEntity1 s1 , TSrcEntity2 s2 ] => factory [ ( s1 , s2 ) ] ;
6767 }
6868}
0 commit comments