MergeableElement (MergeableElement other) { MatchedValue mergedValue = new MatchedValue(value, pattern, matchingDegree, type); if (other instanceof MatchedValue otherMatchedValue) { if (otherMatchedValue.type == MatchedValueType.SEMANTIC) { mergedValue.similarityScore = otherMatchedValue.similarityScore; } } return mergedValue; }