34 throw new ArgumentNullException(nameof(generator));
39 string specificationText,
40 string? schemeVersion =
null)
51 string specificationText,
52 IEnumerable<UniversalTemporalQualifier>
53 actualTemporalQualifiers,
54 string? schemeVersion =
null)
56 ArgumentNullException.ThrowIfNull(actualTemporalQualifiers);
63 actualTemporalQualifiers),
69 string specificationText,
71 string? schemeVersion =
null)
73 ArgumentNullException.ThrowIfNull(descriptor);
74 ArgumentNullException.ThrowIfNull(actualDerivedSemantics);
84 actualDerivedSemantics);
100 IEnumerable<UniversalTemporalQualifier>
101 actualTemporalQualifiers)
103 ArgumentNullException.ThrowIfNull(actualTemporalQualifiers);
110 actualTemporalQualifiers));
118 ArgumentNullException.ThrowIfNull(descriptor);
119 ArgumentNullException.ThrowIfNull(specification);
120 ArgumentNullException.ThrowIfNull(actualDerivedSemantics);
125 actualDerivedSemantics);
127 string generatedText =
131 new List<UniversalNotationMatchIssue>();
141 actualDerivedSemantics,
151 if (issues.Any(issue => issue.IsContradiction))
156 else if (issues.Count > 0)
165 StringComparison.Ordinal))
183 private static void MatchAlpha(
186 ICollection<UniversalNotationMatchIssue> issues)
188 MatchEnumRequirement(
194 "alpha.itemCardinality",
197 MatchEnumRequirement(
203 "alpha.problemLevel",
219 "alpha.productStructure",
222 "The descriptor does not determine the BOM topology.");
231 "alpha.productStructure",
234 "The known BOM topology contradicts the specification.");
244 private static void MatchNetwork(
245 UniversalNetworkNotation actual,
246 UniversalNetworkNotation expected,
247 ICollection<UniversalNotationMatchIssue> issues)
249 if (actual.Coupling != expected.Coupling)
254 "alpha.network.coupling",
255 expected.Coupling.ToString(),
256 actual.Coupling.ToString(),
257 "The physical-network coupling contradicts the specification.");
263 expected.ForwardTopology !=
267 actual.ForwardTopology ==
273 "alpha.network.forwardTopology",
274 expected.ForwardTopology.ToString(),
276 "The forward topology cannot currently be determined.");
279 actual.ForwardTopology !=
280 expected.ForwardTopology)
285 "alpha.network.forwardTopology",
286 expected.ForwardTopology.ToString(),
287 actual.ForwardTopology.ToString(),
288 "The known forward topology contradicts the specification.");
296 expected.ReverseTopology.HasValue &&
297 expected.ReverseTopology.Value !=
301 !actual.ReverseTopology.HasValue ||
302 actual.ReverseTopology.Value ==
308 "alpha.network.reverseTopology",
309 expected.ReverseTopology.Value.ToString(),
311 "The reverse topology cannot currently be determined.");
314 actual.ReverseTopology.Value !=
315 expected.ReverseTopology.Value)
320 "alpha.network.reverseTopology",
321 expected.ReverseTopology.Value.ToString(),
322 actual.ReverseTopology.Value.ToString(),
323 "The known reverse topology contradicts the specification.");
327 if (expected.EchelonCount.HasValue)
329 if (!actual.EchelonCount.HasValue)
331 if (actual.HasCycles)
336 "alpha.network.echelonCount",
337 expected.EchelonCount.Value.ToString(),
339 "A cyclic physical network cannot satisfy the requested acyclic echelon count.");
346 "alpha.network.echelonCount",
347 expected.EchelonCount.Value.ToString(),
349 "The descriptor does not determine an echelon count.");
353 actual.EchelonCount.Value !=
354 expected.EchelonCount.Value)
359 "alpha.network.echelonCount",
360 expected.EchelonCount.Value.ToString(),
361 actual.EchelonCount.Value.ToString(),
362 "The known echelon count contradicts the specification.");
370 "alpha.network.cycles",
375 expected.HasMultiSourcing,
376 actual.HasMultiSourcing,
378 "alpha.network.multiSourcing",
383 expected.HasTransshipment,
384 actual.HasTransshipment,
386 "alpha.network.transshipment",
391 private static void MatchBeta(
392 UniversalNotationBeta actual,
393 UniversalNotationBeta expected,
394 UniversalDerivedSemantics actualDerivedSemantics,
395 ICollection<UniversalNotationMatchIssue> issues)
399 in expected.Features)
401 if (!actual.Contains(requiredFeature))
407 requiredFeature.ToString(),
409 "A required beta feature is not present in the descriptor.");
415 in expected.TemporalQualifiers)
417 if (!actual.TryGetTemporalQualifier(
418 requiredQualifier.Parameter,
424 "beta.temporalPatterns." +
425 requiredQualifier.Parameter,
426 requiredQualifier.Pattern.ToString(),
428 "The requested temporal pattern has not been supplied " +
429 "by the descriptor/projection analysis.");
435 actualQualifier!.Pattern !=
436 requiredQualifier.Pattern)
441 "beta.temporalPatterns." +
442 requiredQualifier.Parameter,
443 requiredQualifier.Pattern.ToString(),
444 actualQualifier.Pattern.ToString(),
445 "The known temporal pattern contradicts the specification.");
451 in expected.SemanticConditions)
453 actualDerivedSemantics.TryGetConditionState(
462 "beta.semanticConditions." +
466 "The requested derived semantic condition has not been " +
467 "analyzed for this instance/projection.");
477 "beta.semanticConditions." +
481 "The analyzed semantic condition contradicts the " +
487 private static void MatchGamma(
488 UniversalNotationGamma actual,
489 UniversalNotationGamma expected,
490 ICollection<UniversalNotationMatchIssue> issues)
493 expected.Objective ==
507 expected.Objective.ToString(),
509 "The descriptor does not determine the requested objective family.");
522 expected.Objective.ToString(),
523 actual.Objective.ToString(),
524 "The known objective family contradicts the specification.");
528 private static void MatchEnumRequirement<T>(
532 string contradictionCode,
533 string incompleteCode,
535 ICollection<UniversalNotationMatchIssue> issues)
536 where T :
struct, Enum
538 if (EqualityComparer<T>.Default.Equals(expected, unknown))
543 if (EqualityComparer<T>.Default.Equals(actual, unknown))
551 "The descriptor does not determine this requested characteristic.");
556 if (!EqualityComparer<T>.Default.Equals(actual, expected))
564 "The known descriptor characteristic contradicts the specification.");
568 private static void RequirePositiveFlag(
574 ICollection<UniversalNotationMatchIssue> issues)
576 if (expected && !actual)
584 $
"The specification explicitly requires network modifier {token}.");
588 private static void AddContradiction(
589 ICollection<UniversalNotationMatchIssue> issues,
597 new UniversalNotationMatchIssue(
603 isContradiction:
true));
606 private static void AddIncomplete(
607 ICollection<UniversalNotationMatchIssue> issues,
615 new UniversalNotationMatchIssue(
621 isContradiction:
false));