ThreeState (final @NotNull UserDefinedJsonSchemaConfiguration.Item leftItem, final @NotNull UserDefinedJsonSchemaConfiguration.Item rightItem) { if (leftItem.getPath().equals(rightItem.getPath())) return ThreeState.YES; if (leftItem.getPath().indexOf(File.separatorChar) >= 0 || rightItem.getPath().indexOf(File.separatorChar) >= 0) { // todo: better heuristic return ThreeState.NO; } final BeforeAfter<String> left = getBeforeAfterAroundWildCards(leftItem.getPath()); final BeforeAfter<String> right = getBeforeAfterAroundWildCards(rightItem.getPath()); if (left == null || right == null) { if (left == null && right == null) return leftItem.getPath().equals(rightItem.getPath()) ? ThreeState.YES : ThreeState.NO; if (left == null) { return checkOneSideWithoutWildcard(leftItem, right); } return checkOneSideWithoutWildcard(rightItem, left); } if (!StringUtil.isEmptyOrSpaces(left.getBefore()) && !StringUtil.isEmptyOrSpaces(right.getBefore())) { if (left.getBefore().startsWith(right.getBefore()) || right.getBefore().startsWith(left.getBefore())) { return ThreeState.YES; } // otherwise they are different return ThreeState.NO; } if (!StringUtil.isEmptyOrSpaces(left.getAfter()) && !StringUtil.isEmptyOrSpaces(right.getAfter())) { if (left.getAfter().endsWith(right.getAfter()) || right.getAfter().endsWith(left.getAfter())) { return ThreeState.YES; } // otherwise they are different return ThreeState.NO; } return ThreeState.UNSURE; }