PageRenderTime 93ms CodeModel.GetById 85ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Mono.Cecil.Metadata/Row.cs

http://github.com/jbevain/cecil
C# | 152 lines | 122 code | 21 blank | 9 comment | 13 complexity | 1f63cf51e9c1e30abbab1042b2563f60 MD5 | raw file
  1//
  2// Author:
  3//   Jb Evain (jbevain@gmail.com)
  4//
  5// Copyright (c) 2008 - 2015 Jb Evain
  6// Copyright (c) 2008 - 2011 Novell, Inc.
  7//
  8// Licensed under the MIT/X11 license.
  9//
 10
 11using System.Collections.Generic;
 12
 13namespace Mono.Cecil.Metadata {
 14
 15	struct Row<T1, T2> {
 16		internal T1 Col1;
 17		internal T2 Col2;
 18
 19		public Row (T1 col1, T2 col2)
 20		{
 21			Col1 = col1;
 22			Col2 = col2;
 23		}
 24	}
 25
 26	struct Row<T1, T2, T3> {
 27		internal T1 Col1;
 28		internal T2 Col2;
 29		internal T3 Col3;
 30
 31		public Row (T1 col1, T2 col2, T3 col3)
 32		{
 33			Col1 = col1;
 34			Col2 = col2;
 35			Col3 = col3;
 36		}
 37	}
 38
 39	struct Row<T1, T2, T3, T4> {
 40		internal T1 Col1;
 41		internal T2 Col2;
 42		internal T3 Col3;
 43		internal T4 Col4;
 44
 45		public Row (T1 col1, T2 col2, T3 col3, T4 col4)
 46		{
 47			Col1 = col1;
 48			Col2 = col2;
 49			Col3 = col3;
 50			Col4 = col4;
 51		}
 52	}
 53
 54	struct Row<T1, T2, T3, T4, T5> {
 55		internal T1 Col1;
 56		internal T2 Col2;
 57		internal T3 Col3;
 58		internal T4 Col4;
 59		internal T5 Col5;
 60
 61		public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5)
 62		{
 63			Col1 = col1;
 64			Col2 = col2;
 65			Col3 = col3;
 66			Col4 = col4;
 67			Col5 = col5;
 68		}
 69	}
 70
 71	struct Row<T1, T2, T3, T4, T5, T6> {
 72		internal T1 Col1;
 73		internal T2 Col2;
 74		internal T3 Col3;
 75		internal T4 Col4;
 76		internal T5 Col5;
 77		internal T6 Col6;
 78
 79		public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6)
 80		{
 81			Col1 = col1;
 82			Col2 = col2;
 83			Col3 = col3;
 84			Col4 = col4;
 85			Col5 = col5;
 86			Col6 = col6;
 87		}
 88	}
 89
 90	struct Row<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
 91		internal T1 Col1;
 92		internal T2 Col2;
 93		internal T3 Col3;
 94		internal T4 Col4;
 95		internal T5 Col5;
 96		internal T6 Col6;
 97		internal T7 Col7;
 98		internal T8 Col8;
 99		internal T9 Col9;
100
101		public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6, T7 col7, T8 col8, T9 col9)
102		{
103			Col1 = col1;
104			Col2 = col2;
105			Col3 = col3;
106			Col4 = col4;
107			Col5 = col5;
108			Col6 = col6;
109			Col7 = col7;
110			Col8 = col8;
111			Col9 = col9;
112		}
113	}
114
115	sealed class RowEqualityComparer : IEqualityComparer<Row<string, string>>, IEqualityComparer<Row<uint, uint>>, IEqualityComparer<Row<uint, uint, uint>> {
116
117		public bool Equals (Row<string, string> x, Row<string, string> y)
118		{
119			return x.Col1 == y.Col1
120				&& x.Col2 == y.Col2;
121		}
122
123		public int GetHashCode (Row<string, string> obj)
124		{
125			string x = obj.Col1, y = obj.Col2;
126			return (x != null ? x.GetHashCode () : 0) ^ (y != null ? y.GetHashCode () : 0);
127		}
128
129		public bool Equals (Row<uint, uint> x, Row<uint, uint> y)
130		{
131			return x.Col1 == y.Col1
132				&& x.Col2 == y.Col2;
133		}
134
135		public int GetHashCode (Row<uint, uint> obj)
136		{
137			return (int) (obj.Col1 ^ obj.Col2);
138		}
139
140		public bool Equals (Row<uint, uint, uint> x, Row<uint, uint, uint> y)
141		{
142			return x.Col1 == y.Col1
143				&& x.Col2 == y.Col2
144				&& x.Col3 == y.Col3;
145		}
146
147		public int GetHashCode (Row<uint, uint, uint> obj)
148		{
149			return (int) (obj.Col1 ^ obj.Col2 ^ obj.Col3);
150		}
151	}
152}