public static double DistanceBase(ElementDefinition.BaseComponent base1, ElementDefinition.BaseComponent base2, double weight) { double distance = 0; if (base1 == null && base2 == null) { return(0); } if ((base1 == null && base2 != null) || (base2 == null && base1 != null)) { Program.LogAspectDifference(weight, "Base"); return(weight); } if (base1.Path != base2.Path) { distance += AspectWeights.WEIGHT_BASE_PATH; Program.LogAspectDifference((weight * distance), "Base"); return(weight * distance); } if (base1.Min != base2.Min) { distance += AspectWeights.WEIGHT_BASE_MIN; } if (base1.Max != base2.Max) { distance += AspectWeights.WEIGHT_BASE_MAX; } Program.LogAspectDifference((weight * distance), "Base"); return(weight * distance); }
static ElementDefinition.BaseComponent createBaseComponent(FhirString maxElement, Integer minElement, FhirString pathElement) { var result = new ElementDefinition.BaseComponent() { MaxElement = (FhirString)maxElement?.DeepCopy(), MinElement = (Integer)minElement?.DeepCopy(), PathElement = (FhirString)pathElement?.DeepCopy() }; result.SetCreatedBySnapshotGenerator(); return(result); }