CommandLine\CmdParser.cs (63)
238Contracts.CheckValue(env, nameof(env));
281Contracts.CheckValue(destination, nameof(destination));
292Contracts.CheckValue(env, nameof(env));
430Contracts.AssertValueOrNull(reporter);
455Contracts.Assert(1 < firstNonUpper && firstNonUpper <= name.Length);
464Contracts.CheckValue(type, nameof(type));
465Contracts.CheckParam(type.IsClass, nameof(type));
476Contracts.Check(!field.IsStatic && !field.IsInitOnly && !field.IsLiteral);
479throw Contracts.Except($"Duplicate default argument '{def.LongName}' vs '{field.Name}'");
497Contracts.Assert(!isDefault || nicks == null);
500throw Contracts.Except($"Duplicate name '{name}' in argument type '{type.Name}'");
506throw Contracts.Except($"Duplicate name '{nick}' in argument type '{type.Name}'");
530Contracts.Assert(def.ShortNames == null);
532Contracts.Assert(map.ContainsKey(name) && map[name] == def);
569Contracts.Assert(!string.IsNullOrEmpty(str));
622Contracts.AssertValue(arg);
623Contracts.Assert(arg != info.ArgDef);
624Contracts.Assert(0 <= arg.Index && arg.Index < info.Args.Length);
1038Contracts.Assert(ich < curs.IchCur || curs.Eof);
1091Contracts.Assert(ich < curs.IchCur || curs.Eof);
1166throw Contracts.Except("Invalid Component string: mismatched braces, or empty component name.");
1179Contracts.AssertValueOrNull(first);
1191Contracts.AssertValue(info);
1192Contracts.AssertValue(args);
1206Contracts.Assert(Args.Where(a => a.Index == argument.Index).Count() == 1);
1208Contracts.AssertValue(arg);
1248Contracts.AssertValue(arg);
1254Contracts.CheckValue(type, nameof(type));
1255Contracts.CheckValueOrNull(defaults);
1266Contracts.AssertValue(type);
1270Contracts.Assert(isGeneric);
1272Contracts.Assert(Utils.Size(genArgs) == 1);
1342Contracts.Assert(argDef == null || argDef.Index == -1);
1343Contracts.AssertValue(args);
1344Contracts.AssertValue(map);
1345Contracts.Assert(map.Count >= args.Length);
1346Contracts.Assert(args.Select((arg, index) => arg.Index == index).All(b => b));
1365Contracts.AssertValue(type);
1374Contracts.AssertValue(type);
1383Contracts.AssertValue(sb);
1422Contracts.Assert(index >= -1);
1423Contracts.Assert(!string.IsNullOrWhiteSpace(name));
1424Contracts.Check(nicks == null || nicks.All(nick => !string.IsNullOrWhiteSpace(nick)));
1425Contracts.AssertValueOrNull(defaults);
1426Contracts.AssertValue(attr);
1427Contracts.AssertValue(field);
1441Contracts.Assert(!IsDefault || Utils.Size(ShortNames) == 0);
1485throw Contracts.Except("Invalid argument type: '{0}'", ItemValueType.Name);
1488Contracts.Check(!IsCollection || AllowMultiple, "Collection arguments must allow multiple");
1489Contracts.Check(!Unique || IsCollection, "Unique only applicable to collection arguments");
1494Contracts.AssertValue(type);
1498Contracts.AssertValue(type.GenericTypeArguments);
1545Contracts.Check(_signatureType != null, "ComponentFactory Arguments need a SignatureType set.");
1682Contracts.Assert(string.IsNullOrEmpty(tag) || tag.StartsWith("[") && tag.EndsWith("]"));
1709Contracts.Assert(newValue is string || newValue == null);
1710Contracts.Assert((string)newValue != "");
1892Contracts.Assert(type.IsEnum);
1929Contracts.Assert(success);
1966Contracts.Assert(value == null || value is Array);
2037Contracts.Assert(IsKeyValuePair(type));
2065Contracts.Assert(value == null || value is Array);
2242Contracts.Assert(false);
2292throw Contracts.ExceptNotImpl("ComponentFactoryFactory can only create IComponentFactory<> types with 4 or less type args.");
ComponentModel\ComponentCatalog.cs (69)
202Contracts.AssertValue(attr);
203Contracts.AssertValue(attr.InstanceType);
204Contracts.AssertValue(attr.LoaderType);
205Contracts.AssertValueOrNull(attr.Summary);
206Contracts.AssertValueOrNull(attr.DocName);
207Contracts.AssertValueOrNull(attr.UserName);
208Contracts.AssertNonEmpty(attr.LoadNames);
209Contracts.Assert(getter == null || Utils.Size(attr.CtorTypes) == 0);
231Contracts.Assert(ArgType == null || CtorTypes.Length > 0 && CtorTypes[0] == ArgType);
236Contracts.Assert(Utils.Size(ctorArgs) == CtorTypes.Length + ((RequireEnvironment) ? 1 : 0));
241Contracts.Assert(Utils.Size(ctorArgs) == 0);
252throw Contracts.Except(ex, "Error during class instantiation");
256throw Contracts.Except("Can't instantiate class '{0}'", Type.Name);
267Contracts.CheckValue(env, nameof(env));
289throw Contracts.Except("Loadable class '{0}' does not derive from '{1}'", LoadNames[0], typeof(TRes).FullName);
299throw Contracts.Except("Loadable class '{0}' does not derive from '{1}'", LoadNames[0], typeof(TRes).FullName);
315throw Contracts.Except("Loadable class '{0}' has ArgType '{1}', which has no suitable constructor",
343Contracts.AssertValue(method);
344Contracts.AssertValue(attribute);
357throw Contracts.Except("Method '{0}' has {1} parameters, but must have 2 or 3", method.Name, parameters.Length);
359throw Contracts.Except("Method '{0}', 1st parameter is {1}, but must be IHostEnvironment", method.Name, parameters[0].ParameterType);
363throw Contracts.Except("Method '{0}' returns {1}, but must return a class", method.Name, outputType);
407Contracts.AssertValue(interfaceType);
408Contracts.AssertNonEmpty(kind);
409Contracts.AssertValue(argumentType);
410Contracts.AssertValue(attribute);
421throw Contracts.Except("Invalid component kind: '{0}'", Kind);
425throw Contracts.Except("Component name '{0}' is not valid.", Name);
428throw Contracts.Except("Component '{0}' has an invalid alias '{1}'", Name, Aliases.First(x => !IsValidName(x)));
431throw Contracts.Except("Component '{0}' must inherit from IComponentFactory", argumentType);
496throw Contracts.Except($"Can't load type {instType}, because it has both create and constructor methods with the same visibility. Please indicate which one should be used by changing either the signature or the visibility of one of them.");
541throw Contracts.Except($"ComponentCatalog cannot map name '{name}' and SignatureType '{sigType}' to {info.Type.Name}, already mapped to {infoCur.Type.Name}.");
610throw Contracts.Except("Component signature '{0}' doesn't inherit from '{1}'", faceType, typeof(IComponentFactory));
619throw Contracts.Except(ex, "Component type '{0}' doesn't have a default constructor", faceType);
701throw Contracts.Except(
704Contracts.Assert(getter == null && ctor == null && create == null);
733Contracts.CheckValue(typeBase, nameof(typeBase));
734Contracts.CheckValueOrNull(typeSig);
761Contracts.CheckValue(sig, nameof(sig));
762Contracts.CheckParam(sig.BaseType == typeof(MulticastDelegate), nameof(sig), "Must be a delegate type");
816Contracts.CheckParam(signatureType.BaseType == typeof(MulticastDelegate), nameof(signatureType), "signatureType must be a delegate type");
817Contracts.CheckValueOrNull(loadName);
834Contracts.CheckNonEmpty(name, nameof(name));
841Contracts.CheckNonEmpty(kind, nameof(kind));
842Contracts.CheckNonEmpty(alias, nameof(alias));
852Contracts.CheckValue(argumentType, nameof(argumentType));
861Contracts.CheckValue(interfaceType, nameof(interfaceType));
862Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface");
863Contracts.CheckValue(argumentType, nameof(argumentType));
872Contracts.CheckValue(interfaceType, nameof(interfaceType));
873Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface");
874Contracts.CheckNonEmpty(alias, nameof(alias));
886Contracts.CheckValue(interfaceType, nameof(interfaceType));
887Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface");
888Contracts.CheckNonEmpty(alias, nameof(alias));
918Contracts.CheckNonEmpty(kind, nameof(kind));
919Contracts.CheckParam(IsValidName(kind), nameof(kind), "Invalid component kind");
929Contracts.CheckValue(interfaceType, nameof(interfaceType));
936Contracts.CheckValue(signatureType, nameof(signatureType));
966Contracts.AssertValueOrNull(name);
982throw Contracts.Except("Unknown loadable class: {0}", name).MarkSensitive(MessageSensitivity.None);
1000Contracts.CheckValue(env, nameof(env));
1034throw Contracts.Except("Can't instantiate arguments object '{0}' for '{1}'", info.ArgType.Name, name);
1051Contracts.AssertValue(args);
1052Contracts.AssertNonEmpty(name);
1067Contracts.Assert(false);
1068throw Contracts.Except(e, "Unexpected exception thrown while parsing: " + e.Message);
1072throw Contracts.Except(errorMsg);
1092throw Contracts.Except($"An extension for '{key.AttributeType.Name}' with contract '{key.ContractName}' has already been registered in the ComponentCatalog.");
ComponentModel\LoadableClassAttribute.cs (17)
163Contracts.CheckValueOrNull(summary);
164Contracts.CheckValue(instType, nameof(instType));
165Contracts.CheckValue(loaderType, nameof(loaderType));
166Contracts.CheckNonEmpty(sigTypes, nameof(sigTypes));
172throw Contracts.ExceptEmpty(nameof(loadNames), "LoadableClass loadName parameter can't be empty");
175Contracts.CheckValue(sigType, nameof(sigTypes));
177Contracts.CheckParam(sigType.BaseType == typeof(System.MulticastDelegate), nameof(sigTypes), "LoadableClass signature type must be a delegate type");
180Contracts.CheckParam(meth != null, nameof(sigTypes), "LoadableClass signature type must be a delegate type");
181Contracts.CheckParam(meth.ReturnType == typeof(void), nameof(sigTypes), "LoadableClass signature type must be a delegate type with void return");
200throw Contracts.Except("Invalid signature parameter attributes");
207Contracts.CheckValue(sigType, nameof(sigTypes));
209Contracts.Check(sigType.BaseType == typeof(System.MulticastDelegate), "LoadableClass signature type must be a delegate type");
212Contracts.CheckParam(meth != null, nameof(sigTypes), "LoadableClass signature type must be a delegate type");
213Contracts.CheckParam(meth.ReturnType == typeof(void), nameof(sigTypes), "LoadableClass signature type must be a delegate type with void return");
215Contracts.CheckParam(parms.Length + itypeBase == types.Length, nameof(sigTypes), "LoadableClass signatures must have the same number of parameters");
220throw Contracts.ExceptParam(nameof(sigTypes), "Invalid signature parameter attributes");
221Contracts.CheckParam(types[itypeBase + itype] == parm.ParameterType, nameof(sigTypes),
Data\AnnotationUtils.cs (15)
118public static Exception ExceptGetAnnotation() => Contracts.Except("Invalid call to GetAnnotation");
130Contracts.CheckValue(getter, nameof(getter));
144Contracts.CheckParam(size > 0, nameof(size), "must be known size");
156Contracts.CheckParam(rangeCount > 0, nameof(rangeCount), "must be known size");
198Contracts.CheckValue(type, nameof(type));
300Contracts.CheckValueOrNull(schema);
301Contracts.CheckParam(vectorSize >= 0, nameof(vectorSize));
326Contracts.CheckParam(column.IsValid, nameof(column), "struct not initialized properly");
341Contracts.CheckParam(col.IsValid, nameof(col), "struct not initialized properly");
360Contracts.CheckValue(schema, nameof(schema));
361Contracts.CheckValue(type, nameof(type));
380Contracts.CheckValue(schema, nameof(schema));
381Contracts.Check(colIndex >= 0, nameof(colIndex));
464Contracts.AssertValue(annotations);
497Contracts.CheckValue(annotations, nameof(annotations));
Data\IEstimator.cs (10)
64Contracts.CheckNonEmpty(name, nameof(name));
65Contracts.CheckValueOrNull(annotations);
66Contracts.CheckParam(!(itemType is KeyDataViewType), nameof(itemType), "Item type cannot be a key");
67Contracts.CheckParam(!(itemType is VectorDataViewType), nameof(itemType), "Item type cannot be a vector");
68Contracts.CheckParam(!isKey || KeyDataViewType.IsValidDataType(itemType.RawType), nameof(itemType), "The item type must be valid for a key");
89Contracts.Check(source.IsValid, nameof(source));
131Contracts.CheckValue(columns, nameof(columns));
133Contracts.CheckParam(columns.All(c => c.IsValid), nameof(columns), "Some items are not initialized properly.");
180Contracts.CheckValue(schema, nameof(schema));
209Contracts.CheckValue(name, nameof(name));
Data\ModelHeader.cs (76)
109Contracts.Assert(Marshal.SizeOf(typeof(ModelHeader)) == Size);
110Contracts.CheckValue(writer, nameof(writer));
122Contracts.CheckIO(writer.FpCur() == fpMin + ModelHeader.Size);
131Contracts.CheckValue(writer, nameof(writer));
132Contracts.CheckParam(fpMin >= 0, nameof(fpMin));
133Contracts.CheckValueOrNull(pool);
138Contracts.Check(header.FpStringTable == 0);
139Contracts.Check(header.CbStringTable == 0);
140Contracts.Check(header.FpStringChars == 0);
141Contracts.Check(header.CbStringChars == 0);
152Contracts.Assert(ns.Id == cv);
157Contracts.Assert(cv == pool.Count);
160Contracts.Assert(header.FpStringChars == header.FpStringTable + header.CbStringTable);
167Contracts.Assert(offset == header.CbStringChars);
199Contracts.CheckValue(writer, nameof(writer));
200Contracts.CheckParam(fpMin >= 0, nameof(fpMin));
210Contracts.Assert(res);
211Contracts.Check(res);
218Contracts.Assert(writer.FpCur() == fpMin + ModelHeader.Size);
228Contracts.Check(header.FpModel == ModelHeader.Size);
229Contracts.Check(header.CbModel == 0);
232Contracts.Check(fpCur - fpMin >= header.FpModel);
262Contracts.Check(sig.Length <= 24);
266Contracts.Check(ch <= 0xFF);
288Contracts.Check(sig.Length <= 24);
292Contracts.Check(ch <= 0xFF);
307Contracts.Check(Utils.Size(bytes) >= Size);
326Contracts.CheckDecode(headerBytes.Length == ModelHeader.Size);
342Contracts.CheckDecode(header.FpModel + header.CbModel == reader.FpCur() - fpMin);
351Contracts.CheckDecode(header.ModelSignature == ver.ModelSignature, "Unknown file type");
352Contracts.CheckDecode(header.ModelVerReadable <= header.ModelVerWritten, "Corrupt file header");
354throw Contracts.ExceptDecode("Cause: ML.NET {0} cannont read component '{1}' of the model, because the model is too new.\n" +
362throw Contracts.ExceptDecode("Cause: ML.NET {0} cannot read component '{1}' of the model, because the model is too old.\n" +
374Contracts.Check(Utils.Size(bytes) >= Size);
388Contracts.Check(size >= 0);
392Contracts.CheckDecode(header.Signature == SignatureValue, "Wrong file type");
393Contracts.CheckDecode(header.VerReadable <= header.VerWritten, "Corrupt file header");
394Contracts.CheckDecode(header.VerReadable <= VerWrittenCur, "File is too new");
395Contracts.CheckDecode(header.VerWritten >= VerWeCanReadBack, "File is too old");
398Contracts.CheckDecode(header.FpModel == Size);
399Contracts.CheckDecode(header.FpModel + header.CbModel >= header.FpModel);
404Contracts.CheckDecode(header.CbStringTable == 0);
405Contracts.CheckDecode(header.FpStringChars == 0);
406Contracts.CheckDecode(header.CbStringChars == 0);
409Contracts.CheckDecode(header.FpTail == header.FpModel + header.CbModel);
415Contracts.CheckDecode(header.FpStringTable == header.FpModel + header.CbModel);
416Contracts.CheckDecode(header.CbStringTable % sizeof(long) == 0);
417Contracts.CheckDecode(header.CbStringTable / sizeof(long) < int.MaxValue);
418Contracts.CheckDecode(header.FpStringTable + header.CbStringTable > header.FpStringTable);
419Contracts.CheckDecode(header.FpStringChars == header.FpStringTable + header.CbStringTable);
420Contracts.CheckDecode(header.CbStringChars % sizeof(char) == 0);
421Contracts.CheckDecode(header.FpStringChars + header.CbStringChars >= header.FpStringChars);
424Contracts.CheckDecode(header.FpTail == header.FpStringChars + header.CbStringChars);
432Contracts.CheckDecode(header.CbAssemblyName == 0);
439Contracts.CheckDecode(header.FpAssemblyName == header.FpModel + header.CbModel);
443Contracts.CheckDecode(header.FpAssemblyName == header.FpStringChars + header.CbStringChars);
445Contracts.CheckDecode(header.CbAssemblyName % sizeof(char) == 0);
446Contracts.CheckDecode(header.FpTail == header.FpAssemblyName + header.CbAssemblyName);
450Contracts.CheckDecode(header.FpLim == header.FpTail + sizeof(ulong));
451Contracts.CheckDecode(size == 0 || size >= header.FpLim);
468Contracts.CheckValue(reader, nameof(reader));
469Contracts.Check(fpMin >= 0);
503Contracts.Assert(reader.FpCur() == header.FpStringTable + fpMin);
506Contracts.Assert(cstr < int.MaxValue);
508Contracts.Assert(header.FpStringChars == reader.FpCur() - fpMin);
509Contracts.CheckDecode(offsets[cstr - 1] == header.CbStringChars);
516Contracts.CheckDecode(header.FpStringChars + offset == reader.FpCur() - fpMin);
520Contracts.CheckDecode(offsetPrev <= offset && offset <= header.CbStringChars);
521Contracts.CheckDecode(offset % sizeof(char) == 0);
523Contracts.CheckDecode(cch < int.MaxValue);
530Contracts.CheckDecode(offset == header.CbStringChars);
531Contracts.CheckDecode(header.FpStringChars + header.CbStringChars == reader.FpCur() - fpMin);
551Contracts.CheckDecode(header.FpTail == reader.FpCur() - fpMin);
554Contracts.CheckDecode(tail == TailSignatureValue, "Corrupt model file tail");
643Contracts.Check(Utils.Size(modelSignature) == 8, "Model signature must be eight characters");
648Contracts.Check(ch <= 0xFF);
Data\RoleMappedSchema.cs (38)
103Contracts.CheckNonEmpty(value, nameof(value));
159Contracts.AssertValue(schema);
160Contracts.AssertValue(map);
166Contracts.Assert(Utils.Size(kvp.Value) > 0);
170Contracts.Assert(!schema[info.Index].IsHidden, "How did a hidden column sneak in?");
203Contracts.AssertValue(map);
204Contracts.AssertNonEmpty(role.Value);
216Contracts.AssertValue(schema);
217Contracts.AssertValue(roles);
222Contracts.AssertNonEmpty(kvp.Key.Value);
229throw Contracts.ExceptParam(nameof(schema), $"{kvp.Value} column '{kvp.Key.Value}' not found");
307throw Contracts.Except("Expected exactly one column with role '{0}', but found {1}.", role.Value, Utils.Size(infos));
316Contracts.Assert(Utils.Size(kvp.Value) > 0);
334: this(Contracts.CheckRef(schema, nameof(schema)), Contracts.CheckRef(roles, nameof(roles)), opt)
349: this(Contracts.CheckRef(schema, nameof(schema)),
350MapFromNames(schema, Contracts.CheckRef(roles, nameof(roles)), opt))
392: this(Contracts.CheckRef(schema, nameof(schema)), PredefinedRolesHelper(label, feature, group, weight, name, custom), opt)
394Contracts.CheckValueOrNull(label);
395Contracts.CheckValueOrNull(feature);
396Contracts.CheckValueOrNull(group);
397Contracts.CheckValueOrNull(weight);
398Contracts.CheckValueOrNull(name);
399Contracts.CheckValueOrNull(custom);
424Contracts.AssertValue(data);
425Contracts.AssertValue(schema);
426Contracts.Assert(schema.Schema == data.Schema);
442: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt))
457: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt))
478: this(Contracts.CheckRef(data, nameof(data)),
481Contracts.CheckValueOrNull(label);
482Contracts.CheckValueOrNull(feature);
483Contracts.CheckValueOrNull(group);
484Contracts.CheckValueOrNull(weight);
485Contracts.CheckValueOrNull(name);
486Contracts.CheckValueOrNull(custom);
EntryPoints\ModuleArgs.cs (16)
165Contracts.Check(_inf == null,
167Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) != -1,
169Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1,
184Contracts.Check(_sup == null,
186Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) != 1,
188Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1,
203Contracts.Check(_min == null,
205Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) == 1,
207Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1,
222Contracts.Check(_max == null,
224Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) == -1,
226Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1,
234Contracts.CheckValue(val, nameof(val));
237Contracts.Check(val is IComparable, "Type for range attribute must support IComparable");
241Contracts.Check(_type == val.GetType(), "All Range attribute values must be of the same type");
602Contracts.AssertValue(type);
Utilities\BigArray.cs (59)
73Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range.");
80Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range.");
93Contracts.Assert(BlockSize > 1 && (BlockSize & (BlockSize - 1)) == 0, "Block size is not a power of two.");
95Contracts.CheckParam(size >= 0, nameof(size), "Must be non-negative.");
102Contracts.CheckParam(size <= MaxSize, nameof(size), "Size of BigArray is too large.");
104Contracts.Assert(longBlockCount <= Utils.ArrayMaxSize);
107Contracts.Assert(blockCount > 0);
108Contracts.Assert(0 < lastBlockSize && lastBlockSize <= BlockSize);
124Contracts.CheckValue(manip, nameof(manip));
125Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range.");
137Contracts.CheckValue(manip, nameof(manip));
138Contracts.CheckParam(min >= 0, nameof(min), "Specified minimum index must be non-negative.");
139Contracts.CheckParam(lim <= _length, nameof(lim), "Specified limit index must be no more than length of the array.");
157Contracts.Assert(index == lim);
165Contracts.CheckParam(min >= 0, nameof(min), "Specified minimum index must be non-negative.");
166Contracts.CheckParam(lim <= _length, nameof(lim), "Specified limit index must be no more than length of the array.");
192Contracts.Assert(index == lim);
211Contracts.CheckParam(newLength >= 0, nameof(newLength), "Specified new size must be non-negative.");
212Contracts.CheckParam(newLength <= MaxSize, nameof(newLength), "Specified new size is too large.");
226Contracts.Assert(0 < longBlockCount && longBlockCount <= Utils.ArrayMaxSize);
229Contracts.Assert(0 < newLastBlockLength && newLastBlockLength <= BlockSize);
243Contracts.Assert(curBlockCount > 0);
246Contracts.Assert(0 < curLastBlockLength && curLastBlockLength <= curLastBlockSize && curLastBlockSize <= BlockSize);
251Contracts.Assert(newBlockCount < curBlockCount || (newBlockCount == curBlockCount && newLastBlockLength < curLastBlockLength));
259Contracts.Assert(curBlockCount == newBlockCount);
264Contracts.Assert(_length == curLastBlockLength);
265Contracts.Assert(newLength == newLastBlockLength);
266Contracts.Assert(_entries.Length == 1);
279Contracts.Assert(newBlockCount > curBlockCount);
296Contracts.Assert(Utils.Size(_entries) == 0);
303Contracts.Assert(maMax >= 0);
304Contracts.Assert(0 < miLim && miLim <= Utils.Size(_entries[maMax]));
331Contracts.Assert(maMin <= maMax); // Could be violated if length == 0, but we already took care of this.
337Contracts.Assert(miLim - miMin == src.Length);
343Contracts.Assert((BlockSize - miMin) + miLim == src.Length);
347Contracts.Assert(_entries[maMax] == null);
362Contracts.Assert(_entries[major] == null);
366Contracts.Assert(srcSoFar < src.Length);
369Contracts.Assert(src.Length - srcSoFar == miLim);
370Contracts.Assert(_entries[maMax] == null);
389Contracts.Assert(0 <= length && length <= dst.Length);
390Contracts.Assert(idx <= Length && length <= Length - idx);
401Contracts.Assert(maMin <= maMax); // Could happen if length == 0, but we already took care of this.
406Contracts.Assert(miLim - miMin == length);
407Contracts.Assert(miLim <= Utils.Size(_entries[maMax]));
412Contracts.Assert((BlockSize - miMin) + miLim == length);
413Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin]));
415Contracts.Assert(miLim <= Utils.Size(_entries[maMax]));
423Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin]));
429Contracts.Assert(BlockSize <= Utils.Size(_entries[major]));
432Contracts.Assert(dstSoFar < length);
435Contracts.Assert(length - dstSoFar == miLim);
436Contracts.Assert(miLim <= Utils.Size(_entries[maMax]));
444Contracts.Assert(min >= 0);
445Contracts.Assert((min >> BlockSizeBits) < int.MaxValue);
448Contracts.Assert((long)major * BlockSize + minor == min);
453Contracts.Assert(lim > 0);
454Contracts.Assert((lim >> BlockSizeBits) < int.MaxValue);
458Contracts.Assert((long)major * BlockSize + minor == lim + 1);
Utilities\FuncInstanceMethodInfo1`2.cs (18)
39Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
40Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
60throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
64Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
65Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
71Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
72Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
74Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<TResult>), nameof(expression), "Unexpected expression form");
75Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
76Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
79Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
80Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
83Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
84Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`3.cs (18)
40Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
61throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
72Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
74Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form");
76Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
77Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
80Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
81Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
84Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
85Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form");
77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo2`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form");
77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`3.cs (18)
40Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
61throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
72Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
74Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form");
76Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
77Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
80Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
81Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
84Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
85Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method");
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage);
62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form");
66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form");
68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form");
69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form");
70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form");
73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form");
74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form");
75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form");
76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form");
77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form");
78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form");
81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form");
82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form");
86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\HybridMemoryStream.cs (23)
53throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize);
70Contracts.CheckValue(stream, nameof(stream));
71Contracts.CheckParam(stream.CanRead, nameof(stream), "Cannot copy a stream we cannot read");
73throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize);
79Contracts.CheckParam(stream.Position == 0, nameof(stream), "Should be at the head of the stream");
100Contracts.Assert(_memStream == null);
101Contracts.Assert(_overflowStream == null);
105Contracts.Assert((_memStream == null) != (_overflowStream == null));
106Contracts.Assert(Length <= _overflowBoundary || _overflowStream != null);
156Contracts.Check(!_disposed, "Stream already disposed");
159Contracts.Assert(_memStream != null);
163Contracts.Check(_memStream.CanRead, "attempt to perform operation on closed stream");
175Contracts.Assert(tmp, "TryGetBuffer failed in HybridMemoryStream");
187Contracts.CheckParam(0 <= value, nameof(value), "cannot be negative");
189Contracts.Check(!_disposed, "Stream already disposed");
199Contracts.Check(!_disposed, "Stream already disposed");
206Contracts.Check(!_disposed, "Stream already disposed");
213Contracts.Check(!_disposed, "Stream already disposed");
214Contracts.CheckValue(buffer, nameof(buffer));
215Contracts.CheckParam(0 <= offset && offset <= buffer.Length, nameof(offset));
216Contracts.CheckParam(0 <= count && count <= buffer.Length - offset, nameof(count));
226Contracts.Check(!_disposed, "Stream already disposed");
233Contracts.Check(!_disposed, "Stream already disposed");
Utilities\MathUtils.cs (40)
26Contracts.Assert(false, "Bad use of ToFloat");
27throw Contracts.Except();
59Contracts.CheckValue(x, nameof(x));
60Contracts.CheckValue(y, nameof(y));
61Contracts.Check(x.Length == y.Length, "Input and output must be same length.");
98Contracts.AssertValue(a);
112Contracts.AssertValue(a);
126Contracts.AssertValue(a);
285Contracts.Assert(FloatUtils.IsFinite(maxRelErr));
286Contracts.Assert(FloatUtils.IsFinite(maxAbsError));
307Contracts.CheckParam(x > 0, nameof(x), "LogGamma invalid for x <= 0");
350Contracts.CheckParam(n >= 0, nameof(n), "LogFactorial is invalid for n < 0.");
379Contracts.CheckParam(df > 0, nameof(df), "Degrees of freedom must be positive");
405Contracts.AssertValue(a);
406Contracts.AssertValue(b);
407Contracts.Assert(tol > 0);
436Contracts.Assert(0 <= x && x <= 1);
437Contracts.Assert(0 < a);
438Contracts.Assert(0 < b);
545Contracts.Assert(0 <= exp && exp < ExpInf);
572Contracts.Assert(0 <= n && n < ExpInf);
574Contracts.Assert(0 <= f && f < 1);
578Contracts.Assert(1 <= r && r < float.PositiveInfinity);
611Contracts.Assert(0 <= n && n < ExpInf);
613Contracts.Assert(0 <= f && f < 1);
617Contracts.Assert(1 <= r && r < float.PositiveInfinity);
651Contracts.Assert(0 <= n && n < ExpInf);
653Contracts.Assert(0 <= f && f < 1);
657Contracts.Assert(1 <= r && r < float.PositiveInfinity);
673Contracts.Assert(src.Length == dst.Length);
682Contracts.Assert(src.Length == dst.Length);
683Contracts.Assert(0 <= start && start <= end && end <= src.Length);
705Contracts.Assert(count >= 0);
706Contracts.Assert(Utils.Size(src) >= count);
718Contracts.Assert(ivMin <= ivLim);
724Contracts.Assert(!float.IsNaN(src[ivLim - 1]));
738Contracts.Assert(len > 0);
739Contracts.Assert(aIdx >= 0 && aIdx <= a.Length - len);
740Contracts.Assert(bIdx >= 0 && bIdx <= b.Length - len);
754Contracts.Assert(-1 - epsilon <= similarity && similarity <= 1 + epsilon);
Utilities\ReservoirSampler.cs (11)
72Contracts.CheckValue(rnd, nameof(rnd));
73Contracts.CheckParam(size > 0, nameof(size), "Reservoir size must be positive");
74Contracts.CheckValue(getter, nameof(getter));
84throw Contracts.Except("Cannot continue to sample after Lock() has been called");
110throw Contracts.Except("Call Lock() before the call to GetSample()");
151Contracts.CheckValue(rnd, nameof(rnd));
152Contracts.CheckParam(size > 0, nameof(size), "Reservoir size must be positive");
153Contracts.CheckValue(getter, nameof(getter));
164Contracts.Check(!_locked, "Cannot continue to sample after Lock() has been called");
195Contracts.Assert(_counts.Contains(0));
248Contracts.Check(_locked, "Call Lock() before the call to GetSample()");
Utilities\Utils.cs (106)
50Contracts.AssertValueOrNull(x);
56Contracts.AssertValueOrNull(x);
62Contracts.AssertValueOrNull(x);
68Contracts.AssertValueOrNull(x);
74Contracts.AssertValueOrNull(x);
80Contracts.AssertValueOrNull(x);
86Contracts.AssertValueOrNull(x);
92Contracts.AssertValueOrNull(x);
98Contracts.AssertValueOrNull(x);
104Contracts.AssertValueOrNull(x);
110Contracts.AssertValueOrNull(x);
116Contracts.AssertValueOrNull(x);
124Contracts.AssertValueOrNull(map);
135Contracts.AssertValueOrNull(list);
143Contracts.AssertValueOrNull(list);
151Contracts.AssertValueOrNull(set);
159Contracts.AssertValueOrNull(map);
167Contracts.AssertValueOrNull(map);
175Contracts.AssertValueOrNull(stack);
189Contracts.Assert(src != null);
190Contracts.Assert(!count.HasValue || (0 <= count && count <= src.Count));
191Contracts.Assert(src.Count <= dst.Length);
208Contracts.AssertValue(input);
220Contracts.AssertValue(input);
232Contracts.AssertValue(input);
287Contracts.AssertValue(input);
288Contracts.Assert(0 <= min && min <= lim && lim <= input.Count);
295Contracts.Assert(minCur <= mid && mid < limCur);
302Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim);
303Contracts.Assert(minCur == min || input[minCur - 1] < value);
304Contracts.Assert(limCur == lim || input[limCur] >= value);
306Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim);
307Contracts.Assert(minCur == min || input[minCur - 1] < value);
308Contracts.Assert(limCur == lim || input[limCur] >= value);
321Contracts.AssertValue(input);
322Contracts.Assert(0 <= min && min <= lim && lim <= input.Count);
323Contracts.Assert(!float.IsNaN(value));
330Contracts.Assert(minCur <= mid && mid < limCur);
331Contracts.Assert(!float.IsNaN(input[mid]));
338Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim);
339Contracts.Assert(minCur == min || input[minCur - 1] < value);
340Contracts.Assert(limCur == lim || input[limCur] >= value);
342Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim);
343Contracts.Assert(minCur == min || input[minCur - 1] < value);
344Contracts.Assert(limCur == lim || input[limCur] >= value);
357Contracts.AssertValue(input);
358Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
359Contracts.Assert(!Double.IsNaN(value));
366Contracts.Assert(minCur <= mid && mid < limCur);
367Contracts.Assert(!Double.IsNaN(input[mid]));
374Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim);
375Contracts.Assert(minCur == min || input[minCur - 1] < value);
376Contracts.Assert(limCur == lim || input[limCur] >= value);
378Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim);
379Contracts.Assert(minCur == min || input[minCur - 1] < value);
380Contracts.Assert(limCur == lim || input[limCur] >= value);
392Contracts.AssertValue(input);
393Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
400Contracts.Assert(minCur <= mid && mid < limCur);
407Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim);
408Contracts.Assert(minCur == min || !func(input[minCur - 1]));
409Contracts.Assert(limCur == lim || func(input[limCur]));
411Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim);
412Contracts.Assert(minCur == min || !func(input[minCur - 1]));
413Contracts.Assert(limCur == lim || func(input[limCur]));
425Contracts.AssertValue(input);
426Contracts.Assert(0 <= min && min <= lim && lim <= input.Length);
433Contracts.Assert(minCur <= mid && mid < limCur);
440Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim);
441Contracts.Assert(minCur == min || !func(input[minCur - 1], value));
442Contracts.Assert(limCur == lim || func(input[limCur], value));
444Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim);
445Contracts.Assert(minCur == min || !func(input[minCur - 1], value));
446Contracts.Assert(limCur == lim || func(input[limCur], value));
453Contracts.Assert(size >= 0);
463Contracts.Assert(0 <= lim && lim <= a.Length);
488Contracts.AssertValue(perm);
494Contracts.Assert(0 <= j && j < perm.Length);
495Contracts.Assert(res[j] == 0 && (j != perm[0] || i == 0));
503Contracts.AssertValue(rand);
504Contracts.Assert(size >= 0);
547Contracts.AssertValue(rand);
700Contracts.Check(values.Length >= len);
721Contracts.Assert(length >= 0, "Length can't be negative");
730Contracts.CheckParam(length >= 0, nameof(length));
744Contracts.CheckParam(length >= 0, nameof(length));
745Contracts.CheckValue(func, nameof(func));
769Contracts.CheckValue(schema, nameof(schema));
770Contracts.Check(schema.Count > 0, nameof(schema));
771Contracts.CheckValue(pred, nameof(pred));
804Contracts.CheckParam(lim >= 0, nameof(lim));
805Contracts.CheckValue(pred, nameof(pred));
839Contracts.CheckParam(lim >= 0, nameof(lim));
840Contracts.CheckValue(columnsNeeded, nameof(columnsNeeded));
848Contracts.Check(col.Index < lim);
890Contracts.Assert(nn != null || size == 0);
891Contracts.Assert((ne == null) == (size == 0));
910Contracts.Assert(ivDst == size);
951Contracts.CheckValue(bitArray, nameof(bitArray));
965throw Contracts.ExceptParam(nameof(func), "Cannot be generic on return type");
1186Contracts.CheckValue(genArg, nameof(genArg));
1187Contracts.CheckValue(func, nameof(func));
1189Contracts.CheckParam(meth.IsGenericMethod, nameof(func), "Should be generic but is not");
1190Contracts.CheckParam(meth.GetGenericArguments().Length == 1, nameof(func),
1269Contracts.CheckValue(predicate, nameof(predicate));
1282Contracts.CheckValue(predicate, nameof(predicate));
Utilities\VBufferUtils.cs (53)
69Contracts.CheckParam(length >= 0, nameof(length));
75Contracts.CheckParam(length >= 0, nameof(length));
85Contracts.CheckValue(visitor, nameof(visitor));
115Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality.");
116Contracts.CheckValue(visitor, nameof(visitor));
166Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality.");
167Contracts.CheckValue(visitor, nameof(visitor));
272Contracts.CheckValue(manip, nameof(manip));
304Contracts.CheckParam(0 <= slot && slot < dst.Length, nameof(slot));
305Contracts.CheckValue(manip, nameof(manip));
306Contracts.CheckValueOrNull(pred);
370Contracts.Assert(i <= indices[i]);
401Contracts.Check(0 <= denseCount && denseCount <= dst.Length);
423Contracts.Assert(lim < denseCount);
450Contracts.CheckParam(0 < sparsityThreshold && sparsityThreshold < 1, nameof(sparsityThreshold));
480Contracts.Assert(j < sparseCount);
487Contracts.Assert(j == sparseCount);
591Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality.");
592Contracts.CheckValue(manip, nameof(manip));
718Contracts.Assert(newCount > 0);
719Contracts.Assert(0 < srcValues.Length && srcValues.Length <= newCount);
720Contracts.Assert(0 < dstValues.Length && dstValues.Length <= newCount);
779Contracts.Assert(sIndex >= 0);
780Contracts.Assert(sIndex == dIndex);
797Contracts.Assert(srcValues.Length == dstValues.Length);
800Contracts.Assert(srcIndices[i] == dstIndices[i]);
806Contracts.Assert(newCount > srcValues.Length);
830Contracts.Assert(dstIndices[dI] == sIndex);
850Contracts.Assert(srcIndices[sI] == bIndex);
867Contracts.Assert(false);
878Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality.");
879Contracts.CheckValue(manip, nameof(manip));
894Contracts.Assert(srcValues.Length == src.Length);
904Contracts.Assert(0 < count && count < length);
938Contracts.Assert(srcValues.Length == src.Length);
947Contracts.Assert(0 < count && count < length);
988Contracts.Assert(dstCount > 0);
1032Contracts.Assert(srcValues.Length > 0);
1053Contracts.Assert(0 < resCount && resCount <= length);
1054Contracts.Assert(resCount <= srcValues.Length + dstCount);
1055Contracts.Assert(srcValues.Length <= resCount);
1056Contracts.Assert(dstCount <= resCount);
1077Contracts.Assert(i < length || j < length);
1107Contracts.Assert(ii == srcValues.Length && jj == dstCount);
1108Contracts.Assert(i == length && j == length);
1127Contracts.CheckValue(func, nameof(func));
1169Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality.");
1170Contracts.CheckValue(func, nameof(func));
1264Contracts.Assert(aIndices[aI] == bIndices[aI]);
1275Contracts.Assert(aIndices[aI] >= bIndices[bI]);
1290Contracts.Assert(bIndices[bI] >= aIndices[aI]);
1323Contracts.Assert(index == bIndices[bI]);
1353Contracts.CheckParam(0 <= length && length <= Utils.Size(src), nameof(length));