Minor refactoring: rename MatchingRule.getAssertion() for substrings to MatchingRule.getSubstringAssertion().
| | |
| | | } |
| | | |
| | | try { |
| | | assertion = rule.getAssertion(initialSubstring, anySubstrings, finalSubstring); |
| | | assertion = rule.getSubstringAssertion(initialSubstring, anySubstrings, finalSubstring); |
| | | } catch (final DecodeException de) { |
| | | // TODO: I18N |
| | | DEFAULT_LOG.warn("The substring assertion values contain an invalid value", de); |
| | |
| | | return new DefaultEqualityAssertion(normalizeAttributeValue(schema, value)); |
| | | } |
| | | |
| | | public Assertion getAssertion(final Schema schema, final ByteSequence subInitial, |
| | | public Assertion getSubstringAssertion(final Schema schema, final ByteSequence subInitial, |
| | | final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal) |
| | | throws DecodeException { |
| | | return UNDEFINED_ASSERTION; |
| | |
| | | final String valueString = value.toString(); |
| | | |
| | | if (valueString.length() == 1 && valueString.charAt(0) == '*') { |
| | | return getAssertion(schema, initialString, anyStrings, finalString); |
| | | return getSubstringAssertion(schema, initialString, anyStrings, finalString); |
| | | } |
| | | |
| | | final char[] escapeChars = new char[] { '*' }; |
| | |
| | | } |
| | | } |
| | | |
| | | return getAssertion(schema, initialString, anyStrings, finalString); |
| | | return getSubstringAssertion(schema, initialString, anyStrings, finalString); |
| | | } |
| | | |
| | | @Override |
| | | public Assertion getAssertion(final Schema schema, final ByteSequence subInitial, |
| | | public Assertion getSubstringAssertion(final Schema schema, final ByteSequence subInitial, |
| | | final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal) |
| | | throws DecodeException { |
| | | final ByteString normInitial = |
| | |
| | | |
| | | /** |
| | | * Returns the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing matching operations on that value. |
| | | * best suited for efficiently performing matching operations on that value. |
| | | * The assertion value is guaranteed to be valid against this matching |
| | | * rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Returns the normalized form of the provided assertion substring values, |
| | | * which is best suite for efficiently performing matching operations on |
| | | * which is best suited for efficiently performing matching operations on |
| | | * that value. |
| | | * |
| | | * @param subInitial |
| | |
| | | * @throws DecodeException |
| | | * if the syntax of the value is not valid. |
| | | */ |
| | | public Assertion getAssertion(final ByteSequence subInitial, |
| | | public Assertion getSubstringAssertion(final ByteSequence subInitial, |
| | | final List<? extends ByteSequence> subAnyElements, final ByteSequence subFinal) |
| | | throws DecodeException { |
| | | return impl.getAssertion(schema, subInitial, subAnyElements, subFinal); |
| | | return impl.getSubstringAssertion(schema, subInitial, subAnyElements, subFinal); |
| | | } |
| | | |
| | | /** |
| | | * Returns the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing greater than or equal ordering |
| | | * best suited for efficiently performing greater than or equal ordering |
| | | * matching operations on that value. The assertion value is guaranteed to |
| | | * be valid against this matching rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Returns the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing greater than or equal ordering |
| | | * best suited for efficiently performing greater than or equal ordering |
| | | * matching operations on that value. The assertion value is guaranteed to |
| | | * be valid against this matching rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Returns the normalized form of the provided attribute value, which is |
| | | * best suite for efficiently performing matching operations on that value. |
| | | * best suited for efficiently performing matching operations on that value. |
| | | * |
| | | * @param value |
| | | * The attribute value to be normalized. |
| | |
| | | |
| | | /** |
| | | * Retrieves the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing matching operations on that value. |
| | | * best suited for efficiently performing matching operations on that value. |
| | | * The assertion value is guarenteed to be valid against this matching |
| | | * rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Retrieves the normalized form of the provided assertion substring values, |
| | | * which is best suite for efficiently performing matching operations on |
| | | * which is best suited for efficiently performing matching operations on |
| | | * that value. |
| | | * |
| | | * @param schema |
| | |
| | | * @throws DecodeException |
| | | * if an syntax error occured while parsing the value. |
| | | */ |
| | | public Assertion getAssertion(Schema schema, ByteSequence subInitial, |
| | | public Assertion getSubstringAssertion(Schema schema, ByteSequence subInitial, |
| | | List<? extends ByteSequence> subAnyElements, ByteSequence subFinal) |
| | | throws DecodeException; |
| | | |
| | | /** |
| | | * Retrieves the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing greater than or equal matching |
| | | * best suited for efficiently performing greater than or equal matching |
| | | * operations on that value. The assertion value is guarenteed to be valid |
| | | * against this matching rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Retrieves the normalized form of the provided assertion value, which is |
| | | * best suite for efficiently performing greater than or equal matching |
| | | * best suited for efficiently performing greater than or equal matching |
| | | * operations on that value. The assertion value is guarenteed to be valid |
| | | * against this matching rule's assertion syntax. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Retrieves the normalized form of the provided attribute value, which is |
| | | * best suite for efficiently performing matching operations on that value. |
| | | * best suited for efficiently performing matching operations on that value. |
| | | * |
| | | * @param schema |
| | | * The schema in which this matching rule is defined. |
| | |
| | | // normalize the 2 provided values and check that they are equals |
| | | final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value)); |
| | | |
| | | if (rule.getAssertion(null, null, ByteString.valueOf(finalValue)).matches(normalizedValue) != result |
| | | if (rule.getSubstringAssertion(null, null, ByteString.valueOf(finalValue)).matches(normalizedValue) != result |
| | | || rule.getAssertion(ByteString.valueOf("*" + finalValue)).matches(normalizedValue) != result) { |
| | | fail("final substring matching rule " + rule + " does not give expected result (" |
| | | + result + ") for values : " + value + " and " + finalValue); |
| | |
| | | // normalize the 2 provided values and check that they are equals |
| | | final ByteString normalizedValue = rule.normalizeAttributeValue(ByteString.valueOf(value)); |
| | | |
| | | if (rule.getAssertion(ByteString.valueOf(initial), null, null).matches(normalizedValue) != result |
| | | if (rule.getSubstringAssertion(ByteString.valueOf(initial), null, null).matches(normalizedValue) != result |
| | | || rule.getAssertion(ByteString.valueOf(initial + "*")).matches(normalizedValue) != result) { |
| | | fail("initial substring matching rule " + rule + " does not give expected result (" |
| | | + result + ") for values : " + value + " and " + initial); |
| | |
| | | for (final String middleSub : anys) { |
| | | anyList.add(ByteString.valueOf(middleSub)); |
| | | } |
| | | rule.getAssertion(subInitial == null ? null : ByteString.valueOf(subInitial), anyList, |
| | | rule.getSubstringAssertion(subInitial == null ? null : ByteString.valueOf(subInitial), anyList, |
| | | subFinal == null ? null : ByteString.valueOf(subFinal)); |
| | | } |
| | | |
| | |
| | | middleList.add(ByteString.valueOf(middleSub)); |
| | | } |
| | | |
| | | if (rule.getAssertion(null, middleList, null).matches(normalizedValue) != result |
| | | if (rule.getSubstringAssertion(null, middleList, null).matches(normalizedValue) != result |
| | | || rule.getAssertion(ByteString.valueOf(printableMiddleSubs)).matches( |
| | | normalizedValue) != result) { |
| | | fail("middle substring matching rule " + rule + " does not give expected result (" |