Row.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //
  2. // Row.cs
  3. //
  4. // Author:
  5. // Jb Evain (jbevain@gmail.com)
  6. //
  7. // Copyright (c) 2008 - 2011 Jb Evain
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. //
  28. using System.Collections.Generic;
  29. namespace Mono.Cecil.Metadata {
  30. class Row<T1, T2> {
  31. internal T1 Col1;
  32. internal T2 Col2;
  33. public Row (T1 col1, T2 col2)
  34. {
  35. Col1 = col1;
  36. Col2 = col2;
  37. }
  38. }
  39. class Row<T1, T2, T3>
  40. {
  41. internal T1 Col1;
  42. internal T2 Col2;
  43. internal T3 Col3;
  44. public Row (T1 col1, T2 col2, T3 col3)
  45. {
  46. Col1 = col1;
  47. Col2 = col2;
  48. Col3 = col3;
  49. }
  50. }
  51. class Row<T1, T2, T3, T4>
  52. {
  53. internal T1 Col1;
  54. internal T2 Col2;
  55. internal T3 Col3;
  56. internal T4 Col4;
  57. public Row (T1 col1, T2 col2, T3 col3, T4 col4)
  58. {
  59. Col1 = col1;
  60. Col2 = col2;
  61. Col3 = col3;
  62. Col4 = col4;
  63. }
  64. }
  65. class Row<T1, T2, T3, T4, T5>
  66. {
  67. internal T1 Col1;
  68. internal T2 Col2;
  69. internal T3 Col3;
  70. internal T4 Col4;
  71. internal T5 Col5;
  72. public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5)
  73. {
  74. Col1 = col1;
  75. Col2 = col2;
  76. Col3 = col3;
  77. Col4 = col4;
  78. Col5 = col5;
  79. }
  80. }
  81. class Row<T1, T2, T3, T4, T5, T6>
  82. {
  83. internal T1 Col1;
  84. internal T2 Col2;
  85. internal T3 Col3;
  86. internal T4 Col4;
  87. internal T5 Col5;
  88. internal T6 Col6;
  89. public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6)
  90. {
  91. Col1 = col1;
  92. Col2 = col2;
  93. Col3 = col3;
  94. Col4 = col4;
  95. Col5 = col5;
  96. Col6 = col6;
  97. }
  98. }
  99. class Row<T1, T2, T3, T4, T5, T6, T7, T8, T9>
  100. {
  101. internal T1 Col1;
  102. internal T2 Col2;
  103. internal T3 Col3;
  104. internal T4 Col4;
  105. internal T5 Col5;
  106. internal T6 Col6;
  107. internal T7 Col7;
  108. internal T8 Col8;
  109. internal T9 Col9;
  110. public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6, T7 col7, T8 col8, T9 col9)
  111. {
  112. Col1 = col1;
  113. Col2 = col2;
  114. Col3 = col3;
  115. Col4 = col4;
  116. Col5 = col5;
  117. Col6 = col6;
  118. Col7 = col7;
  119. Col8 = col8;
  120. Col9 = col9;
  121. }
  122. }
  123. sealed class RowEqualityComparer : IEqualityComparer<Row<string, string>>, IEqualityComparer<Row<uint, uint>>, IEqualityComparer<Row<uint, uint, uint>> {
  124. public bool Equals (Row<string, string> x, Row<string, string> y)
  125. {
  126. return x.Col1 == y.Col1
  127. && x.Col2 == y.Col2;
  128. }
  129. public int GetHashCode (Row<string, string> obj)
  130. {
  131. string x = obj.Col1, y = obj.Col2;
  132. return (x != null ? x.GetHashCode () : 0) ^ (y != null ? y.GetHashCode () : 0);
  133. }
  134. public bool Equals (Row<uint, uint> x, Row<uint, uint> y)
  135. {
  136. return x.Col1 == y.Col1
  137. && x.Col2 == y.Col2;
  138. }
  139. public int GetHashCode (Row<uint, uint> obj)
  140. {
  141. return (int) (obj.Col1 ^ obj.Col2);
  142. }
  143. public bool Equals (Row<uint, uint, uint> x, Row<uint, uint, uint> y)
  144. {
  145. return x.Col1 == y.Col1
  146. && x.Col2 == y.Col2
  147. && x.Col3 == y.Col3;
  148. }
  149. public int GetHashCode (Row<uint, uint, uint> obj)
  150. {
  151. return (int) (obj.Col1 ^ obj.Col2 ^ obj.Col3);
  152. }
  153. }
  154. }