Skip to content

Commit aaca03d

Browse files
committed
fixed whitespacing
1 parent 04e985b commit aaca03d

File tree

1 file changed

+123
-123
lines changed

1 file changed

+123
-123
lines changed

cs/cs/Serializer/VowpalWabbitDefaultMarshallerExt.tt

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,45 @@ namespace VW.Serializer
2323
{
2424
public partial class VowpalWabbitDefaultMarshaller
2525
{
26-
<# foreach(var t in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16), typeof(UInt32), typeof(float), typeof(Int64), typeof(UInt64), typeof(double) }) { #>
27-
/// <summary>
26+
<# foreach(var t in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16), typeof(UInt32), typeof(float), typeof(Int64), typeof(UInt64), typeof(double) }) { #>
27+
/// <summary>
2828
/// Transfers feature data to native space.
2929
/// </summary>
30-
/// <param name="context">The marshalling context.</param>
31-
/// <param name="ns">The namespace description.</param>
32-
/// <param name="feature">The feature description.</param>
33-
/// <param name="value">The feature value.</param>
30+
/// <param name="context">The marshalling context.</param>
31+
/// <param name="ns">The namespace description.</param>
32+
/// <param name="feature">The feature description.</param>
33+
/// <param name="value">The feature value.</param>
3434
public void MarshalFeature(VowpalWabbitMarshalContext context, Namespace ns, PreHashedFeature feature, <#=t#> value)
3535
{
3636
Contract.Requires(context != null);
3737
Contract.Requires(ns != null);
3838
Contract.Requires(feature != null);
3939

40-
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
41-
#if DEBUG
40+
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
41+
#if DEBUG
4242
if (value > float.MaxValue || value < float.MinValue)
4343
{
4444
Trace.TraceWarning("Precision lost for feature value: " + value);
4545
}
46-
#endif
47-
<# } #>
46+
#endif
47+
<# } #>
4848

49-
context.NamespaceBuilder.AddFeature(feature.FeatureHash, (float)value);
49+
context.NamespaceBuilder.AddFeature(feature.FeatureHash, (float)value);
5050

5151
context.AppendStringExample(
52-
feature.Dictify,
52+
feature.Dictify,
5353
" {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}"),
5454
feature.Name,
5555
value);
5656
}
5757

58-
/// <summary>
58+
/// <summary>
5959
/// Transfers feature data to native space.
6060
/// </summary>
61-
/// <param name="context">The marshalling context.</param>
62-
/// <param name="ns">The namespace description.</param>
63-
/// <param name="feature">The feature description.</param>
64-
/// <param name="value">The feature value.</param>
61+
/// <param name="context">The marshalling context.</param>
62+
/// <param name="ns">The namespace description.</param>
63+
/// <param name="feature">The feature description.</param>
64+
/// <param name="value">The feature value.</param>
6565
public unsafe void MarshalFeature(VowpalWabbitMarshalContext context, Namespace ns, Feature feature, <#=t#>[] value)
6666
{
6767
if (value == null)
@@ -74,57 +74,57 @@ namespace VW.Serializer
7474
// support anchor feature
7575
if (feature.AddAnchor)
7676
{
77-
context.NamespaceBuilder.PreAllocate(value.Length + 1);
77+
context.NamespaceBuilder.PreAllocate(value.Length + 1);
7878

7979
context.NamespaceBuilder.AddFeature(ns.NamespaceHash, 1);
8080
i++;
8181
}
82-
else
83-
{
84-
context.NamespaceBuilder.PreAllocate(value.Length);
85-
}
82+
else
83+
{
84+
context.NamespaceBuilder.PreAllocate(value.Length);
85+
}
8686

87-
<# if (t == typeof(float)) { #>
87+
<# if (t == typeof(float)) { #>
8888

89-
fixed (float* begin = value)
90-
{
91-
context.NamespaceBuilder.AddFeaturesUnchecked((ulong)(ns.NamespaceHash + i), begin, begin + value.Length);
92-
}
89+
fixed (float* begin = value)
90+
{
91+
context.NamespaceBuilder.AddFeaturesUnchecked((ulong)(ns.NamespaceHash + i), begin, begin + value.Length);
92+
}
9393

94-
<# } else { #>
94+
<# } else { #>
9595

9696
foreach (var v in value)
9797
{
98-
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
99-
#if DEBUG
100-
if (v > float.MaxValue || v < float.MinValue)
101-
{
102-
Trace.TraceWarning("Precision lost for feature value: " + v);
103-
}
104-
#endif
105-
<# } #>
98+
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
99+
#if DEBUG
100+
if (v > float.MaxValue || v < float.MinValue)
101+
{
102+
Trace.TraceWarning("Precision lost for feature value: " + v);
103+
}
104+
#endif
105+
<# } #>
106106

107107
context.NamespaceBuilder.AddFeature((ulong)(ns.NamespaceHash + i), (float)v);
108108
i++;
109109
}
110-
<# } #>
110+
<# } #>
111111

112112
if (context.StringExample == null)
113113
{
114114
return;
115115
}
116116

117-
string featureString;
118-
if (feature.Dictify && context.FastDictionary != null)
119-
{
120-
if (context.FastDictionary.TryGetValue(value, out featureString))
121-
{
122-
context.AppendStringExample(feature.Dictify, featureString);
123-
return;
124-
}
125-
}
117+
string featureString;
118+
if (feature.Dictify && context.FastDictionary != null)
119+
{
120+
if (context.FastDictionary.TryGetValue(value, out featureString))
121+
{
122+
context.AppendStringExample(feature.Dictify, featureString);
123+
return;
124+
}
125+
}
126126

127-
var featureBuilder = new StringBuilder();
127+
var featureBuilder = new StringBuilder();
128128

129129
// support anchor feature
130130
i = 0;
@@ -134,34 +134,34 @@ namespace VW.Serializer
134134
i++;
135135
}
136136

137-
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
137+
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
138138
foreach (var v in value)
139139
{
140140
featureBuilder.AppendFormat(
141-
CultureInfo.InvariantCulture,
142-
format,
143-
i,
144-
v);
141+
CultureInfo.InvariantCulture,
142+
format,
143+
i,
144+
v);
145145
i++;
146146
}
147147

148-
featureString = featureBuilder.ToString();
148+
featureString = featureBuilder.ToString();
149149

150-
if (feature.Dictify && context.FastDictionary != null)
151-
{
152-
context.FastDictionary.Add(value, featureString);
153-
}
150+
if (feature.Dictify && context.FastDictionary != null)
151+
{
152+
context.FastDictionary.Add(value, featureString);
153+
}
154154

155-
context.AppendStringExample(feature.Dictify, featureString);
155+
context.AppendStringExample(feature.Dictify, featureString);
156156
}
157157

158-
/// <summary>
158+
/// <summary>
159159
/// Transfers feature data to native space.
160160
/// </summary>
161-
/// <param name="context">The marshalling context.</param>
162-
/// <param name="ns">The namespace description.</param>
163-
/// <param name="feature">The feature description.</param>
164-
/// <param name="value">The feature value.</param>
161+
/// <param name="context">The marshalling context.</param>
162+
/// <param name="ns">The namespace description.</param>
163+
/// <param name="feature">The feature description.</param>
164+
/// <param name="value">The feature value.</param>
165165
public void MarshalFeature(VowpalWabbitMarshalContext context, Namespace ns, Feature feature, IEnumerable<<#=t#>> value)
166166
{
167167
if (value == null)
@@ -180,14 +180,14 @@ namespace VW.Serializer
180180

181181
foreach (var v in value)
182182
{
183-
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
184-
#if DEBUG
185-
if (v > float.MaxValue || v < float.MinValue)
186-
{
187-
Trace.TraceWarning("Precision lost for feature value: " + v);
188-
}
189-
#endif
190-
<# } #>
183+
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
184+
#if DEBUG
185+
if (v > float.MaxValue || v < float.MinValue)
186+
{
187+
Trace.TraceWarning("Precision lost for feature value: " + v);
188+
}
189+
#endif
190+
<# } #>
191191

192192
context.NamespaceBuilder.AddFeature((ulong)(ns.NamespaceHash + i), (float)v);
193193
i++;
@@ -198,17 +198,17 @@ namespace VW.Serializer
198198
return;
199199
}
200200

201-
string featureString;
202-
if (feature.Dictify && context.FastDictionary != null)
203-
{
204-
if (context.FastDictionary.TryGetValue(value, out featureString))
205-
{
206-
context.AppendStringExample(feature.Dictify, featureString);
207-
return;
208-
}
209-
}
201+
string featureString;
202+
if (feature.Dictify && context.FastDictionary != null)
203+
{
204+
if (context.FastDictionary.TryGetValue(value, out featureString))
205+
{
206+
context.AppendStringExample(feature.Dictify, featureString);
207+
return;
208+
}
209+
}
210210

211-
var featureBuilder = new StringBuilder();
211+
var featureBuilder = new StringBuilder();
212212

213213
// support anchor feature
214214
i = 0;
@@ -218,84 +218,84 @@ namespace VW.Serializer
218218
i++;
219219
}
220220

221-
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
221+
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
222222
foreach (var v in value)
223223
{
224224
featureBuilder.AppendFormat(
225-
CultureInfo.InvariantCulture,
226-
format,
227-
i,
228-
v);
225+
CultureInfo.InvariantCulture,
226+
format,
227+
i,
228+
v);
229229
i++;
230230
}
231231

232-
featureString = featureBuilder.ToString();
232+
featureString = featureBuilder.ToString();
233233

234-
if (feature.Dictify && context.FastDictionary != null)
235-
{
236-
context.FastDictionary.Add(value, featureString);
237-
}
234+
if (feature.Dictify && context.FastDictionary != null)
235+
{
236+
context.FastDictionary.Add(value, featureString);
237+
}
238238

239-
context.AppendStringExample(feature.Dictify, featureString);
239+
context.AppendStringExample(feature.Dictify, featureString);
240240
}
241241

242-
<# } #>
242+
<# } #>
243243

244-
<# foreach(var t in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16) }) { #>
244+
<# foreach(var t in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16) }) { #>
245245

246-
<# foreach(var s in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16), typeof(UInt32), typeof(float), typeof(Int64), typeof(UInt64), typeof(double) }) { #>
246+
<# foreach(var s in new[] { typeof(byte), typeof(sbyte), typeof(Int16), typeof(Int32), typeof(UInt16), typeof(UInt32), typeof(float), typeof(Int64), typeof(UInt64), typeof(double) }) { #>
247247

248-
/// <summary>
248+
/// <summary>
249249
/// Transfers feature data to native space.
250250
/// </summary>
251-
/// <param name="context">The marshalling context.</param>
252-
/// <param name="ns">The namespace description.</param>
253-
/// <param name="feature">The feature description.</param>
254-
/// <param name="value">The feature value.</param>
255-
[ContractVerification(false)]
251+
/// <param name="context">The marshalling context.</param>
252+
/// <param name="ns">The namespace description.</param>
253+
/// <param name="feature">The feature description.</param>
254+
/// <param name="value">The feature value.</param>
255+
[ContractVerification(false)]
256256
public void MarshalFeature(VowpalWabbitMarshalContext context, Namespace ns, Feature feature, IDictionary<<#=t#>, <#=s#>> value)
257257
{
258258
Contract.Requires(context != null);
259259
Contract.Requires(ns != null);
260260
Contract.Requires(feature != null);
261261

262-
if (value == null)
263-
{
264-
return;
265-
}
262+
if (value == null)
263+
{
264+
return;
265+
}
266266

267267
foreach (var kvp in value)
268268
{
269-
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
270-
#if DEBUG
271-
if (kvp.Value > float.MaxValue || kvp.Value < float.MinValue)
272-
{
273-
Trace.TraceWarning("Precision lost for feature value: " + kvp.Value);
274-
}
275-
#endif
276-
<# } #>
277-
278-
context.NamespaceBuilder.AddFeature(ns.NamespaceHash + (ulong)kvp.Key, (float)kvp.Value);
269+
<# if(new[]{ typeof(Int64), typeof(UInt64), typeof(double) }.Contains(t)) {#>
270+
#if DEBUG
271+
if (kvp.Value > float.MaxValue || kvp.Value < float.MinValue)
272+
{
273+
Trace.TraceWarning("Precision lost for feature value: " + kvp.Value);
274+
}
275+
#endif
276+
<# } #>
277+
278+
context.NamespaceBuilder.AddFeature(ns.NamespaceHash + (ulong)kvp.Key, (float)kvp.Value);
279279
}
280280

281-
if (context.StringExample == null)
281+
if (context.StringExample == null)
282282
{
283283
return;
284284
}
285285

286-
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
287-
foreach (var kvp in value)
286+
var format = " {0}:" + (context.VW.Settings.EnableStringFloatCompact ? "{1}" : "{1:E20}");
287+
foreach (var kvp in value)
288288
{
289-
// TODO: not sure if negative numbers will work
289+
// TODO: not sure if negative numbers will work
290290
context.AppendStringExample(
291-
feature.Dictify,
291+
feature.Dictify,
292292
format,
293293
kvp.Key,
294294
kvp.Value);
295-
}
295+
}
296296
}
297-
<# } #>
297+
<# } #>
298298

299-
<# } #>
299+
<# } #>
300300
}
301301
}

0 commit comments

Comments
 (0)