[jboss-cvs] JBossAS SVN: r75821 - in projects/aop/branches/joinpoint_graph/aop/src: main/org/jboss/aop/joinpoint/graph/tree/insertion and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 15 00:51:09 EDT 2008
Author: flavia.rainone at jboss.com
Date: 2008-07-15 00:51:09 -0400 (Tue, 15 Jul 2008)
New Revision: 75821
Modified:
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/KeyPart.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Tree.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKey.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/SearchKey.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElement.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactory.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Comparable.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparableFactory.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithm.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndState.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartState.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Matcher.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactory.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherProfile.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingState.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPart.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/KeyPartTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/TreeInsertionTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKeyTestCase.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/SearchKeyTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactoryTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithmTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndStateTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartStateTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/LengthRestrictionTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactoryTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingStateTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactoryTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPatternTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPrefixTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartSimpleTest.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartTest.java
Log:
[JBAOP-503] Extended the tree to allow configuration of the element separator.
Fixed a bug found on matching state.
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/KeyPart.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/KeyPart.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/KeyPart.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -52,7 +52,7 @@
* first element is an empty string and to identify <code>
* EMPTY_KEY_END</code>.
*/
- public static final char KEY_ELEMENT_END = '#';
+ public static final char KEY_ELEMENT_END = '%';
/** Contains elements of a key. */
private String[] keyElements;
@@ -85,18 +85,18 @@
* TODO (new: nor even should it
* be an empty string? right?)
*/
- public KeyPart(String keyPartExpression)
+ public KeyPart(String keyPartExpression, char separator)
{
// splits the key into keyElements
Collection<String> keyElements = new ArrayList<String>();
// split element
int begin = 0;
- int end = keyPartExpression.indexOf('.');
+ int end = keyPartExpression.indexOf(separator);
while(end >= 0)
{
keyElements.add(keyPartExpression.substring(begin, end));
begin = end + 1;
- end = keyPartExpression.indexOf('.', begin + 1);
+ end = keyPartExpression.indexOf(separator, begin + 1);
}
if (begin >= 0)
{
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Tree.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Tree.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Tree.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -39,6 +39,11 @@
public class Tree<E>
{
/**
+ * Separator char that splits the keys into elements.
+ */
+ private char separator;
+
+ /**
* Root of the tree.
*/
private Node<E> root;
@@ -50,14 +55,27 @@
/**
* Constructs an empty tree.
+ *
+ * @param separator the character that will be used to split the keys into
+ * elements. This character must be chosen in a way that improves
+ * performance of the tree.
*/
- public Tree()
+ public Tree(char separator)
{
this.root = null;
this.state = new EmptyState();
+ this.separator = separator;
}
/**
+ * Constructs an empty tree, with default separator {@code '.'}.
+ */
+ public Tree()
+ {
+ this('.');
+ }
+
+ /**
* Inserts <code>value</code> in the tree. This value is uniquely identified
* by <code>key</code>, that can contain one or more valid Java names
* separated by the <code>'.'</code> character. If a value was already
@@ -69,7 +87,7 @@
*/
public void insert(String key, E value)
{
- InsertionKey insertionKey = new InsertionKey(key);
+ InsertionKey insertionKey = new InsertionKey(key, separator);
state.insert(insertionKey, value);
}
@@ -85,7 +103,7 @@
*/
public void search(String searchKeyExpression, Collection<? super E> result)
{
- SearchKey searchKey = new SearchKey(searchKeyExpression);
+ SearchKey searchKey = new SearchKey(searchKeyExpression, separator);
state.search(searchKey, result);
}
@@ -101,7 +119,7 @@
*/
public Collection<E> search(String searchKeyExpression)
{
- SearchKey searchKey = new SearchKey(searchKeyExpression);
+ SearchKey searchKey = new SearchKey(searchKeyExpression, separator);
return state.search(searchKey);
}
@@ -123,7 +141,7 @@
*/
public E searchValue(String searchKey)
{
- return state.searchElement(new SearchKey(searchKey));
+ return state.searchElement(new SearchKey(searchKey, separator));
}
/**
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKey.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKey.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -62,14 +62,21 @@
private boolean endRead = false;
/**
+ * Used to split the insertion key into elements.
+ */
+ private char separator;
+
+ /**
* Constructor.
*
- * @param key the key to be inserted in the tree.
+ * @param key the key to be inserted in the tree
+ * @param separator character that splits the key into elements
*/
- public InsertionKey(String key)
+ public InsertionKey(String key, char separator)
{
this.key = key;
this.keyIndex = 0;
+ this.separator = separator;
}
/**
@@ -114,10 +121,10 @@
}
keyIndex ++;
}
- // look for the '.' that separates the elements from one another
+ // look for the separator char that separates the elements from one another
if (keyIndex < key.length())
{
- if (key.charAt(keyIndex) != '.')
+ if (key.charAt(keyIndex) != separator)
{
break;
}
@@ -146,7 +153,7 @@
if (!keyPart.isLastElementComplete())
{
// the last element wasn't complete, so...
- // ... the '.' found on the end of the loop needs to be reconsidered
+ // ... the char separator found on the end of the loop needs to be reconsidered
keyIndex--;
// ... or the end read needs to be reconsidered
endRead = false;
@@ -175,7 +182,7 @@
return KeyPart.KEY_ELEMENT_END;
}
char nextChar = key.charAt(keyIndex);
- if (nextChar == '.')
+ if (nextChar == separator)
{
return KeyPart.KEY_ELEMENT_END;
}
@@ -197,6 +204,6 @@
{
return KeyPart.EMPTY_KEY_END;
}
- return new KeyPart(key.substring(keyIndex));
+ return new KeyPart(key.substring(keyIndex), separator);
}
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/SearchKey.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/SearchKey.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/SearchKey.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -77,15 +77,17 @@
/**
* Constructor.
*
- * @param searchExpression a search element. This element is allowed to
- * contain wildcards (<code>'*'</code>) besides any
- * character contained in a valid java class name.
+ * @param searchExpression a search element. This element is allowed to
+ * contain wildcards (<code>'*'</code>) besides any
+ * character contained in a valid java class name.
+ * @param internalSeparator separator character used to break key parts into
+ * elements
*/
- public SearchKey (String searchExpression)
+ public SearchKey (String searchExpression, char internalSeparator)
{
ComparableKeyPartFactory factory = ComparableKeyPartFactory.getInstance();
this.partMatchers = MatcherFactory.createSequence(searchExpression,
- factory, factory.getMatcherSequenceProfile());
+ factory, factory.getMatcherSequenceProfile(), internalSeparator);
index = 0;
comparableIndex = new KeyPartIndex();
targetIndex = new KeyPartIndex();
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElement.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElement.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElement.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -22,7 +22,6 @@
package org.jboss.aop.joinpoint.graph.tree.search.element;
import org.jboss.aop.joinpoint.graph.tree.KeyPart;
-import org.jboss.aop.joinpoint.graph.tree.search.Flags;
import org.jboss.aop.joinpoint.graph.tree.search.common.PrefixFunctionLoader;
import org.jboss.aop.joinpoint.graph.tree.search.match.Comparable;
import org.jboss.aop.joinpoint.graph.tree.search.match.ComparisonResult;
@@ -73,14 +72,15 @@
return expression.length();
}
+ public final boolean isEmpty()
+ {
+ return expression.length() == 0;
+ }
+
public char getNextCharacter(Index comparableIndex, Object comparisonState)
{
- if (expression.length() == 0)
+ if (comparableIndex.getValue() >= expression.length() || expression.length() == 0)
{
- return Flags.ALL;
- }
- if (comparableIndex.getValue() >= expression.length())
- {
return KeyPart.KEY_ELEMENT_END;
}
return expression.charAt(comparableIndex.getValue());
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactory.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactory.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -21,6 +21,9 @@
*/
package org.jboss.aop.joinpoint.graph.tree.search.element;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jboss.aop.joinpoint.graph.tree.search.common.PrefixFunctionLoader;
import org.jboss.aop.joinpoint.graph.tree.search.match.Comparable;
import org.jboss.aop.joinpoint.graph.tree.search.match.ComparableFactory;
@@ -39,16 +42,30 @@
/**
* Singleton instance.
*/
- private static final ComparableElementFactory instance =
- new ComparableElementFactory();
+ private static final Map<Character, ComparableElementFactory> instanceMap =
+ new HashMap<Character,ComparableElementFactory>();
/**
- * Returns the singleton factory instance.
+ * Separator used on the creation of elements.
+ */
+ private char separator;
+
+ /**
+ * Returns the singleton factory instance that uses {@code separator}.
*
+ * @param separator the character used by the factory to break a comparable
+ * expression into elements
* @return the singleton factory instance
*/
- public static final ComparableElementFactory getInstance()
+ public static final ComparableElementFactory getInstance(char separator)
{
+ Character key = Character.valueOf(separator);
+ if (instanceMap.containsKey(key))
+ {
+ return instanceMap.get(key);
+ }
+ ComparableElementFactory instance = new ComparableElementFactory(separator);
+ instanceMap.put(key, instance);
return instance;
}
@@ -68,8 +85,9 @@
/**
* Private constructor (singleton class).
*/
- private ComparableElementFactory()
+ private ComparableElementFactory(char separator)
{
+ this.separator = separator;
this.profiles =
new MatcherSequenceProfile[MatcherProfile.getNumberOfInstances()];
// sequence for simple part
@@ -114,7 +132,7 @@
public char getSeparator()
{
- return '.';
+ return this.separator;
}
/**
@@ -137,8 +155,12 @@
loader.loaded();
}
+ /**
+ * The absence of {@code internalSeparator} is mandatory, as this factory does not
+ * create nested comparables.
+ */
public Comparable create(String comparableExpression,
- MatcherProfile matcherProfile)
+ MatcherProfile matcherProfile, char... internalSeparator)
{
return new ComparableElement(comparableExpression, loader);
}
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Comparable.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Comparable.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Comparable.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -42,6 +42,14 @@
int getPostPrefixLength();
/**
+ * Indicates whether this comparable is completely empty, having nothing
+ * to compare.
+ *
+ * @return {@code true} if this comparable is competely empty
+ */
+ boolean isEmpty();
+
+ /**
* Returns the character that identifies the next comparable component that
* will be compared.
*
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparableFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparableFactory.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparableFactory.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -64,9 +64,13 @@
* method.
* @param matcherProfile the profile of the matcher that will be
* associated with the comparable to be created
+ * @param internalSeparator optional parameter, to be used by factories of
+ * nested comparables only. The requirement for
+ * an internal separator, and the amount of separators
+ * need is to be specified by the implementor.
* @return the created comparable, able of comparing <code>
* comparableExpression</code> against a target.
*/
Comparable create(String comparableExpression,
- MatcherProfile matcherProfile);
+ MatcherProfile matcherProfile, char... internalSeparator);
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithm.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithm.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithm.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -64,14 +64,14 @@
MatchingState matchingState)
{
return comparable.getNextCharacter(comparableIndex, target,
- targetLengthRange, matchingState.comparisonState);
+ targetLengthRange, matchingState.getComparisonState());
}
public char getNextCharacter(Comparable comparable, Index comparableIndex,
MatchingState matchingState)
{
return comparable.getNextCharacter(comparableIndex,
- matchingState.comparisonState);
+ matchingState.getComparisonState());
}
};
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndState.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndState.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndState.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -49,7 +49,7 @@
if ((targetPostPrefixMaxLength - targetIndex.getValue()) <=
(comparable.getPostPrefixLength() - comparableIndex.getValue()))
{
- state.comparisonEndState= TIGHT;
+ state.tightComparisonEndState();
}
}
@@ -79,9 +79,9 @@
if (targetLengthRange.getSuffixMaxLength() <=
(comparable.getPostPrefixLength() - comparableIndex.getValue()))
{
- state.comparisonEndState = TIGHT;
+ state.tightComparisonEndState();
return comparable.getNextCharacter(comparableIndex, target,
- targetLengthRange, state.comparisonState);
+ targetLengthRange, state.getComparisonState());
}
return Flags.ALL;
}
@@ -115,14 +115,14 @@
LengthRange targetLengthRange)
{
return comparable.getNextCharacter(comparableIndex, target,
- targetLengthRange, state.comparisonState);
+ targetLengthRange, state.getComparisonState());
}
public char getNextCharacter(MatchingState state, Comparable comparable,
Index comparableIndex)
{
return comparable.getNextCharacter(comparableIndex,
- state.comparisonState);
+ state.getComparisonState());
}
};
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartState.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartState.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartState.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -47,14 +47,13 @@
}
if (targetIndex.getValue() > targetLengthRange.getLength())
{
- state.comparisonStartState = ComparisonStartState.NEXT_SUFFIXES;
+ state.setComparisonStartState(ComparisonStartState.NEXT_SUFFIXES);
}
else if (targetIndex.getValue() == targetLengthRange.getLength() &&
targetIndex.getValue() ==
targetLengthRange.getPostPrefix_SuffixDiff())
{
- state.comparisonStartState =
- ComparisonStartState.NEXT_SUFFIX_FIRST_COMPONENT;
+ state.setComparisonStartState(ComparisonStartState.NEXT_SUFFIX_FIRST_COMPONENT);
}
else
{
@@ -66,14 +65,14 @@
public char getNextCharacter(MatchingState state, Comparable comparable,
Index comparableIndex, Object target, LengthRange targetLengthRange)
{
- return state.comparisonEndState.getNextCharacter(state, comparable,
+ return state.getComparisonEndState().getNextCharacter(state, comparable,
comparableIndex, target, targetLengthRange);
}
public char getNextCharacter(MatchingState state, Comparable comparable,
Index comparableIndex)
{
- return state.comparisonEndState.getNextCharacter(state, comparable,
+ return state.getComparisonEndState().getNextCharacter(state, comparable,
comparableIndex);
}
@@ -96,27 +95,27 @@
if (targetLengthRange.getPostPrefixMaxLength() == 0 ||
targetIndex.getValue() < targetLengthRange.getLength())
{
- state.comparisonStartState = ComparisonStartState.CURRENT_TARGET;
+ state.setComparisonStartState(ComparisonStartState.CURRENT_TARGET);
targetIndex.comparisonReady();
}
else if (targetIndex.getValue() !=
targetLengthRange.getPostPrefix_SuffixDiff())
{
- state.comparisonStartState = ComparisonStartState.NEXT_SUFFIXES;
+ state.setComparisonStartState(ComparisonStartState.NEXT_SUFFIXES);
}
}
public char getNextCharacter(MatchingState state, Comparable comparable,
Index comparableIndex, Object target, LengthRange targetLengthRange)
{
- return state.comparisonEndState.getNextCharacter(state, comparable,
+ return state.getComparisonEndState().getNextCharacter(state, comparable,
comparableIndex, target, targetLengthRange);
}
public char getNextCharacter(MatchingState state, Comparable comparable,
Index comparableIndex)
{
- return state.comparisonEndState.getNextCharacter(state, comparable,
+ return state.getComparisonEndState().getNextCharacter(state, comparable,
comparableIndex);
}
@@ -139,14 +138,13 @@
if (targetLengthRange.getPostPrefixMaxLength() == 0 ||
targetIndex.getValue() < targetLengthRange.getLength())
{
- state.comparisonStartState = ComparisonStartState.CURRENT_TARGET;
+ state.setComparisonStartState(ComparisonStartState.CURRENT_TARGET);
targetIndex.comparisonReady();
}
else if (targetIndex.getValue() ==
targetLengthRange.getPostPrefix_SuffixDiff())
{
- state.comparisonStartState =
- ComparisonStartState.NEXT_SUFFIX_FIRST_COMPONENT;
+ state.setComparisonStartState(ComparisonStartState.NEXT_SUFFIX_FIRST_COMPONENT);
}
}
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Matcher.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Matcher.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Matcher.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -107,7 +107,7 @@
}
ComparisonResult result = profile.algorithm.execute(comparable,
comparableIndex, target, targetIndex, targetLength,
- profile.restriction, state.comparisonState);
+ profile.restriction, state.getComparisonState());
return profile.resultMap[result.getId()];
}
@@ -167,7 +167,7 @@
}
ComparisonResult result = profile.algorithm.execute(comparable,
comparableIndex, target, targetIndex, targetLengthRange,
- profile.restriction, state.comparisonState);
+ profile.restriction, state.getComparisonState());
return profile.resultMap[result.getId()];
}
@@ -193,7 +193,7 @@
public char getNextCharacter(Index comparableIndex, Object target,
LengthRange targetLengthRange, MatchingState state)
{
- return profile.algorithm.getNextCharacter(comparable, comparableIndex,
+ return profile.getNextCharacter(comparable, comparableIndex,
target, targetLengthRange, state);
}
@@ -215,10 +215,20 @@
*/
public char getNextCharacter(Index comparableIndex, MatchingState state)
{
- return profile.algorithm.getNextCharacter(comparable, comparableIndex,
+ return profile.getNextCharacter(comparable, comparableIndex,
state);
}
+ /**
+ * Returns the comparable expression to be matched.
+ *
+ * @return the comparable expression to be matched
+ */
+ public Comparable getComparable()
+ {
+ return this.comparable;
+ }
+
public String toString()
{
return "MATCHER[" + profile + ", " + comparable + "]";
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactory.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactory.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -53,6 +53,9 @@
* found in the element.
* @param profile defines the profile of each matcher in the
* sequence
+ * @param internalSeparator optional parameter, to be passed to {@code
+ * comparableFactory} during the creation of comparable
+ * elements
* @return a sequence of matchers that can match <code>
* matchableExpresion</code> against a complete target
* @see ComparableFactory
@@ -60,7 +63,7 @@
*/
public static final Matcher[] createSequence(String matchableExpression,
ComparableFactory comparableFactory,
- MatcherSequenceProfile profile)
+ MatcherSequenceProfile profile, char... internalSeparator)
{
Collection<Matcher> matchers = new ArrayList<Matcher>();
char separator = comparableFactory.getSeparator();
@@ -74,7 +77,7 @@
{
// create unique matcher
comparable = comparableFactory.create(matchableExpression,
- profile.uniqueMatcherProfile);
+ profile.uniqueMatcherProfile, internalSeparator);
matchers.add(new Matcher(profile.uniqueMatcherProfile, comparable));
}
else
@@ -95,7 +98,7 @@
// create first matcher
expression = matchableExpression.substring(begin, end);
comparable = comparableFactory.create(expression,
- profile.firstMatcherProfile);
+ profile.firstMatcherProfile, internalSeparator);
matchers.add(new Matcher(profile.firstMatcherProfile, comparable));
begin = end + 1;
end = matchableExpression.indexOf(separator, begin);
@@ -107,15 +110,20 @@
{
begin = end + 1;
end = matchableExpression.indexOf(separator, begin);
+ if (end == -1)
+ {
+ suffixMatcherProfile = profile.doubleSeparatorMatcherProfile;
+ break;
+ }
expression = matchableExpression.substring(begin, end);
currentProfile = profile.doubleSeparatorMatcherProfile;
- comparable = comparableFactory.create(expression, currentProfile);
+ comparable = comparableFactory.create(expression, currentProfile, internalSeparator);
}
else
{
expression = matchableExpression.substring(begin, end);
currentProfile = profile.middleMatchersProfile;
- comparable = comparableFactory.create(expression, currentProfile);
+ comparable = comparableFactory.create(expression, currentProfile, internalSeparator);
}
matchers.add(new Matcher(currentProfile, comparable));
begin = end + 1;
@@ -123,7 +131,8 @@
}
// create last matcher
expression = matchableExpression.substring(begin);
- comparable = comparableFactory.create(expression, suffixMatcherProfile);
+ comparable = comparableFactory.create(expression, suffixMatcherProfile,
+ internalSeparator);
matchers.add(new Matcher(suffixMatcherProfile, comparable));
}
// invoke factory notification method
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherProfile.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherProfile.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherProfile.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -21,6 +21,9 @@
*/
package org.jboss.aop.joinpoint.graph.tree.search.match;
+import org.jboss.aop.joinpoint.graph.tree.KeyPart;
+import org.jboss.aop.joinpoint.graph.tree.search.Flags;
+
/**
* Represents a property that must hold between the complete target and the
* comparable, so that the matching process ends with a positive result.
@@ -50,7 +53,7 @@
simpleMap[ComparisonResult.BOTH_ENDS.getId()] =
MatchingResult.POSITIVE_MATCH;
SIMPLE = new MatcherProfile("Simple Profile", ComparisonStart.LOOSE,
- LengthRestriction.EQUAL, ComparisonAlgorithm.SIMPLE, simpleMap);
+ LengthRestriction.EQUAL, ComparisonAlgorithm.SIMPLE, simpleMap, true);
// PREFIX profile creation
MatchingResult[] prefixMap =
@@ -65,17 +68,17 @@
MatchingResult.POSITIVE_MATCH;
PREFIX = new MatcherProfile("Prefix Profile", ComparisonStart.LOOSE,
LengthRestriction.LESS_OR_EQUAL, ComparisonAlgorithm.SIMPLE,
- prefixMap);
+ prefixMap, false);
// PATTERN profile creation
PATTERN = new MatcherProfile("Pattern Profile", ComparisonStart.LOOSE,
LengthRestriction.LESS_OR_EQUAL, ComparisonAlgorithm.KMP,
- prefixMap); // same map as PREFIX
+ prefixMap, false); // same map as PREFIX
// SUFFIX profile creation
SUFFIX = new MatcherProfile("Suffix Profile", ComparisonStart.TIGHT,
LengthRestriction.LESS_OR_EQUAL, ComparisonAlgorithm.KMP,
- simpleMap); // same map as SIMPLE
+ simpleMap, true); // same map as SIMPLE
}
/**
@@ -153,6 +156,12 @@
MatchingResult[] resultMap;
/**
+ * Indicates whether an end flag character on an empty comparable is to be
+ * accepted.
+ */
+ boolean acceptEnd;
+
+ /**
* Constructor.
*
* @param comparisonStart defines how the indexes should be tuned for
@@ -164,16 +173,20 @@
* should be used in the matching process
* @param resultMap maps a <code>ComparisonResult</code> to a <code>
* MatchingResult</code>
+ * @param acceptEnd boolean indicating whether an empty comparable is
+ * allowed indicate {@link KeyPart#KEY_ELEMENT_END} as the
+ * next char.
*/
private MatcherProfile(String description, ComparisonStart comparisonStart,
LengthRestriction restriction, ComparisonAlgorithm algorithm,
- MatchingResult[] resultMap)
+ MatchingResult[] resultMap, boolean acceptEnd)
{
this.description = description;
this.comparisonStart = comparisonStart;
this.restriction = restriction;
this.algorithm = algorithm;
this.resultMap = resultMap;
+ this.acceptEnd = acceptEnd;
this.id = ID_COUNTER++;
}
@@ -195,4 +208,63 @@
{
return this.description;
}
+
+ /**
+ * Returns the character that identifies the next target to be compared by
+ * this profile's algorithm with a successful result. If a target not identified
+ * by this character is compared, the result will be certainly <code>
+ * ComparisonResult.MISMATCH_FOUND</code>.
+ * <p>
+ * Is invoked when the <code>target</code> and its length range are known.
+ *
+ * @param comparable object that will perform the next comparison
+ * @param comparableIndex indicates from which <code>comparable</code>
+ * component the comparison will start
+ * @param target the target of the last algorithm execution
+ * (with a <code>ComparisonResult.TARGET_END</code>
+ * or <code>ComparisonResult.BOTH_ENDS</code>
+ * result)
+ * @param targetLengthRange the length range of <code>target</code>
+ * @param matchingState the state of the matching process
+ * @return the character that identifies the next target to be compared by
+ * this algorithm with a successful result. May be <code>Flags.ALL
+ * </code> to indicate that any target may have a successful result.
+ */
+ public char getNextCharacter(Comparable comparable, Index comparableIndex,
+ Object target, LengthRange targetLengthRange,
+ MatchingState matchingState)
+ {
+ if (!acceptEnd && comparable.isEmpty())
+ {
+ return Flags.ALL;
+ }
+ return algorithm.getNextCharacter(comparable, comparableIndex, target,
+ targetLengthRange, matchingState);
+ }
+
+ /**
+ * Returns the character that identifies the next target to be compared by
+ * this profile's algorithm with a successful result. If a target not identified
+ * by this character is compared, the result will be certainly <code>
+ * ComparisonResult.MISMATCH_FOUND</code>.
+ * <p>
+ * Is invoked when the last compared target and its length range are unknown.
+ *
+ * @param comparable object that will perform the next comparison
+ * @param comparableIndex indicates from which <code>comparable</code>
+ * component the comparison will start
+ * @param matchingState the state of the matching process
+ * @return the character that identifies the next target to be compared by
+ * this algorithm with a successful result. May be <code>Flags.ALL
+ * </code> to indicate that any target may have a successful result.
+ */
+ public char getNextCharacter(Comparable comparable,
+ Index comparableIndex, MatchingState matchingState)
+ {
+ if (!acceptEnd && comparable.isEmpty())
+ {
+ return Flags.ALL;
+ }
+ return algorithm.getNextCharacter(comparable, comparableIndex, matchingState);
+ }
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingState.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingState.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingState.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -51,21 +51,21 @@
/**
* The comparison state, stores data relevant to comparables.
*/
- State comparisonState;
+ private State comparisonState;
/**
* Indicates whether the comparison is scheduled to start in the current
* target, in a target suffix, or in the firt component of the next target
* suffix.
*/
- ComparisonStartState comparisonStartState;
+ private ComparisonStartState comparisonStartState;
/**
* Indicates whether the comparison, in case the match outcomes a positive
* result, will finish exactly in the end of the longer complete target
* (tight comparison) or not (loose comparison).
*/
- ComparisonEndState comparisonEndState;
+ private ComparisonEndState comparisonEndState;
/**
* Saved comparison state, is the backup of {@link #comparisonState}.
@@ -73,7 +73,7 @@
* Is assigned by the {@link #copy} method and read by the {@link
* #rollback()} method.
*/
- State savedComparisonState;
+ private State savedComparisonState;
/**
* Saved comparison start state, is the backup of {@link
@@ -82,7 +82,7 @@
* Is assigned by the {@link #copy} method and read by the {@link
* #rollback()} method.
*/
- ComparisonStartState savedComparisonStartState;
+ private ComparisonStartState savedComparisonStartState;
/**
* Saved comparison end state, is the backup of {@link #comparisonEndState}.
@@ -90,7 +90,7 @@
* Is assigned by the {@link #copy} method and read by the {@link
* #rollback()} method.
*/
- ComparisonEndState savedComparisonEndState;
+ private ComparisonEndState savedComparisonEndState;
/**
@@ -136,8 +136,51 @@
comparisonEndState = ComparisonEndState.LOOSE;
this.comparisonState.reset();
}
+
+ /**
+ * Returns the comparison state, object responsible for storing data relevant to
+ * comparables.
+ *
+ * @return the comparison state
+ */
+ public final State getComparisonState()
+ {
+ return this.comparisonState;
+ }
/**
+ * Returns the comparison end state. This object indicates whether the comparison,
+ * in case the match outcomes a positive result, will finish exactly in the end
+ * of the longer complete target (tight comparison) or not (loose comparison).
+ *
+ * @return the comparison end state (tight or loose)
+ */
+ public ComparisonEndState getComparisonEndState()
+ {
+ return this.comparisonEndState;
+ }
+
+ /**
+ * Defines the comparison end state as being {@code ComparisonEndState#TIGHT}.
+ */
+ public void tightComparisonEndState()
+ {
+ this.comparisonEndState = ComparisonEndState.TIGHT;
+ this.comparisonState.reset();
+ }
+
+ /**
+ * Defines the comparison start state as being {@code startState}.
+ *
+ * @param startState the new comparison start state
+ */
+ public void setComparisonStartState(ComparisonStartState startState)
+ {
+ this.comparisonStartState = startState;
+ this.comparisonState.reset();
+ }
+
+ /**
* Saves the data contained in this state and in the comparison state
* associated with it, if there is one.
*
@@ -236,9 +279,14 @@
this.comparisonEndState.update(this, comparable, comparableIndex,
targetLengthRange.getPostPrefixMaxLength(), targetIndex);
// tightens comparison
+ int value = targetIndex.getValue();
this.comparisonEndState.tightenComparison(this, comparable,
comparableIndex, targetLengthRange.getPostPrefixMinLength(),
targetIndex);
+ if (value != targetIndex.getValue())
+ {
+ this.comparisonState.reset();
+ }
this.comparisonStartState.update(this, targetIndex, targetLengthRange);
return this.comparisonStartState.isComparisonPostponed();
}
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPart.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPart.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPart.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -76,11 +76,14 @@
* <code>ComparableKeyPart</code> to be created
* @param matcherProfile the profile of the matcher that will contain the
* <code>ComparableKeyPart</code> to be created
+ * @param separator the separator char to be used to break the key
+ * part into elements
*/
- ComparableKeyPart(String keyPartExpression, MatcherProfile matcherProfile)
+ ComparableKeyPart(String keyPartExpression, MatcherProfile matcherProfile,
+ char separator)
{
// creates element matchers
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance(separator);
MatcherSequenceProfile seqProfile = factory.performCreationForProfile(
matcherProfile);
elementMatchers = MatcherFactory.createSequence(keyPartExpression,
@@ -120,6 +123,12 @@
return this.elementMatchers.length;
}
+ public boolean isEmpty()
+ {
+ return this.getLength() == 0 || (this.getLength() == 1 &&
+ this.elementMatchers[0].getComparable().isEmpty());
+ }
+
public int getPostPrefixLength()
{
return this.postPrefixLength;
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -96,12 +96,16 @@
parts.clear();
}
+ /**
+ * The presence of a single separator is mandatory. This separator will be used
+ * to split the created key part into elements.
+ */
public Comparable create(String comparableExpression,
- MatcherProfile matcherProfile)
+ MatcherProfile matcherProfile, char... separator)
{
// creates instance
ComparableKeyPart part = new ComparableKeyPart(
- comparableExpression, matcherProfile);
+ comparableExpression, matcherProfile, separator[0]);
// updates post-prefix information of previously created instances
for (Iterator i = parts.iterator(); i.hasNext(); )
{
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/KeyPartTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/KeyPartTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/KeyPartTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -41,34 +41,34 @@
public void testOneElementKeyPart()
{
- KeyPart keyPart = new KeyPart("oneElement");
+ KeyPart keyPart = new KeyPart("oneElement", '.');
Util.assertKeyPart(keyPart, 'o', new String[] {"oneElement"});
}
public void testTwoElementsKeyPart()
{
- KeyPart keyPart = new KeyPart("two.Elements");
+ KeyPart keyPart = new KeyPart("two.Elements", '.');
Util.assertKeyPart(keyPart, 't',
new String[] {"two", "Elements"});
}
public void testElementsKeyPart()
{
- KeyPart keyPart = new KeyPart("a.lot.of.Elements");
+ KeyPart keyPart = new KeyPart("a.lot.of.Elements", '.');
Util.assertKeyPart(keyPart, 'a', new
String[]{"a", "lot", "of", "Elements"});
}
public void testFirstEmptyKeyPart()
{
- KeyPart keyPart = new KeyPart(".element");
+ KeyPart keyPart = new KeyPart(".element", '.');
Util.assertKeyPart(keyPart, KeyPart.KEY_ELEMENT_END, new
String[] {"", "element"});
}
public void testExtractPrefix1()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(3, 1);
@@ -79,7 +79,7 @@
public void testExtractPrefix2()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(2, 0);
@@ -90,7 +90,7 @@
public void testExtractPrefix3()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(0, 4);
@@ -106,7 +106,7 @@
public void testExtractPrefix4()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix1 = keyPart.extractPrefixPart(3, 2);
@@ -120,7 +120,7 @@
public void testExtractPrefix5()
{
- KeyPart keyPart = new KeyPart("element");
+ KeyPart keyPart = new KeyPart("element", '.');
Util.assertKeyPart(keyPart, 'e', new String[] {"element"});
KeyPart prefix = keyPart.extractPrefixPart(0, 0);
Util.assertKeyPart(prefix, KeyPart.KEY_ELEMENT_END, new String[] {""},
@@ -129,7 +129,7 @@
public void testExtractPrefix6()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(0, 0);
@@ -139,9 +139,9 @@
public void testNewSuffix1()
{
- KeyPart keyPart = new KeyPart("element");
+ KeyPart keyPart = new KeyPart("element", '.');
Util.assertKeyPart(keyPart, 'e', new String[] {"element"});
- KeyPart keyPartSuffix = new KeyPart("suffix");
+ KeyPart keyPartSuffix = new KeyPart("suffix", '.');
keyPart.newSuffix(keyPartSuffix);
LengthRange lengthRange = keyPart.getLengthRange();
assertEquals(1, lengthRange.getLength());
@@ -151,7 +151,7 @@
public void testNewSuffix2()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(2, 0);
@@ -160,19 +160,19 @@
Util.assertKeyPart(prefix, 'l', new String[]{"lots", "of"},
5, 5);
// add an equal length suffix
- prefix.newSuffix(new KeyPart("a.new.suffix"));
+ prefix.newSuffix(new KeyPart("a.new.suffix", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 2, 5, 5);
// add a shorter suffix
- prefix.newSuffix(new KeyPart("shortSuffix"));
+ prefix.newSuffix(new KeyPart("shortSuffix", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 2, 3, 5);
// add a longer suffix
- prefix.newSuffix(new KeyPart("a.new.suffix.longer.than.I.thought"));
+ prefix.newSuffix(new KeyPart("a.new.suffix.longer.than.I.thought", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 2, 3, 9);
}
public void testNewSuffix3()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(0, 3);
@@ -180,19 +180,19 @@
new String[]{"s", "of", "element", "key", "part"});
Util.assertKeyPart(prefix, 'l', new String[]{"lot"}, 5, 5, 4, 4);
// add an equal length element suffix
- prefix.newSuffix(new KeyPart("a.new.suffix"));
+ prefix.newSuffix(new KeyPart("a.new.suffix", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 1, 3, 5, 3, 4, 4);
// add a longer element suffix
- prefix.newSuffix(new KeyPart("shortSuffix"));
+ prefix.newSuffix(new KeyPart("shortSuffix", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 1, 1, 5, 3, 4, 14);
// add a shorter element suffix
- prefix.newSuffix(new KeyPart(".new.suffix.longer.than.I.thought"));
+ prefix.newSuffix(new KeyPart(".new.suffix.longer.than.I.thought", '.'));
Util.assertLengthRange(prefix.getLengthRange(), 1, 1, 7, 3, 3, 14);
}
public void testNewSuffix4()
{
- KeyPart keyPart = new KeyPart("lots.of.element.key.part");
+ KeyPart keyPart = new KeyPart("lots.of.element.key.part", '.');
Util.assertKeyPart(keyPart, 'l', new
String[] {"lots", "of", "element", "key", "part"});
KeyPart prefix = keyPart.extractPrefixPart(0, 3);
@@ -200,7 +200,7 @@
new String[]{"s", "of", "element", "key", "part"});
Util.assertKeyPart(prefix, 'l', new String[]{"lot"}, 5, 5, 4, 4);
- KeyPart keyPart2 = new KeyPart("other.elements.key.part");
+ KeyPart keyPart2 = new KeyPart("other.elements.key.part", '.');
Util.assertKeyPart(keyPart2, 'o', new
String[] {"other", "elements", "key", "part"});
KeyPart prefix2 = keyPart2.extractPrefixPart(0, 1);
@@ -208,18 +208,18 @@
String[] {"ther", "elements", "key", "part"});
Util.assertKeyPart(prefix2, 'o', new String[]{"o"}, 4, 4, 5, 5);
- KeyPart keyPart3 = new KeyPart("other.keyPart");
+ KeyPart keyPart3 = new KeyPart("other.keyPart", '.');
Util.assertKeyPart(keyPart3, 'o', new
String[] {"other", "keyPart"});
KeyPart prefix3 = keyPart3.extractPrefixPart(0, 2);
Util.assertKeyPart(keyPart3, 'h', new
String[] {"her", "keyPart"});
Util.assertKeyPart(prefix3, 'o', new String[]{"ot"}, 2, 2, 5, 5);
- prefix3.newSuffix(new KeyPart("blablabla"));
+ prefix3.newSuffix(new KeyPart("blablabla", '.'));
Util.assertLengthRange(prefix3.getLengthRange(), 1, 1, 2, 2, 5, 11);
KeyPart keyPart4 = new KeyPart(
- "a.keyPart.that.is.longer.than.the.others");
+ "a.keyPart.that.is.longer.than.the.others", '.');
Util.assertKeyPart(keyPart4, 'a', new String[] {"a", "keyPart",
"that", "is", "longer", "than", "the", "others"});
KeyPart prefix4 = keyPart4.extractPrefixPart(0, 1);
@@ -227,7 +227,7 @@
new String[] {"", "keyPart", "that", "is", "longer", "than", "the",
"others"});
Util.assertKeyPart(prefix4, 'a', new String[]{"a"}, 8, 8, 1, 1);
- prefix4.newSuffix(new KeyPart("ab.lots.elements.more.more.more"));
+ prefix4.newSuffix(new KeyPart("ab.lots.elements.more.more.more", '.'));
Util.assertLengthRange(prefix4.getLengthRange(), 1, 6, 8, 1, 1, 3);
// add suffixes
prefix.newSuffix(prefix2);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/TreeInsertionTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/TreeInsertionTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/TreeInsertionTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -63,14 +63,14 @@
String[] firstKeyElements = new String[] {"the", "key"};
assertRootLeafNode('t', firstKeyElements, "THE");
- tree.insert("other.key.very.very.different", "OTHER");
+ tree.insert("other.key.very.very.different", "SIMPLE_PARAM");
Node root = getRoot();
assertInternalNode(root, KeyPart.KEY_ELEMENT_END, new String[] {""},
2, 5, 3, 5);
assertChildLeafNode(root, 't', firstKeyElements, "THE");
String[] secondKeyElements = new String[] {"other", "key", "very", "very",
"different"};
- assertChildLeafNode(root, 'o', secondKeyElements, "OTHER");
+ assertChildLeafNode(root, 'o', secondKeyElements, "SIMPLE_PARAM");
}
public void testSameKey1() throws Exception
@@ -81,8 +81,8 @@
String[] firstKeyElements = new String[] {"the", "key"};
assertRootLeafNode('t', firstKeyElements, "THE");
- tree.insert("the.key", "OTHER");
- assertRootLeafNode('t', firstKeyElements, new String[]{"THE", "OTHER"});
+ tree.insert("the.key", "SIMPLE_PARAM");
+ assertRootLeafNode('t', firstKeyElements, new String[]{"THE", "SIMPLE_PARAM"});
}
public void testSameKey2() throws Exception
@@ -93,18 +93,18 @@
String[] firstKeyElements = new String[] {"the", "key"};
assertRootLeafNode('t', firstKeyElements, "THE");
- tree.insert("the.other.key", "OTHER");
+ tree.insert("the.other.key", "SIMPLE_PARAM");
Node root = getRoot();
assertInternalNode(root, 't', new String[]{"the"}, 2, 3);
assertChildLeafNode(root, 'k', new String[]{"key"}, "THE");
- assertChildLeafNode(root, 'o', new String[]{"other", "key"}, "OTHER");
+ assertChildLeafNode(root, 'o', new String[]{"other", "key"}, "SIMPLE_PARAM");
- tree.insert("the.other.key", "OTHER");
+ tree.insert("the.other.key", "SIMPLE_PARAM");
root = getRoot();
assertInternalNode(root, 't', new String[]{"the"}, 2, 3);
assertChildLeafNode(root, 'k', new String[]{"key"}, "THE");
assertChildLeafNode(root, 'o', new String[]{"other", "key"},
- new String[]{"OTHER", "OTHER"});
+ new String[]{"SIMPLE_PARAM", "SIMPLE_PARAM"});
}
public void testElementLengthRanges() throws Exception
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKeyTestCase.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKeyTestCase.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/insertion/InsertionKeyTestCase.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -38,12 +38,12 @@
public void setUp()
{
- insertionKey = new InsertionKey("a.key.to.be.inserted.on.the.tree");
+ insertionKey = new InsertionKey("a.key.to.be.inserted.on.the.tree", '.');
}
public void testInsertionComplete()
{
- KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree");
+ KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree", '.');
assertEquals(keyPart, insertionKey.extractCommonPrefix(keyPart));
assertEquals(InsertionKey.INSERTION_COMPLETE, insertionKey.getNextChar());
}
@@ -57,7 +57,7 @@
public void testPrefixExtraction()
{
- KeyPart keyPart = new KeyPart("a.different.key.part");
+ KeyPart keyPart = new KeyPart("a.different.key.part", '.');
KeyPart prefixKeyPart = insertionKey.extractCommonPrefix(keyPart);
Util.assertKeyPart(keyPart, 'd',
new String[] {"different", "key", "part"});
@@ -70,7 +70,7 @@
public void testPrefixExtraction2()
{
- KeyPart keyPart = new KeyPart("all.key.part");
+ KeyPart keyPart = new KeyPart("all.key.part", '.');
KeyPart prefixKeyPart = insertionKey.extractCommonPrefix(keyPart);
Util.assertKeyPart(keyPart, 'l', new String[] {"ll", "key",
"part"});
@@ -81,7 +81,7 @@
new String[] {"", "key", "to", "be", "inserted", "on", "the",
"tree"});
- keyPart = new KeyPart(".key.to.be.thrown.away");
+ keyPart = new KeyPart(".key.to.be.thrown.away", '.');
prefixKeyPart = insertionKey.extractCommonPrefix(keyPart);
Util.assertKeyPart(keyPart, 't',
new String[] {"thrown", "away"});
@@ -95,7 +95,7 @@
public void testPrefixExtraction3()
{
- KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree123");
+ KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree123", '.');
KeyPart target = keyPart.extractPrefixPart(7, 4);
Util.assertKeyPart(target, 'a', new String[] {"a", "key", "to", "be",
"inserted", "on", "the", "tree"}, 8, 8, 7, 7);
@@ -108,7 +108,7 @@
public void testPrefixExtraction4()
{
- KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree");
+ KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree", '.');
assertSame(keyPart, insertionKey.extractCommonPrefix(keyPart));
assertEquals(InsertionKey.INSERTION_COMPLETE, insertionKey.getNextChar());
assertSame(KeyPart.EMPTY_KEY_END, insertionKey.toKeyPart());
@@ -118,7 +118,7 @@
public void testPrefixExtraction5()
{
- KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree");
+ KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree", '.');
KeyPart prefixPart = keyPart.extractPrefixPart(0, 1);
Util.assertKeyPart(prefixPart, 'a', new String[]{"a"}, 8, 8, 1, 1);
assertSame(prefixPart, insertionKey.extractCommonPrefix(prefixPart));
@@ -130,7 +130,7 @@
public void testPrefixExtraction6()
{
- KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree");
+ KeyPart keyPart = new KeyPart("a.key.to.be.inserted.on.the.tree", '.');
KeyPart prefixPart = keyPart.extractPrefixPart(1, 1);
Util.assertKeyPart(prefixPart, 'a', new String[]{"a", "k"}, 8, 8, 3, 3);
assertSame(prefixPart, insertionKey.extractCommonPrefix(prefixPart));
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/SearchKeyTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/SearchKeyTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/SearchKeyTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -37,19 +37,19 @@
public void testOneElOneTarget()
{
// setup scenario
- KeyPart keyPart = new KeyPart("anyExpression");
+ KeyPart keyPart = new KeyPart("anyExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testOneElBrokenTarget1()
{
// setup scenario
- KeyPart keyPart2 = new KeyPart("anyExpression");
+ KeyPart keyPart2 = new KeyPart("anyExpression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 3);
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals('E', searchKey.matches(keyPart1));
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart2));
}
@@ -57,11 +57,11 @@
public void testOneElBrokenTarget2()
{
// setup scenario
- KeyPart keyPart3 = new KeyPart("anyExpression");
+ KeyPart keyPart3 = new KeyPart("anyExpression", '.');
KeyPart keyPart2 = keyPart3.extractPrefixPart(0, 6);
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 1);
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals('n', searchKey.matches(keyPart1));
assertEquals('r', searchKey.matches(keyPart2));
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart3));
@@ -70,11 +70,11 @@
public void testOneElEmptyKeyEnd()
{
// setup scenario
- KeyPart keyPart1 = new KeyPart("anyExpression");
- KeyPart keyPart2 = new KeyPart("longSuffix");
+ KeyPart keyPart1 = new KeyPart("anyExpression", '.');
+ KeyPart keyPart2 = new KeyPart("longSuffix", '.');
keyPart1.newSuffix(keyPart2);
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(KeyPart.KEY_ELEMENT_END, searchKey.matches(keyPart1));
assertEquals(Flags.POSITIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
@@ -83,10 +83,10 @@
public void testOneElElemEnd()
{
// setup scenario
- KeyPart keyPart2 = new KeyPart("anyExpression");
+ KeyPart keyPart2 = new KeyPart("anyExpression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 13);
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(KeyPart.KEY_ELEMENT_END, searchKey.matches(keyPart1));
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart2));
}
@@ -94,25 +94,25 @@
public void testOneElNegative1()
{
// setup scenario
- KeyPart keyPart = new KeyPart("differentExpression");
+ KeyPart keyPart = new KeyPart("differentExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testOneElNegative2()
{
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testOneElNegative3()
{
// setup scenario
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// test search key
- SearchKey searchKey = new SearchKey("anyExpression");
+ SearchKey searchKey = new SearchKey("anyExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -120,38 +120,38 @@
{
// setup scenario
KeyPart keyPart14 = new KeyPart(
- "averyveryveryloooongoneelementexpressonanyExpression");
+ "averyveryveryloooongoneelementexpressonanyExpression", '.');
KeyPart keyPart13 = keyPart14.extractPrefixPart(0, 26);
KeyPart keyPart15 = new KeyPart(
- "anotherDifferentSuffixEndingWithanyExpression");
+ "anotherDifferentSuffixEndingWithanyExpression", '.');
keyPart13.newSuffix(keyPart15);
- KeyPart keyPart16 = new KeyPart("obviouslyOneSuffixLongWithAMismatch");
+ KeyPart keyPart16 = new KeyPart("obviouslyOneSuffixLongWithAMismatch", '.');
keyPart13.newSuffix(keyPart16);
KeyPart keyPart3 = keyPart13.extractPrefixPart(0, 19);
KeyPart keyPart11 = new KeyPart(
- "somethingveryveryeryveryrelationshipanyExpression");
+ "somethingveryveryeryveryrelationshipanyExpression", '.');
KeyPart keyPart10 = keyPart11.extractPrefixPart(0, 36);
- KeyPart keyPart12 = new KeyPart("unyExpression");
+ KeyPart keyPart12 = new KeyPart("unyExpression", '.');
keyPart10.newSuffix(keyPart12);
KeyPart keyPart4 = keyPart10.extractPrefixPart(0, 24);
- KeyPart keyPart5 = new KeyPart("abcdefghijklanyExpression");
+ KeyPart keyPart5 = new KeyPart("abcdefghijklanyExpression", '.');
keyPart4.newSuffix(keyPart5);
- KeyPart keyPart7 = new KeyPart("mnopqrstuvxyzanyExpressio");
+ KeyPart keyPart7 = new KeyPart("mnopqrstuvxyzanyExpressio", '.');
KeyPart keyPart6 = keyPart7.extractPrefixPart(0, 6);
- KeyPart keyPart8 = new KeyPart("anyanyanyExpression");
+ KeyPart keyPart8 = new KeyPart("anyanyanyExpression", '.');
keyPart6.newSuffix(keyPart8);
- KeyPart keyPart9 = new KeyPart("bcdefganyExpression");
+ KeyPart keyPart9 = new KeyPart("bcdefganyExpression", '.');
keyPart6.newSuffix(keyPart9);
keyPart4.newSuffix(keyPart6);
keyPart3.newSuffix(keyPart4);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 10);
KeyPart keyPart2 = new KeyPart(
- "abcdefghijklmnopqrstuvwxyzobviousmismatchagain");
+ "abcdefghijklmnopqrstuvwxyzobviousmismatchagain", '.');
keyPart1.newSuffix(keyPart2);
// test search key
- SearchKey searchKey = new SearchKey("*anyExpression");
+ SearchKey searchKey = new SearchKey("*anyExpression", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -200,45 +200,45 @@
public void testNoPatternOneTarget1()
{
// setup scenario
- KeyPart keyPart = new KeyPart("anyExpression");
+ KeyPart keyPart = new KeyPart("anyExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testNoPatternOneTarget2()
{
// setup scenario
- KeyPart keyPart = new KeyPart("anyXXXXXXExpression");
+ KeyPart keyPart = new KeyPart("anyXXXXXXExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testNoPatternOneTarget3()
{
// setup scenario
- KeyPart keyPart = new KeyPart("anyXXXXXXExpression");
+ KeyPart keyPart = new KeyPart("anyXXXXXXExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testNoPatternOneTarget4()
{
// setup scenario
- KeyPart keyPart = new KeyPart("any.Expression");
+ KeyPart keyPart = new KeyPart("any.Expression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testNoPatternOneTarget5()
{
// setup scenario
- KeyPart keyPart = new KeyPart("any.blabla.Expression");
+ KeyPart keyPart = new KeyPart("any.blabla.Expression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -246,19 +246,19 @@
{
// setup scenario
KeyPart keyPart = new KeyPart(
- "anythingthat.garbage.garbage.garbage.somePrefixExpression");
+ "anythingthat.garbage.garbage.garbage.somePrefixExpression", '.');
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testNoPatternBrokenTarget1()
{
// setup scenario
- KeyPart keyPart2 = new KeyPart("anyXXXXXXExpression");
+ KeyPart keyPart2 = new KeyPart("anyXXXXXXExpression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 10);
// test search key
- SearchKey searchKey = new SearchKey("any*Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
assertEquals('x', searchKey.matches(keyPart1));
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart2));
}
@@ -266,12 +266,12 @@
public void testNoPatternBrokenTarget2()
{
// setup scenario
- SearchKey searchKey = new SearchKey("any*Expression");
- KeyPart keyPart2 = new KeyPart("any.Expression");
+ SearchKey searchKey = new SearchKey("any*Expression", '.');
+ KeyPart keyPart2 = new KeyPart("any.Expression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(1, 0);
- KeyPart keyPart4 = new KeyPart("anyanyanyanyanyExpresExpression");
+ KeyPart keyPart4 = new KeyPart("anyanyanyanyanyExpresExpression", '.');
KeyPart keyPart3 = keyPart4.extractPrefixPart(0, 28);
- KeyPart keyPart5 = new KeyPart("");
+ KeyPart keyPart5 = new KeyPart("", '.');
keyPart3.newSuffix(keyPart5);
keyPart1.newSuffix(keyPart3);
// test search key
@@ -287,15 +287,15 @@
public void testNoPatternBrokenTarget3()
{
// setup scenario
- KeyPart keyPart2 = new KeyPart("any.Expression");
+ KeyPart keyPart2 = new KeyPart("any.Expression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(1, 0);
- KeyPart keyPart4 = new KeyPart("anyanyanyanyanyExpresExpression");
+ KeyPart keyPart4 = new KeyPart("anyanyanyanyanyExpresExpression", '.');
KeyPart keyPart3 = keyPart4.extractPrefixPart(0, 28);
- KeyPart keyPart5 = new KeyPart("");
+ KeyPart keyPart5 = new KeyPart("", '.');
keyPart3.newSuffix(keyPart5);
keyPart1.newSuffix(keyPart3);
// test search key
- SearchKey searchKey = new SearchKey("any.*Expression");
+ SearchKey searchKey = new SearchKey("any.*Expression", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
SearchKey searchKey1 = searchKey.getWildcardInstance();
searchKey.prepareWildcardInstance(searchKey1);
@@ -308,39 +308,39 @@
public void testNoPatternNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("any.Expression");
+ KeyPart keyPart = new KeyPart("any.Expression", '.');
// bb
- SearchKey searchKey = new SearchKey("any.*.Expression");
+ SearchKey searchKey = new SearchKey("any.*.Expression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testNoPatternNegative2()
{
// aa
- KeyPart keyPart2 = new KeyPart("any.Expression");
+ KeyPart keyPart2 = new KeyPart("any.Expression", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 1);
- KeyPart keyPart3 = new KeyPart("something");
+ KeyPart keyPart3 = new KeyPart("something", '.');
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("any.*.Expression");
+ SearchKey searchKey = new SearchKey("any.*.Expression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart1));
}
public void testEmptyPrefixPatternOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("any.thinganExpression");
+ KeyPart keyPart = new KeyPart("any.thinganExpression", '.');
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixPatternOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("any.anyany.thinganExpression");
+ KeyPart keyPart = new KeyPart("any.anyany.thinganExpression", '.');
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -348,25 +348,25 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "any.anyany.thing.anexp.anexp.aaaanExpression");
+ "any.anyany.thing.anexp.anexp.aaaanExpression", '.');
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixPatternBrokenTarget()
{
// aa
- KeyPart keyPart3 = new KeyPart("any.any.any.thin.any.thing.anExpression");
+ KeyPart keyPart3 = new KeyPart("any.any.any.thin.any.thing.anExpression", '.');
KeyPart keyPart2 = keyPart3.extractPrefixPart(3, 0);
KeyPart keyPart1 = keyPart2.extractPrefixPart(2, 1);
- KeyPart keyPart4 = new KeyPart(".thinganExpression");
+ KeyPart keyPart4 = new KeyPart(".thinganExpression", '.');
keyPart1.newSuffix(keyPart4);
keyPart2.newSuffix(KeyPart.EMPTY_KEY_END);
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -386,67 +386,67 @@
public void testEmptyPrefixPatternNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("anythinganExpression");
+ KeyPart keyPart = new KeyPart("anythinganExpression", '.');
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixPatternNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("anyadsaafsa.asdthinganExpression");
+ KeyPart keyPart = new KeyPart("anyadsaafsa.asdthinganExpression", '.');
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixPatternNegative3()
{
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testEmptyPrefixPatternNegative4()
{
// bb
- SearchKey searchKey = new SearchKey("any*.thing*anExpression");
- assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("")));
+ SearchKey searchKey = new SearchKey("any*.thing*anExpression", '.');
+ assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("", '.')));
}
public void testEmptySuffixPatternOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("apattern.that.has.Wildcards");
+ KeyPart keyPart = new KeyPart("apattern.that.has.Wildcards", '.');
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixPatternOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("apattern.that.anything.anyhas.Wildcards");
+ KeyPart keyPart = new KeyPart("apattern.that.anything.anyhas.Wildcards", '.');
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixPatternBrokenTarget1()
{
// aa
- KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards");
+ KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards", '.');
KeyPart keyPart2 = keyPart3.extractPrefixPart(2, 2);
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 0);
- KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards");
+ KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards", '.');
keyPart1.newSuffix(keyPart5);
- KeyPart keyPart4 = new KeyPart("ing.has.Xildcards");
+ KeyPart keyPart4 = new KeyPart("ing.has.Xildcards", '.');
keyPart2.newSuffix(keyPart4);
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals('a', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart2));
@@ -461,17 +461,17 @@
public void testEmptySuffixPatternBrokenTarget2()
{
// aa
- KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards");
+ KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards", '.');
KeyPart keyPart2 = keyPart3.extractPrefixPart(2, 2);
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 0);
- KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards");
+ KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards", '.');
keyPart1.newSuffix(keyPart5);
- KeyPart keyPart4 = new KeyPart("ing.has.Wildcard");
+ KeyPart keyPart4 = new KeyPart("ing.has.Wildcard", '.');
keyPart2.newSuffix(keyPart4);
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals('a', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart2));
@@ -486,20 +486,20 @@
public void testEmptySuffixPatternBrokenTarget3()
{
// aa
- KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards");
+ KeyPart keyPart3 = new KeyPart("apattern.that.anything.anyhas.Wildcards", '.');
KeyPart keyPart2 = keyPart3.extractPrefixPart(2, 2);
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 0);
- KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards");
+ KeyPart keyPart5 = new KeyPart("banewpatternthathaswildcards", '.');
keyPart1.newSuffix(keyPart5);
- KeyPart keyPart6 = new KeyPart("ing.has.Wildcardy");
+ KeyPart keyPart6 = new KeyPart("ing.has.Wildcardy", '.');
keyPart2.newSuffix(keyPart6);
KeyPart keyPart4 = keyPart6.extractPrefixPart(2, 8);
- KeyPart keyPart7 = new KeyPart("i");
+ KeyPart keyPart7 = new KeyPart("i", '.');
keyPart4.newSuffix(keyPart7);
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals('a', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart2));
@@ -514,19 +514,19 @@
public void testEmptySuffixPatternBrokenTarget4()
{
// aa
- KeyPart keyPart4 = new KeyPart("apattern.that.anyhas.Wildcards");
+ KeyPart keyPart4 = new KeyPart("apattern.that.anyhas.Wildcards", '.');
KeyPart keyPart3 = keyPart4.extractPrefixPart(2, 0);
KeyPart keyPart2 = keyPart3.extractPrefixPart(1, 1);
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 0);
- KeyPart keyPart6 = new KeyPart("banewpatternthathaswildcards");
+ KeyPart keyPart6 = new KeyPart("banewpatternthathaswildcards", '.');
keyPart1.newSuffix(keyPart6);
- KeyPart keyPart5 = new KeyPart("inghas.Wildcards");
+ KeyPart keyPart5 = new KeyPart("inghas.Wildcards", '.');
keyPart3.newSuffix(keyPart5);
- keyPart2.newSuffix(new KeyPart(""));
+ keyPart2.newSuffix(new KeyPart("", '.'));
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals('a', searchKey.matches(keyPart1));
assertEquals('h', searchKey.matches(keyPart2));
@@ -542,7 +542,7 @@
public void testEmptySuffixPatternNegative1()
{
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
@@ -550,38 +550,38 @@
public void testEmptySuffixPatternNegative2()
{
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
- assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("")));
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
+ assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("", '.')));
}
public void testEmptySuffixPatternNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("only.three.elements");
+ KeyPart keyPart = new KeyPart("only.three.elements", '.');
keyPart = keyPart.extractPrefixPart(2, 1);
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixPatternNegative4()
{
// aa
- KeyPart keyPart = new KeyPart("only.three.elements");
+ KeyPart keyPart = new KeyPart("only.three.elements", '.');
keyPart = keyPart.extractPrefixPart(2, 1);
- keyPart.newSuffix(new KeyPart("s.i.x.ele.ment.s"));
+ keyPart.newSuffix(new KeyPart("s.i.x.ele.ment.s", '.'));
// bb
- SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards");
+ SearchKey searchKey = new SearchKey("a*pattern.that.*has.Wildcards", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixSuffixPatternOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("aaa.empty.prefix.suffix.pattern.suffix");
+ KeyPart keyPart = new KeyPart("aaa.empty.prefix.suffix.pattern.suffix", '.');
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -589,10 +589,10 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "aaa.empty.prefix.suffix.pattern.abcsuffix");
+ "aaa.empty.prefix.suffix.pattern.abcsuffix", '.');
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -600,10 +600,10 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "aaaabc.empty.prefix.suffix.pattern.abcsuffix");
+ "aaaabc.empty.prefix.suffix.pattern.abcsuffix", '.');
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -611,27 +611,27 @@
{
// aa
KeyPart keyPart9 = new KeyPart(
- "aaaabc.empty.prefix.suffix.pattern.susuffix.suffixsuffix");
+ "aaaabc.empty.prefix.suffix.pattern.susuffix.suffixsuffix", '.');
KeyPart keyPart8 = keyPart9.extractPrefixPart(6, 6);
- KeyPart keyPart10 = new KeyPart("");
+ KeyPart keyPart10 = new KeyPart("", '.');
keyPart8.newSuffix(keyPart10);
KeyPart keyPart7 = keyPart8.extractPrefixPart(6, 0);
keyPart7.newSuffix(KeyPart.EMPTY_KEY_END);
KeyPart keyPart5 = keyPart7.extractPrefixPart(5, 2);
- KeyPart keyPart6 = new KeyPart("ffix");
+ KeyPart keyPart6 = new KeyPart("ffix", '.');
keyPart5.newSuffix(keyPart6);
KeyPart keyPart1 = keyPart5.extractPrefixPart(5, 1);
- KeyPart keyPart2 = new KeyPart("affix");
+ KeyPart keyPart2 = new KeyPart("affix", '.');
keyPart1.newSuffix(keyPart2);
- KeyPart keyPart3 = new KeyPart("");
+ KeyPart keyPart3 = new KeyPart("", '.');
keyPart1.newSuffix(keyPart3);
- KeyPart keyPart4 = new KeyPart("abc");
+ KeyPart keyPart4 = new KeyPart("abc", '.');
keyPart1.newSuffix(keyPart4);
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -668,16 +668,16 @@
{
// aa
KeyPart keyPart5 = new KeyPart(
- "aaaabc.empty.prefix.suffix.pattern.suffix");
+ "aaaabc.empty.prefix.suffix.pattern.suffix", '.');
KeyPart keyPart3 = keyPart5.extractPrefixPart(4, 7);
- KeyPart keyPart4 = new KeyPart("suffix");
+ KeyPart keyPart4 = new KeyPart("suffix", '.');
keyPart3.newSuffix(keyPart4);
KeyPart keyPart1 = keyPart3.extractPrefixPart(2, 0);
- KeyPart keyPart2 = new KeyPart("");
+ KeyPart keyPart2 = new KeyPart("", '.');
keyPart1.newSuffix(keyPart2);
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals('p', searchKey.matches(keyPart1));
assertEquals(KeyPart.KEY_ELEMENT_END, searchKey.matches(keyPart3));
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart5));
@@ -687,7 +687,7 @@
{
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
@@ -695,17 +695,17 @@
{
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
- assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("")));
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
+ assertEquals(Flags.NEGATIVE, searchKey.matches(new KeyPart("", '.')));
}
public void testEmptyPrefixSuffixPatternNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("aaaempty.prefix.suffix.patternsuffix");
+ KeyPart keyPart = new KeyPart("aaaempty.prefix.suffix.patternsuffix", '.');
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -713,61 +713,61 @@
{
// aa
KeyPart keyPart = new KeyPart("aaaempty. empty.prefix.suffixempty." +
- "empty.prefix.suffix.pattern.anysuffisuffisuffi");
+ "empty.prefix.suffix.pattern.anysuffisuffisuffi", '.');
// bb
SearchKey searchKey = new SearchKey(
- "aaa*.empty.prefix.suffix.pattern.*suffix");
+ "aaa*.empty.prefix.suffix.pattern.*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPatternOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("abc.c");
+ KeyPart keyPart = new KeyPart("abc.c", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotPatternOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("abccccc.ccccc");
+ KeyPart keyPart = new KeyPart("abccccc.ccccc", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotPatternOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("abc.cccc.ccccc");
+ KeyPart keyPart = new KeyPart("abc.cccc.ccccc", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*.*c", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotPatternBrokenTarget1()
{
// aa
- KeyPart keyPart2 = new KeyPart("abc.c");
+ KeyPart keyPart2 = new KeyPart("abc.c", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(1, 0);
- KeyPart keyPart3 = new KeyPart("anything.broken.into.lots.of.elements");
+ KeyPart keyPart3 = new KeyPart("anything.broken.into.lots.of.elements", '.');
keyPart1.newSuffix(keyPart3);
KeyPart keyPart5 = new KeyPart(
- "something.that.is.a.positive.match.for.sure.c");
+ "something.that.is.a.positive.match.for.sure.c", '.');
KeyPart keyPart4 = keyPart5.extractPrefixPart(2, 1);
keyPart1.newSuffix(keyPart4);
- KeyPart keyPart6 = new KeyPart("c");
- KeyPart keyPart7 = new KeyPart("anything.ending.with.c");
- KeyPart keyPart8 = new KeyPart("negative.match.for.sure");
+ KeyPart keyPart6 = new KeyPart("c", '.');
+ KeyPart keyPart7 = new KeyPart("anything.ending.with.c", '.');
+ KeyPart keyPart8 = new KeyPart("negative.match.for.sure", '.');
keyPart4.newSuffix(keyPart6);
keyPart4.newSuffix(keyPart7);
keyPart4.newSuffix(keyPart8);
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -793,26 +793,26 @@
public void testDotPatternBrokenTarget2()
{
// aa
- KeyPart keyPart9 = new KeyPart("abc.c.c.ccccccc");
+ KeyPart keyPart9 = new KeyPart("abc.c.c.ccccccc", '.');
KeyPart keyPart8 = keyPart9.extractPrefixPart(3, 3);
- KeyPart keyPart10 = new KeyPart("");
+ KeyPart keyPart10 = new KeyPart("", '.');
keyPart8.newSuffix(keyPart10);
KeyPart keyPart7 = keyPart8.extractPrefixPart(3, 0);
keyPart7.newSuffix(KeyPart.EMPTY_KEY_END);
KeyPart keyPart6 = keyPart7.extractPrefixPart(2, 0);
keyPart6.newSuffix(KeyPart.EMPTY_KEY_END);
KeyPart keyPart3 = keyPart6.extractPrefixPart(1, 1);
- KeyPart keyPart4 = new KeyPart("abb.bb.b");
+ KeyPart keyPart4 = new KeyPart("abb.bb.b", '.');
keyPart3.newSuffix(keyPart4);
- KeyPart keyPart5 = new KeyPart("c");
+ KeyPart keyPart5 = new KeyPart("c", '.');
keyPart3.newSuffix(keyPart5);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 3);
- KeyPart keyPart2 = new KeyPart("c");
+ KeyPart keyPart2 = new KeyPart("c", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -852,70 +852,70 @@
public void testDotPatternNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("abcc");
+ KeyPart keyPart = new KeyPart("abcc", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPatternNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPatternNegative3()
{
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testDotPatternNegative4()
{
// aa
- KeyPart keyPart = new KeyPart("abc.c.c.d");
+ KeyPart keyPart = new KeyPart("abc.c.c.d", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPatternNegative5()
{
// aa
- KeyPart keyPart = new KeyPart("abc.a");
+ KeyPart keyPart = new KeyPart("abc.a", '.');
// bb
- SearchKey searchKey = new SearchKey("abc*.*c");
+ SearchKey searchKey = new SearchKey("abc*.*c", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompletePatternOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("acomplete.pat.terncomps");
+ KeyPart keyPart = new KeyPart("acomplete.pat.terncomps", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompletePatternOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("a.complete.pat.terncomp.s");
+ KeyPart keyPart = new KeyPart("a.complete.pat.terncomp.s", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompletePatternOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("a.complete.pat.terncomp.s");
+ KeyPart keyPart = new KeyPart("a.complete.pat.terncomp.s", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -923,9 +923,9 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "anythingcomplete.pat.terncomp.aabbbbbbbbbbbccccc.yes");
+ "anythingcomplete.pat.terncomp.aabbbbbbbbbbbccccc.yes", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncomp*s", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -933,27 +933,27 @@
public void testCompletePatternBrokenTarget()
{
// aa
- KeyPart keyPart8 = new KeyPart("anythingcomplete.pat.terncompycs");
+ KeyPart keyPart8 = new KeyPart("anythingcomplete.pat.terncompycs", '.');
KeyPart keyPart7 = keyPart8.extractPrefixPart(2, 10);
- KeyPart keyPart10 = new KeyPart("omplete.pat.terncomplycs");
+ KeyPart keyPart10 = new KeyPart("omplete.pat.terncomplycs", '.');
KeyPart keyPart9 = keyPart10.extractPrefixPart(1, 0);
keyPart7.newSuffix(keyPart9);
- KeyPart keyPart11 = new KeyPart("comp.completepat.terncomplycs");
+ KeyPart keyPart11 = new KeyPart("comp.completepat.terncomplycs", '.');
keyPart9.newSuffix(keyPart11);
KeyPart keyPart4 = keyPart7.extractPrefixPart(2, 8);
- KeyPart keyPart5 = new KeyPart("lete.pat.terncompycatedddddddddddd.sos");
+ KeyPart keyPart5 = new KeyPart("lete.pat.terncompycatedddddddddddd.sos", '.');
keyPart4.newSuffix(keyPart5);
- KeyPart keyPart6 = new KeyPart("s");
+ KeyPart keyPart6 = new KeyPart("s", '.');
keyPart4.newSuffix(keyPart6);
KeyPart keyPart1 = keyPart4.extractPrefixPart(1, 3);
- KeyPart keyPart2 = new KeyPart("completepatterncompyc");
+ KeyPart keyPart2 = new KeyPart("completepatterncompyc", '.');
keyPart1.newSuffix(keyPart2);
- KeyPart keyPart3 = new KeyPart(".complete.pat.terncompyc.suffixes");
+ KeyPart keyPart3 = new KeyPart(".complete.pat.terncompyc.suffixes", '.');
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncompyc*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncompyc*s", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -989,25 +989,25 @@
public void testCompletePatternNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("acomplete.patterns");
+ KeyPart keyPart = new KeyPart("acomplete.patterns", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.tern*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.tern*s", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompletePatternNegative2()
{
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.tern*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.tern*s", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testCompletePatternNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.tern*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.tern*s", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -1015,27 +1015,27 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "acomplete.pat.teerncomplete.pat.terncompys");
+ "acomplete.pat.teerncomplete.pat.terncompys", '.');
// bb
- SearchKey searchKey = new SearchKey("a*complete.pat.terncompyc*s");
+ SearchKey searchKey = new SearchKey("a*complete.pat.terncompyc*s", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPrefixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("a.prefix.patternsuffix");
+ KeyPart keyPart = new KeyPart("a.prefix.patternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotPrefixOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("a.prefix.patternaaaaaaaaaaaaasuffix");
+ KeyPart keyPart = new KeyPart("a.prefix.patternaaaaaaaaaaaaasuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1043,9 +1043,9 @@
public void testDotPrefixOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("a.prefix.patternaaaaaaaaaaaaa.suffix");
+ KeyPart keyPart = new KeyPart("a.prefix.patternaaaaaaaaaaaaa.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1053,34 +1053,34 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "a.prefix.patternaaaaaaaaaaaaa.abac.suffix");
+ "a.prefix.patternaaaaaaaaaaaaa.abac.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotPrefixBrokenTarget()
{
// aa
- KeyPart keyPart9 = new KeyPart("a.prefix.pattern.suffix");
+ KeyPart keyPart9 = new KeyPart("a.prefix.pattern.suffix", '.');
KeyPart keyPart8 = keyPart9.extractPrefixPart(3, 3);
- KeyPart keyPart10 = new KeyPart("suffix");
+ KeyPart keyPart10 = new KeyPart("suffix", '.');
keyPart8.newSuffix(keyPart10);
KeyPart keyPart5 = keyPart8.extractPrefixPart(2, 6);
- KeyPart keyPart6 = new KeyPart("pattern.aaaaa.suffix");
+ KeyPart keyPart6 = new KeyPart("pattern.aaaaa.suffix", '.');
keyPart5.newSuffix(keyPart6);
- KeyPart keyPart7 = new KeyPart("a_suffix");
+ KeyPart keyPart7 = new KeyPart("a_suffix", '.');
keyPart5.newSuffix(keyPart7);
KeyPart keyPart3 = keyPart5.extractPrefixPart(1, 6);
- KeyPart keyPart4 = new KeyPart("patternsuffix");
+ KeyPart keyPart4 = new KeyPart("patternsuffix", '.');
keyPart3.newSuffix(keyPart4);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 0);
- KeyPart keyPart2 = new KeyPart("something.different.from.search.key");
+ KeyPart keyPart2 = new KeyPart("something.different.from.search.key", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals('a', searchKey.matches(keyPart1));
assertEquals(KeyPart.KEY_ELEMENT_END, searchKey.matches(keyPart3));
@@ -1104,52 +1104,52 @@
public void testDotPrefixNegative1()
{
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testDotPrefixNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPrefixNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("a.prefix.patternsuffixa");
+ KeyPart keyPart = new KeyPart("a.prefix.patternsuffixa", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotPrefixNegative4()
{
// aa
- KeyPart keyPart = new KeyPart("a.prefixpatternsuffix");
+ KeyPart keyPart = new KeyPart("a.prefixpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix");
+ SearchKey searchKey = new SearchKey("a.prefix.*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompletePrefixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("complete.prefixpatternsuffix");
+ KeyPart keyPart = new KeyPart("complete.prefixpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompletePrefixOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("complete.prefix.pattern.suffix");
+ KeyPart keyPart = new KeyPart("complete.prefix.pattern.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1157,40 +1157,40 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "complete.prefixabbbbbbcpatterpatternand.asuffix");
+ "complete.prefixabbbbbbcpatterpatternand.asuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompletePrefixBrokenTarget()
{
// aa
- KeyPart keyPart11 = new KeyPart("complete.prefix.patter.suffix");
+ KeyPart keyPart11 = new KeyPart("complete.prefix.patter.suffix", '.');
KeyPart keyPart6 = keyPart11.extractPrefixPart(2, 6);
- KeyPart keyPart9 = new KeyPart("n.suffix");
+ KeyPart keyPart9 = new KeyPart("n.suffix", '.');
KeyPart keyPart7 = keyPart9.extractPrefixPart(0, 1);
- KeyPart keyPart8 = new KeyPart("suffix");
+ KeyPart keyPart8 = new KeyPart("suffix", '.');
keyPart7.newSuffix(keyPart8);
keyPart6.newSuffix(keyPart7);
- KeyPart keyPart10 = new KeyPart("abc.patternsuffix");
+ KeyPart keyPart10 = new KeyPart("abc.patternsuffix", '.');
keyPart6.newSuffix(keyPart10);
KeyPart keyPart5 = keyPart6.extractPrefixPart(1, 2);
- keyPart5.newSuffix(new KeyPart(""));
- keyPart5.newSuffix(new KeyPart("prefix"));
+ keyPart5.newSuffix(new KeyPart("", '.'));
+ keyPart5.newSuffix(new KeyPart("prefix", '.'));
KeyPart keyPart4 = keyPart5.extractPrefixPart(0, 8);
- keyPart4.newSuffix(new KeyPart("prefixpatternsuffix"));
- keyPart4.newSuffix(new KeyPart("s.prefixpatternsuffix"));
+ keyPart4.newSuffix(new KeyPart("prefixpatternsuffix", '.'));
+ keyPart4.newSuffix(new KeyPart("s.prefixpatternsuffix", '.'));
KeyPart keyPart3 = keyPart4.extractPrefixPart(0, 5);
- keyPart3.newSuffix(new KeyPart("abc"));
- keyPart3.newSuffix(new KeyPart("some.r.e.a.l.l.y.long.key"));
+ keyPart3.newSuffix(new KeyPart("abc", '.'));
+ keyPart3.newSuffix(new KeyPart("some.r.e.a.l.l.y.long.key", '.'));
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 0);
- KeyPart keyPart2 = new KeyPart("incomplete.prefix.pattern.suffix");
+ KeyPart keyPart2 = new KeyPart("incomplete.prefix.pattern.suffix", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals('c', searchKey.matches(keyPart1));
assertEquals('e', searchKey.matches(keyPart3));
@@ -1216,61 +1216,61 @@
public void testCompletePrefixNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("complete.prefix.pattern.suffiX");
+ KeyPart keyPart = new KeyPart("complete.prefix.pattern.suffiX", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompletePrefixNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("completeprefix.prefixpatternsuffix");
+ KeyPart keyPart = new KeyPart("completeprefix.prefixpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompletePrefixNegative3()
{
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testCompletePrefixNegative4()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix");
+ SearchKey searchKey = new SearchKey("complete.prefix*pattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("patpatpatternsuffix");
+ KeyPart keyPart = new KeyPart("patpatpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("anythingprecedingpatpatpatternsuffix");
+ KeyPart keyPart = new KeyPart("anythingprecedingpatpatpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("anything.preceding.apatpatpattern.suffix");
+ KeyPart keyPart = new KeyPart("anything.preceding.apatpatpattern.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1278,23 +1278,23 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "apatpatpatpat.patpatpattern.ending.with.somesuffix");
+ "apatpatpatpat.patpatpattern.ending.with.somesuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixBrokenTarget1()
{
// aa
- KeyPart keyPart2 = new KeyPart("papatpatpatternsuffix");
+ KeyPart keyPart2 = new KeyPart("papatpatpatternsuffix", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 6);
- KeyPart keyPart3 = new KeyPart("pattern");
+ KeyPart keyPart3 = new KeyPart("pattern", '.');
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -1308,23 +1308,23 @@
public void testEmptyPrefixBrokenTarget2()
{
// aa
- KeyPart keyPart2 = new KeyPart("papatpatpatternsuffix");
+ KeyPart keyPart2 = new KeyPart("papatpatpatternsuffix", '.');
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 4);
KeyPart keyPart7 = new KeyPart(
- ".patpatpattern.something.anything.suffix");
+ ".patpatpattern.something.anything.suffix", '.');
KeyPart keyPart6 = keyPart7.extractPrefixPart(2, 1);
- KeyPart keyPart8 = new KeyPart("uffix");
+ KeyPart keyPart8 = new KeyPart("uffix", '.');
keyPart6.newSuffix(keyPart8);
KeyPart keyPart3 = keyPart6.extractPrefixPart(2, 0);
- KeyPart keyPart5 = new KeyPart("abcd.fghij.klmnopqrsuffix");
+ KeyPart keyPart5 = new KeyPart("abcd.fghij.klmnopqrsuffix", '.');
keyPart3.newSuffix(keyPart5);
- KeyPart keyPart4 = new KeyPart("negativesUfFiX");
+ KeyPart keyPart4 = new KeyPart("negativesUfFiX", '.');
keyPart3.newSuffix(keyPart4);
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -1353,52 +1353,52 @@
public void testEmptyPrefixNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("anything.preceding.apatpatpatterns.uffix");
+ KeyPart keyPart = new KeyPart("anything.preceding.apatpatpatterns.uffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("anythingpreceding.apatpatterns.uffix");
+ KeyPart keyPart = new KeyPart("anythingpreceding.apatpatterns.uffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("patpatter.suffix");
+ KeyPart keyPart = new KeyPart("patpatter.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptyPrefixNegative4()
{
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testEmptyPrefixNegative5()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("*patpatpattern*suffix");
+ SearchKey searchKey = new SearchKey("*patpatpattern*suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotSuffixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpattern.suffix");
+ KeyPart keyPart = new KeyPart("prefixpattern.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1406,9 +1406,9 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.some.element.patternnnnnnnnnnnn.suffix");
+ "prefix.some.element.patternnnnnnnnnnnn.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1416,34 +1416,34 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.pattern.some.elements.sssssssss.suffix");
+ "prefix.pattern.some.elements.sssssssss.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testDotSuffixBrokenTarget()
{
// aa
- KeyPart keyPart9 = new KeyPart("prefixpattern.suffix");
+ KeyPart keyPart9 = new KeyPart("prefixpattern.suffix", '.');
KeyPart keyPart8 = keyPart9.extractPrefixPart(0, 13);
- KeyPart keyPart10 = new KeyPart("suffix");
+ KeyPart keyPart10 = new KeyPart("suffix", '.');
keyPart8.newSuffix(keyPart10);
KeyPart keyPart5 = keyPart8.extractPrefixPart(0, 9);
- KeyPart keyPart6 = new KeyPart("pat.patterpattern.pattern.suffix");
+ KeyPart keyPart6 = new KeyPart("pat.patterpattern.pattern.suffix", '.');
keyPart5.newSuffix(keyPart6);
- KeyPart keyPart7 = new KeyPart("");
+ KeyPart keyPart7 = new KeyPart("", '.');
keyPart5.newSuffix(keyPart7);
KeyPart keyPart3 = keyPart5.extractPrefixPart(0, 6);
- KeyPart keyPart4 = new KeyPart(".patternsuffix");
+ KeyPart keyPart4 = new KeyPart(".patternsuffix", '.');
keyPart3.newSuffix(keyPart4);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 4);
- KeyPart keyPart2 = new KeyPart("prefix");
+ KeyPart keyPart2 = new KeyPart("prefix", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals('i', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart3));
@@ -1472,9 +1472,9 @@
public void testDotSuffixOneNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatternsuffix");
+ KeyPart keyPart = new KeyPart("prefixpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -1482,43 +1482,43 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.patter.some.elements.sssssssss.suffix");
+ "prefix.patter.some.elements.sssssssss.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotSuffixOneNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testDotSuffixOneNegative4()
{
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testCompleteSuffixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatterna.complete.suffix");
+ KeyPart keyPart = new KeyPart("prefixpatterna.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompleteSuffixOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatterna.complete.suffix");
+ KeyPart keyPart = new KeyPart("prefixpatterna.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*patter*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*patter*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1526,9 +1526,9 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.someelements.pattern.moreelements.a.complete.suffix");
+ "prefix.someelements.pattern.moreelements.a.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1536,9 +1536,9 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.someelements.pattern.moreelementsa.complete.suffix");
+ "prefix.someelements.pattern.moreelementsa.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1546,9 +1546,9 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefix.somepattern.moreelements.a.ca.complete.suffix");
+ "prefix.somepattern.moreelements.a.ca.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1556,36 +1556,36 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "prefixes.somepattern.moreelements.a.ca.complete.suffix");
+ "prefixes.somepattern.moreelements.a.ca.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testCompleteSuffixBrokenTarget1()
{
// aa
- KeyPart keyPart11 = new KeyPart("prefix.patterna.complete.suffix");
+ KeyPart keyPart11 = new KeyPart("prefix.patterna.complete.suffix", '.');
KeyPart keyPart10 = keyPart11.extractPrefixPart(3, 4);
- KeyPart keyPart12 = new KeyPart("abc");
+ KeyPart keyPart12 = new KeyPart("abc", '.');
keyPart10.newSuffix(keyPart12);
KeyPart keyPart8 = keyPart10.extractPrefixPart(2, 5);
- KeyPart keyPart9 = new KeyPart("ate.suffix");
+ KeyPart keyPart9 = new KeyPart("ate.suffix", '.');
keyPart8.newSuffix(keyPart9);
KeyPart keyPart6 = keyPart8.extractPrefixPart(2, 0);
- KeyPart keyPart7 = new KeyPart("acomplete.suffix");
+ KeyPart keyPart7 = new KeyPart("acomplete.suffix", '.');
keyPart6.newSuffix(keyPart7);
KeyPart keyPart4 = keyPart6.extractPrefixPart(1, 8);
- KeyPart keyPart5 = new KeyPart("somethingelse.ending.withsuffix");
+ KeyPart keyPart5 = new KeyPart("somethingelse.ending.withsuffix", '.');
keyPart4.newSuffix(keyPart5);
KeyPart keyPart1 = keyPart4.extractPrefixPart(1, 7);
- KeyPart keyPart2 = new KeyPart(".acompletea.complete.suffix");
+ KeyPart keyPart2 = new KeyPart(".acompletea.complete.suffix", '.');
keyPart1.newSuffix(keyPart2);
- KeyPart keyPart3 = new KeyPart("b.complete.suffix");
+ KeyPart keyPart3 = new KeyPart("b.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -1610,28 +1610,28 @@
public void testCompleteSuffixBrokenTarget2()
{
// aa
- KeyPart keyPart11 = new KeyPart("prefix.patterna.complete.suffix");
+ KeyPart keyPart11 = new KeyPart("prefix.patterna.complete.suffix", '.');
KeyPart keyPart10 = keyPart11.extractPrefixPart(3, 2);
- KeyPart keyPart12 = new KeyPart("afix");
+ KeyPart keyPart12 = new KeyPart("afix", '.');
keyPart10.newSuffix(keyPart12);
KeyPart keyPart8 = keyPart10.extractPrefixPart(3, 0);
- KeyPart keyPart9 = new KeyPart("preffix");
+ KeyPart keyPart9 = new KeyPart("preffix", '.');
keyPart8.newSuffix(keyPart9);
KeyPart keyPart6 = keyPart8.extractPrefixPart(1, 6);
- KeyPart keyPart7 = new KeyPart("pattern.anyend.a.complete.suffix");
+ KeyPart keyPart7 = new KeyPart("pattern.anyend.a.complete.suffix", '.');
keyPart6.newSuffix(keyPart7);
KeyPart keyPart3 = keyPart6.extractPrefixPart(1, 0);
- KeyPart keyPart4 = new KeyPart("prefixpattern.complete.suffix");
+ KeyPart keyPart4 = new KeyPart("prefixpattern.complete.suffix", '.');
keyPart3.newSuffix(keyPart4);
- KeyPart keyPart5 = new KeyPart("apatterna.complete.suffix");
+ KeyPart keyPart5 = new KeyPart("apatterna.complete.suffix", '.');
keyPart3.newSuffix(keyPart5);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 3);
- KeyPart keyPart2 = new KeyPart(".acompletea.complete.suffix");
+ KeyPart keyPart2 = new KeyPart(".acompletea.complete.suffix", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals('f', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart3));
@@ -1657,33 +1657,33 @@
{
// aa
KeyPart keyPart12 = new KeyPart("prefix.pattern.very.long.key.filled." +
- "with.several.different.elements.a.complete.suffix");
+ "with.several.different.elements.a.complete.suffix", '.');
KeyPart keyPart11 = keyPart12.extractPrefixPart(9, 7);
- KeyPart keyPart13 = new KeyPart(".diffa.complete.suffix");
+ KeyPart keyPart13 = new KeyPart(".diffa.complete.suffix", '.');
keyPart11.newSuffix(keyPart13);
KeyPart keyPart9 = keyPart11.extractPrefixPart(8, 8);
- KeyPart keyPart10 = new KeyPart("a.acomplete.a.complete.suffix");
+ KeyPart keyPart10 = new KeyPart("a.acomplete.a.complete.suffix", '.');
keyPart9.newSuffix(keyPart10);
KeyPart keyPart7 = keyPart9.extractPrefixPart(6, 0);
- KeyPart keyPart8 = new KeyPart("a.mismatch.suffix");
+ KeyPart keyPart8 = new KeyPart("a.mismatch.suffix", '.');
keyPart7.newSuffix(keyPart8);
KeyPart keyPart3 = keyPart7.extractPrefixPart(3, 1);
KeyPart keyPart4 = new KeyPart("loooooooooooooooooooong.key.longer.than" +
- ".the.others.in.the.tree.but.still.ending.with.a.complete.suffix");
+ ".the.others.in.the.tree.but.still.ending.with.a.complete.suffix", '.');
keyPart3.newSuffix(keyPart4);
KeyPart keyPart5 = new KeyPart("dont.think.this.key.will.take.you.to.a." +
- "positive.match");
+ "positive.match", '.');
keyPart3.newSuffix(keyPart5);
KeyPart keyPart6 = new KeyPart("continuing.prefix.pattern.very.long." +
- "key.ending.witha.complete.suffix");
+ "key.ending.witha.complete.suffix", '.');
keyPart3.newSuffix(keyPart6);
KeyPart keyPart1 = keyPart3.extractPrefixPart(0, 6);
KeyPart keyPart2 = new KeyPart("not.starting.with.prefix.nor.ending." +
- "with.acomplete.suffix");
+ "with.acomplete.suffix", '.');
keyPart1.newSuffix(keyPart2);
// bb
- SearchKey searchKey = new SearchKey("*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("*a.complete.suffix", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -1725,98 +1725,98 @@
public void testCompleteSuffixNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpattera.complete.suffix");
+ KeyPart keyPart = new KeyPart("prefixpattera.complete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompleteSuffixNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatternacomplete.suffix");
+ KeyPart keyPart = new KeyPart("prefixpatternacomplete.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testCompleteSuffixNegative3()
{
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testCompleteSuffixNegative4()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix");
+ SearchKey searchKey = new SearchKey("prefix*pattern*a.complete.suffix", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpattern");
+ KeyPart keyPart = new KeyPart("prefixpattern", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatternsuffix");
+ KeyPart keyPart = new KeyPart("prefixpatternsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("prefixes.somepatterns.any.suffix");
+ KeyPart keyPart = new KeyPart("prefixes.somepatterns.any.suffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixOneTarget4()
{
// aa
- KeyPart keyPart = new KeyPart("prefixes.somepatterns");
+ KeyPart keyPart = new KeyPart("prefixes.somepatterns", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixBrokenTarget()
{
// aa
- KeyPart keyPart10 = new KeyPart("prefixpattern");
- KeyPart keyPart11 = new KeyPart("suffix");
+ KeyPart keyPart10 = new KeyPart("prefixpattern", '.');
+ KeyPart keyPart11 = new KeyPart("suffix", '.');
keyPart10.newSuffix(keyPart11);
KeyPart keyPart7 = keyPart10.extractPrefixPart(0, 13);
- KeyPart keyPart8 = new KeyPart("some.suffix");
+ KeyPart keyPart8 = new KeyPart("some.suffix", '.');
keyPart7.newSuffix(keyPart8);
- KeyPart keyPart9 = new KeyPart("anysuffix");
+ KeyPart keyPart9 = new KeyPart("anysuffix", '.');
keyPart7.newSuffix(keyPart9);
KeyPart keyPart4 = keyPart7.extractPrefixPart(0, 9);
- KeyPart keyPart5 = new KeyPart("pattern");
+ KeyPart keyPart5 = new KeyPart("pattern", '.');
keyPart4.newSuffix(keyPart5);
- KeyPart keyPart6 = new KeyPart(".anypatternendingwithanything");
+ KeyPart keyPart6 = new KeyPart(".anypatternendingwithanything", '.');
keyPart4.newSuffix(keyPart6);
KeyPart keyPart1 = keyPart4.extractPrefixPart(0, 0);
- KeyPart keyPart2 = new KeyPart("a.negative.match.key.part");
+ KeyPart keyPart2 = new KeyPart("a.negative.match.key.part", '.');
keyPart1.newSuffix(keyPart2);
- KeyPart keyPart3 = new KeyPart("another.negativematch");
+ KeyPart keyPart3 = new KeyPart("another.negativematch", '.');
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals('p', searchKey.matches(keyPart1));
assertEquals(Flags.ALL, searchKey.matches(keyPart4));
@@ -1847,43 +1847,43 @@
public void testEmptySuffixNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixsuffix");
+ KeyPart keyPart = new KeyPart("prefixsuffix", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixNegative2()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpatter.n");
+ KeyPart keyPart = new KeyPart("prefixpatter.n", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("prefipattern");
+ KeyPart keyPart = new KeyPart("prefipattern", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testEmptySuffixNegative4()
{
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testEmptySuffixNegative5()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("prefix*pattern*");
+ SearchKey searchKey = new SearchKey("prefix*pattern*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -1891,10 +1891,10 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "pre.fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x");
+ "pre.fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1902,10 +1902,10 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "pre.fi.x.pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x");
+ "pre.fi.x.pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1913,10 +1913,10 @@
{
// aa
KeyPart keyPart = new KeyPart("pre.fi.xsss.sss.sssspa.tt.er.n1sss.ssss." +
- "sssspa.tt.er.n2ssss.ssss.sssspa.tt.er.n3ssss.ssss.sssssuf.fi.x");
+ "sssspa.tt.er.n2ssss.ssss.sssspa.tt.er.n3ssss.ssss.sssssuf.fi.x", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1924,10 +1924,10 @@
{
// aa
KeyPart keyPart = new KeyPart(
- "pre.fi.xabcdpa.tt.er.n1abcdpa.tt.er.n2abcdpa.tt.er.n3abcdsuf.fi.x");
+ "pre.fi.xabcdpa.tt.er.n1abcdpa.tt.er.n2abcdpa.tt.er.n3abcdsuf.fi.x", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -1935,65 +1935,65 @@
{
// aa
KeyPart keyPart53 = new KeyPart(
- "pre.fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x");
+ "pre.fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x", '.');
KeyPart keyPart52 = keyPart53.extractPrefixPart(13, 0);
- keyPart52.newSuffix(new KeyPart("a"));
- keyPart52.newSuffix(new KeyPart("S"));
- keyPart52.newSuffix(new KeyPart("w"));
- keyPart52.newSuffix(new KeyPart("k"));
- keyPart52.newSuffix(new KeyPart("Q"));
+ keyPart52.newSuffix(new KeyPart("a", '.'));
+ keyPart52.newSuffix(new KeyPart("S", '.'));
+ keyPart52.newSuffix(new KeyPart("w", '.'));
+ keyPart52.newSuffix(new KeyPart("k", '.'));
+ keyPart52.newSuffix(new KeyPart("Q", '.'));
KeyPart keyPart51 = keyPart52.extractPrefixPart(12, 1);
- keyPart51.newSuffix(new KeyPart("a.b"));
- keyPart51.newSuffix(new KeyPart("c.d"));
- keyPart51.newSuffix(new KeyPart("e.f"));
+ keyPart51.newSuffix(new KeyPart("a.b", '.'));
+ keyPart51.newSuffix(new KeyPart("c.d", '.'));
+ keyPart51.newSuffix(new KeyPart("e.f", '.'));
KeyPart keyPart50 = keyPart51.extractPrefixPart(11, 0);
- keyPart50.newSuffix(new KeyPart("somea.bc.e"));
- keyPart50.newSuffix(new KeyPart("fghij.kl.m"));
- keyPart50.newSuffix(new KeyPart("opqrs.tu.v"));
+ keyPart50.newSuffix(new KeyPart("somea.bc.e", '.'));
+ keyPart50.newSuffix(new KeyPart("fghij.kl.m", '.'));
+ keyPart50.newSuffix(new KeyPart("opqrs.tu.v", '.'));
KeyPart keyPart49 = keyPart50.extractPrefixPart(9, 0);
- keyPart49.newSuffix(new KeyPart("ab.cd.efghi.jk.l"));
- keyPart49.newSuffix(new KeyPart("mn.op.qrstu.vw.x"));
+ keyPart49.newSuffix(new KeyPart("ab.cd.efghi.jk.l", '.'));
+ keyPart49.newSuffix(new KeyPart("mn.op.qrstu.vw.x", '.'));
KeyPart keyPart48 = keyPart49.extractPrefixPart(7, 0);
- keyPart48.newSuffix(new KeyPart("ab.cdef.gh.ij.klmno.pq.r"));
- keyPart48.newSuffix(new KeyPart("st.uvwx.yz.ab.cdefg.hi.j"));
+ keyPart48.newSuffix(new KeyPart("ab.cdef.gh.ij.klmno.pq.r", '.'));
+ keyPart48.newSuffix(new KeyPart("st.uvwx.yz.ab.cdefg.hi.j", '.'));
KeyPart keyPart47 = keyPart48.extractPrefixPart(5, 3);
- keyPart47.newSuffix(new KeyPart("b.cd.ef.ghij.kl.mn.opqrs.tu.v"));
- keyPart47.newSuffix(new KeyPart("w.xy.za.bcde.fg.hi.jklmn.op.q"));
+ keyPart47.newSuffix(new KeyPart("b.cd.ef.ghij.kl.mn.opqrs.tu.v", '.'));
+ keyPart47.newSuffix(new KeyPart("w.xy.za.bcde.fg.hi.jklmn.op.q", '.'));
KeyPart keyPart44 = keyPart47.extractPrefixPart(5, 1);
- KeyPart keyPart45 = new KeyPart("2pa.tt.er.n1pa.tt.er.n3suf.fi.x");
+ KeyPart keyPart45 = new KeyPart("2pa.tt.er.n1pa.tt.er.n3suf.fi.x", '.');
keyPart44.newSuffix(keyPart45);
KeyPart keyPart46 = new KeyPart(
- "3papapa.tt.er.npa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x");
+ "3papapa.tt.er.npa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x", '.');
keyPart44.newSuffix(keyPart46);
KeyPart keyPart4 = keyPart44.extractPrefixPart(2, 1);
KeyPart keyPart6 = new KeyPart(
- ".pa.tt.pa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x");
+ ".pa.tt.pa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x", '.');
KeyPart keyPart5 = keyPart6.extractPrefixPart(1, 0);
keyPart5.newSuffix(KeyPart.EMPTY_KEY_END);
keyPart4.newSuffix(keyPart5);
KeyPart keyPart43 = new KeyPart(
- "something.pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x");
+ "something.pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x", '.');
KeyPart keyPart42 = keyPart43.extractPrefixPart(15, 0);
- keyPart42.newSuffix(new KeyPart("b"));
- keyPart42.newSuffix(new KeyPart("defgh"));
- keyPart42.newSuffix(new KeyPart("zap"));
+ keyPart42.newSuffix(new KeyPart("b", '.'));
+ keyPart42.newSuffix(new KeyPart("defgh", '.'));
+ keyPart42.newSuffix(new KeyPart("zap", '.'));
KeyPart keyPart41 = keyPart42.extractPrefixPart(14, 1);
- keyPart41.newSuffix(new KeyPart("a.b"));
- keyPart41.newSuffix(new KeyPart("defgh.hijkl"));
+ keyPart41.newSuffix(new KeyPart("a.b", '.'));
+ keyPart41.newSuffix(new KeyPart("defgh.hijkl", '.'));
KeyPart keyPart37 = keyPart41.extractPrefixPart(13, 2);
- KeyPart keyPart38 = new KeyPart("abcdefgh.abc.abc");
+ KeyPart keyPart38 = new KeyPart("abcdefgh.abc.abc", '.');
keyPart37.newSuffix(keyPart38);
- KeyPart keyPart39 = new KeyPart("hello.worl.d");
+ KeyPart keyPart39 = new KeyPart("hello.worl.d", '.');
keyPart37.newSuffix(keyPart39);
- KeyPart keyPart40 = new KeyPart("s.ome.thing");
+ KeyPart keyPart40 = new KeyPart("s.ome.thing", '.');
keyPart37.newSuffix(keyPart40);
KeyPart keyPart34 = keyPart37.extractPrefixPart(9, 1);
- KeyPart keyPart35 = new KeyPart("pa.tt.er.n3suf.fi.x");
+ KeyPart keyPart35 = new KeyPart("pa.tt.er.n3suf.fi.x", '.');
keyPart34.newSuffix(keyPart35);
- KeyPart keyPart36 = new KeyPart("cdefghij.pa.tt.er.n3suf.fix");
+ KeyPart keyPart36 = new KeyPart("cdefghij.pa.tt.er.n3suf.fix", '.');
keyPart34.newSuffix(keyPart36);
KeyPart keyPart33 = keyPart34.extractPrefixPart(1, 0);
keyPart33.newSuffix(KeyPart.EMPTY_KEY_END);
@@ -2001,69 +2001,69 @@
keyPart4.newSuffix(keyPart33);
KeyPart keyPart32 = new KeyPart("apapapa.pa.tt.erpa.tt.er.n1papaapa.tt." +
- "er.n2.pa.tt.er.nn.pa.tt.er.n3suf.fi.x");
+ "er.n2.pa.tt.er.nn.pa.tt.er.n3suf.fi.x", '.');
KeyPart keyPart29 = keyPart32.extractPrefixPart(17, 1);
- KeyPart keyPart30 = new KeyPart("1pa.tt.er.n3.sue.suf.fi.x");
+ KeyPart keyPart30 = new KeyPart("1pa.tt.er.n3.sue.suf.fi.x", '.');
keyPart29.newSuffix(keyPart30);
- KeyPart keyPart31 = new KeyPart("2.suf.fi.x");
+ KeyPart keyPart31 = new KeyPart("2.suf.fi.x", '.');
keyPart29.newSuffix(keyPart31);
KeyPart keyPart25 = keyPart29.extractPrefixPart(15, 0);
- KeyPart keyPart26 = new KeyPart("pa.tt.er.n3suf.fi.x");
+ KeyPart keyPart26 = new KeyPart("pa.tt.er.n3suf.fi.x", '.');
keyPart26.newSuffix(KeyPart.EMPTY_KEY_END);
- KeyPart keyPart27 = new KeyPart("");
+ KeyPart keyPart27 = new KeyPart("", '.');
keyPart26.newSuffix(keyPart27);
- KeyPart keyPart28 = new KeyPart("abc");
+ KeyPart keyPart28 = new KeyPart("abc", '.');
keyPart26.newSuffix(keyPart28);
keyPart25.newSuffix(keyPart26);
KeyPart keyPart23 = keyPart25.extractPrefixPart(13, 1);
- KeyPart keyPart24 = new KeyPart("3suf.fi.x");
+ KeyPart keyPart24 = new KeyPart("3suf.fi.x", '.');
keyPart23.newSuffix(keyPart24);
KeyPart keyPart19 = keyPart23.extractPrefixPart(10, 2);
- KeyPart keyPart22 = new KeyPart("pa.tt.er.n3.abababa.suf.fi.x");
+ KeyPart keyPart22 = new KeyPart("pa.tt.er.n3.abababa.suf.fi.x", '.');
KeyPart keyPart20 = keyPart22.extractPrefixPart(3, 2);
- KeyPart keyPart21 = new KeyPart("suf.ab.c");
+ KeyPart keyPart21 = new KeyPart("suf.ab.c", '.');
keyPart20.newSuffix(keyPart21);
keyPart19.newSuffix(keyPart20);
KeyPart keyPart17 = keyPart19.extractPrefixPart(6, 4);
- KeyPart keyPart18 = new KeyPart(".tt.er.n2ABC.pa.tt.er.n3.ABCsuf.fi.x");
+ KeyPart keyPart18 = new KeyPart(".tt.er.n2ABC.pa.tt.er.n3.ABCsuf.fi.x", '.');
keyPart17.newSuffix(keyPart18);
KeyPart keyPart13 = keyPart17.extractPrefixPart(4, 0);
- KeyPart keyPart14 = new KeyPart("er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x");
+ KeyPart keyPart14 = new KeyPart("er.n1.pa.tt.er.n2.pa.tt.er.n3.suf.fi.x", '.');
keyPart13.newSuffix(keyPart14);
KeyPart keyPart15 = new KeyPart(
- "pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3suf.fi.x");
+ "pa.tt.er.n1.pa.tt.er.n2.pa.tt.er.n3suf.fi.x", '.');
keyPart13.newSuffix(keyPart15);
- KeyPart keyPart16 = new KeyPart("minimal.length.mismatch");
+ KeyPart keyPart16 = new KeyPart("minimal.length.mismatch", '.');
keyPart13.newSuffix(keyPart16);
KeyPart keyPart11 = keyPart13.extractPrefixPart(0, 5);
KeyPart keyPart12 = new KeyPart(
- ".tt.er.n1.pa.tt.er.n2pa.tt.er.n3.suf.fi.x");
+ ".tt.er.n1.pa.tt.er.n2pa.tt.er.n3.suf.fi.x", '.');
keyPart11.newSuffix(keyPart12);
KeyPart keyPart10 = keyPart11.extractPrefixPart(0, 3);
keyPart10.newSuffix(keyPart12);
KeyPart keyPart7 = keyPart10.extractPrefixPart(0, 2);
KeyPart keyPart9 = new KeyPart(
- ".pa.tt.er.n1pa.tt.er.n2pa.tt.er.n3.suf.fi.x");
+ ".pa.tt.er.n1pa.tt.er.n2pa.tt.er.n3.suf.fi.x", '.');
keyPart7.newSuffix(keyPart9);
- KeyPart keyPart8 = new KeyPart("apa.tt.er.n2.pa.tt.er.n3.suf.fi.x");
+ KeyPart keyPart8 = new KeyPart("apa.tt.er.n2.pa.tt.er.n3.suf.fi.x", '.');
keyPart7.newSuffix(keyPart8);
keyPart4.newSuffix(keyPart7);
KeyPart keyPart3 = keyPart4.extractPrefixPart(1, 2);
- keyPart3.newSuffix(new KeyPart("anything.el.se"));
+ keyPart3.newSuffix(new KeyPart("anything.el.se", '.'));
KeyPart keyPart2 = keyPart3.extractPrefixPart(0, 2);
keyPart2.newSuffix(new KeyPart(
- "fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x"));
+ "fi.xpa.tt.er.n1pa.tt.er.n2pa.tt.er.n3suf.fi.x", '.'));
KeyPart keyPart1 = keyPart2.extractPrefixPart(0, 0);
- keyPart1.newSuffix(new KeyPart("abc.def.ghi.jkl.mno.pqr.stu.vwx.yz"));
- keyPart1.newSuffix(new KeyPart("short.key"));
- keyPart1.newSuffix(new KeyPart("zyx.wvu.tsr.qpo.nml.kji.hgf.edc.ab"));
+ keyPart1.newSuffix(new KeyPart("abc.def.ghi.jkl.mno.pqr.stu.vwx.yz", '.'));
+ keyPart1.newSuffix(new KeyPart("short.key", '.'));
+ keyPart1.newSuffix(new KeyPart("zyx.wvu.tsr.qpo.nml.kji.hgf.edc.ab", '.'));
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals('p', searchKey.matches(keyPart1));
assertEquals('e', searchKey.matches(keyPart2));
@@ -2213,10 +2213,10 @@
public void testCompleteExpressionNegative1()
{
// aa
- KeyPart keyPart = new KeyPart("prefixpattern1pattern2pattern3suffix");
+ KeyPart keyPart = new KeyPart("prefixpattern1pattern2pattern3suffix", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
@@ -2224,71 +2224,71 @@
{
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
public void testCompleteExpressionNegative3()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
SearchKey searchKey = new SearchKey(
- "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x");
+ "pre.fi.x*pa.tt.er.n1*pa.tt.er.n2*pa.tt.er.n3*suf.fi.x", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget1()
{
// aa
- KeyPart keyPart = new KeyPart("anything");
+ KeyPart keyPart = new KeyPart("anything", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget2()
{
// aa
- KeyPart keyPart = new KeyPart("somethingelse");
+ KeyPart keyPart = new KeyPart("somethingelse", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget3()
{
// aa
- KeyPart keyPart = new KeyPart("a");
+ KeyPart keyPart = new KeyPart("a", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget4()
{
// aa
- KeyPart keyPart = new KeyPart("more.than.one.element");
+ KeyPart keyPart = new KeyPart("more.than.one.element", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget5()
{
// aa
- KeyPart keyPart = new KeyPart("two.elements");
+ KeyPart keyPart = new KeyPart("two.elements", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
public void testWildcardOneTarget6()
{
// aa
- KeyPart keyPart = new KeyPart("");
+ KeyPart keyPart = new KeyPart("", '.');
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.POSITIVE, searchKey.matches(keyPart));
}
@@ -2296,28 +2296,28 @@
{
// aa
KeyPart keyPart10 = new KeyPart(
- "abcd.efgh.abcd.efgh.ijklm.nopqrst.uvwxyz");
+ "abcd.efgh.abcd.efgh.ijklm.nopqrst.uvwxyz", '.');
KeyPart keyPart7 = keyPart10.extractPrefixPart(5, 5);
- KeyPart keyPart8 = new KeyPart("");
+ KeyPart keyPart8 = new KeyPart("", '.');
keyPart7.newSuffix(keyPart8);
- KeyPart keyPart9 = new KeyPart("a.b.c");
+ KeyPart keyPart9 = new KeyPart("a.b.c", '.');
keyPart7.newSuffix(keyPart9);
KeyPart keyPart4 = keyPart7.extractPrefixPart(3, 0);
keyPart4.newSuffix(KeyPart.EMPTY_KEY_END);
KeyPart keyPart5 = new KeyPart(
- "a.really.re.a.lly.long.k.e.y.longer.than.the.others");
+ "a.really.re.a.lly.long.k.e.y.longer.than.the.others", '.');
keyPart4.newSuffix(keyPart5);
- KeyPart keyPart6 = new KeyPart("x");
+ KeyPart keyPart6 = new KeyPart("x", '.');
keyPart4.newSuffix(keyPart6);
KeyPart keyPart1 = keyPart4.extractPrefixPart(0, 0);
- KeyPart keyPart2 = new KeyPart("different.key");
+ KeyPart keyPart2 = new KeyPart("different.key", '.');
keyPart1.newSuffix(keyPart2);
- KeyPart keyPart3 = new KeyPart("uvw.x.y.z");
+ KeyPart keyPart3 = new KeyPart("uvw.x.y.z", '.');
keyPart1.newSuffix(keyPart3);
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.ALL, searchKey.matches(keyPart1));
@@ -2352,7 +2352,7 @@
public void testWildcardNegative()
{
// bb
- SearchKey searchKey = new SearchKey("*");
+ SearchKey searchKey = new SearchKey("*", '.');
assertEquals(Flags.NEGATIVE, searchKey.matches(KeyPart.EMPTY_KEY_END));
}
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactoryTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactoryTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/element/ComparableElementFactoryTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -41,7 +41,7 @@
public void setUp()
{
- factory = ComparableElementFactory.getInstance();
+ factory = ComparableElementFactory.getInstance('.');
}
public void testSeparator()
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithmTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithmTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonAlgorithmTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -55,7 +55,7 @@
comparableIndex = new Index();
targetIndex = new Index();
// create comparables
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
factory.startCreation();
comparable = factory.create("abcabca", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndStateTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndStateTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonEndStateTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -52,12 +52,13 @@
{
compEndStateField = MatchingState.class.getDeclaredField(
"comparisonEndState");
+ compEndStateField.setAccessible(true);
matchingState = new MatchingState();
targetIndex = new Index();
targetIndex.increment(1);
targetLengthRange = new LengthRange((byte) 3, (byte) 20, (byte) 30);
// create comparable
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
factory.startCreation();
comparable = factory.create("abcabca", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartStateTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartStateTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartStateTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -54,6 +54,7 @@
{
compStartStateField = MatchingState.class.getDeclaredField(
"comparisonStartState");
+ compStartStateField.setAccessible(true);
matchingState = new MatchingState();
currentTargetIndex = new Index();
currentTargetIndex.increment(1);
@@ -63,7 +64,7 @@
nextSuffixesIndex.increment(10);
targetLengthRange = new LengthRange((byte) 3, (byte) 20, (byte) 30);
// create comparable
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
factory.startCreation();
comparable = factory.create("abcabca", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStartTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -49,7 +49,7 @@
comparableIndex = new Index();
targetIndex = new Index();
// create comparable
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
factory.startCreation();
comparable = factory.create("abcabca", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/LengthRestrictionTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/LengthRestrictionTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/LengthRestrictionTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -45,7 +45,7 @@
{
comparableIndex = new Index();
targetIndex = new Index();
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.SIMPLE);
factory.startCreation();
comparable = factory.create("element", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactoryTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactoryTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactoryTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -251,7 +251,8 @@
public void startCreation() { }
public void stopCreation() { }
- public Comparable create(String exp, MatcherProfile profile)
+ public Comparable create(String exp, MatcherProfile profile,
+ char... internalSeparator)
{
Comparable comparable = new ComparableImpl(exp, profile);
created.add(comparable);
@@ -277,6 +278,8 @@
}
public int getLength() {return 0; }
+ public boolean isOutOfBounds(Index index) {return false;}
+ public boolean isEmpty() {return false;}
public int getPostPrefixLength() { return 0; }
public void saveState(Object comparisonState) {}
public void rollbackState(Object comparisonState) {}
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -55,12 +55,12 @@
MatcherSequenceProfile seqProfile = new MatcherSequenceProfile(
MatcherProfile.PREFIX, MatcherProfile.SIMPLE,
MatcherProfile.SUFFIX, null, MatcherProfile.PATTERN);
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
matcherSequence = MatcherFactory.createSequence(
"any.matchable.expression.toCompare", factory, seqProfile);
patternMatcherSequence = MatcherFactory.createSequence("uniqueElement",
- ComparableElementFactory.getInstance(), seqProfile);
+ ComparableElementFactory.getInstance('.'), seqProfile);
suffixMatcherSequence = MatcherFactory.createSequence("toCompare",
factory, new MatcherSequenceProfile(MatcherProfile.SUFFIX,
MatcherProfile.SUFFIX, MatcherProfile.SUFFIX, null, MatcherProfile.SUFFIX));
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingStateTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingStateTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingStateTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -58,7 +58,7 @@
comparableIndex = new ExtendedIndex();
targetIndex = new ExtendedIndex();
// create comparable
- ComparableElementFactory factory = ComparableElementFactory.getInstance();
+ ComparableElementFactory factory = ComparableElementFactory.getInstance('.');
factory.performCreationForProfile(MatcherProfile.PATTERN);
factory.startCreation();
comparable = factory.create("abcabca", null);
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactoryTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactoryTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactoryTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -45,13 +45,13 @@
factory.startCreation();
ComparableKeyPart keyPart1 = (ComparableKeyPart) factory.create(
- "an.expression", MatcherProfile.PATTERN);
+ "an.expression", MatcherProfile.PATTERN, '.');
assertNotNull(keyPart1);
assertEquals(2, keyPart1.getLength());
assertEquals(2, keyPart1.postPrefixLength);
ComparableKeyPart keyPart2 = (ComparableKeyPart) factory.create(
- "that.is.a.", MatcherProfile.SIMPLE);
+ "that.is.a.", MatcherProfile.SIMPLE, '.');
assertNotNull(keyPart2);
assertEquals(4, keyPart2.getLength());
assertEquals(5, keyPart1.postPrefixLength);
@@ -59,7 +59,7 @@
ComparableKeyPart keyPart3 = (ComparableKeyPart) factory.create(
- "little.bit", MatcherProfile.PREFIX);
+ "little.bit", MatcherProfile.PREFIX, '.');
assertNotNull(keyPart3);
assertEquals(2, keyPart3.getLength());
assertEquals(6, keyPart1.postPrefixLength);
@@ -67,7 +67,7 @@
assertEquals(2, keyPart3.postPrefixLength);
ComparableKeyPart keyPart4 = (ComparableKeyPart) factory.create(
- ".long", MatcherProfile.SUFFIX);
+ ".long", MatcherProfile.SUFFIX, '.');
assertNotNull(keyPart4);
assertEquals(2, keyPart4.getLength());
assertEquals(7, keyPart1.postPrefixLength);
@@ -79,7 +79,7 @@
factory.startCreation();
ComparableKeyPart keyPart5 = (ComparableKeyPart) factory.create(
- "another.different.expresion", MatcherProfile.SIMPLE);
+ "another.different.expresion", MatcherProfile.SIMPLE, '.');
assertNotNull(keyPart5);
assertEquals(3, keyPart5.postPrefixLength);
// assert lengths of previous key are unchanged
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPatternTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPatternTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPatternTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -36,6 +36,11 @@
*/
public class ComparableKeyPartPatternTest extends ComparableKeyPartTest
{
+ protected char getEndOfMatchingChar()
+ {
+ return Flags.ALL;
+ }
+
protected MatcherProfile getProfile()
{
return MatcherProfile.PATTERN;
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPrefixTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPrefixTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartPrefixTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -45,7 +45,7 @@
*/
public void testEmptyNextCharacter()
{
- KeyPart target = new KeyPart("");
+ KeyPart target = new KeyPart("", '.');
assertEquals(Flags.ALL, emptyKeyPart.getNextCharacter(comparableIndex,
target, target.getLengthRange(), state));
comparableIndex.getElementIndex().increment();
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartSimpleTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartSimpleTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartSimpleTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -22,7 +22,6 @@
package org.jboss.aop.joinpoint.graph.tree.search.part;
import org.jboss.aop.joinpoint.graph.tree.KeyPart;
-import org.jboss.aop.joinpoint.graph.tree.search.Flags;
import org.jboss.aop.joinpoint.graph.tree.search.match.ComparisonResult;
import org.jboss.aop.joinpoint.graph.tree.search.match.MatcherProfile;
@@ -60,7 +59,7 @@
assertEquals(0, comparableIndex.getElementIndex().getValue());
assertEquals(0, targetIndex.getValue());
assertEquals(0, targetIndex.getElementIndex().getValue());
- assertEquals(Flags.ALL, emptyKeyPart.getNextCharacter(
+ assertEquals(KeyPart.KEY_ELEMENT_END, emptyKeyPart.getNextCharacter(
comparableIndex, target, target.getLengthRange(), state));
}
@@ -104,7 +103,7 @@
assertEquals(0, comparableIndex.getElementIndex().getValue());
assertEquals(0, targetIndex.getValue());
assertEquals(0, targetIndex.getElementIndex().getValue());
- assertEquals(Flags.ALL, emptyKeyPart.getNextCharacter(
+ assertEquals(KeyPart.KEY_ELEMENT_END, emptyKeyPart.getNextCharacter(
comparableIndex, target, target.getLengthRange(), state));
}
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartTest.java 2008-07-15 04:46:20 UTC (rev 75820)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartTest.java 2008-07-15 04:51:09 UTC (rev 75821)
@@ -21,15 +21,13 @@
*/
package org.jboss.aop.joinpoint.graph.tree.search.part;
+import junit.framework.TestCase;
+
import org.jboss.aop.joinpoint.graph.tree.KeyPart;
import org.jboss.aop.joinpoint.graph.tree.search.match.ComparisonResult;
import org.jboss.aop.joinpoint.graph.tree.search.match.MatcherProfile;
import org.jboss.aop.joinpoint.graph.tree.search.match.MatchingState;
-import org.jboss.aop.joinpoint.graph.tree.search.part.ComparableKeyPart;
-import org.jboss.aop.joinpoint.graph.tree.search.part.KeyPartIndex;
-import junit.framework.TestCase;
-
/**
* Abstract test of the {@link ComparableKeyPart} class.
* <p>
@@ -55,11 +53,11 @@
*/
public void setUp()
{
- emptyKeyPart = new ComparableKeyPart("", getProfile());
+ emptyKeyPart = new ComparableKeyPart("", getProfile(), '.');
oneElExpression = "oneElementExpression";
expression = "more.than.one.element";
- oneElKeyPart = new ComparableKeyPart(oneElExpression, getProfile());
- keyPart = new ComparableKeyPart(expression, getProfile());
+ oneElKeyPart = new ComparableKeyPart(oneElExpression, getProfile(), '.');
+ keyPart = new ComparableKeyPart(expression, getProfile(), '.');
comparableIndex = new KeyPartIndex();
targetIndex = new KeyPartIndex();
state = new MatchingState();
@@ -79,7 +77,7 @@
*/
public void testOneElNextCharacter()
{
- KeyPart keyPart = new KeyPart(oneElExpression);
+ KeyPart keyPart = new KeyPart(oneElExpression, '.');
KeyPart target = keyPart.extractPrefixPart(0, 0);
for (int i = 0; i < 20; i++)
{
@@ -101,7 +99,7 @@
*/
public void testNextCharacter()
{
- KeyPart targetKeyPart = new KeyPart(expression);
+ KeyPart targetKeyPart = new KeyPart(expression, '.');
KeyPart target = targetKeyPart.extractPrefixPart(0, 0);
int count = 0;
for (int i = 0; i < keyPart.getLength(); i++)
@@ -130,7 +128,7 @@
public void testEmptyKeyPartSameTarget()
{
- KeyPart target = new KeyPart("");
+ KeyPart target = new KeyPart("", '.');
ComparisonResult result = emptyKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertEmptyKeyPartSameTarget(target, result);
@@ -151,7 +149,7 @@
public void testEmptyKeyPartNonEmptyTarget1()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
ComparisonResult result = emptyKeyPart.compare(target,
targetIndex, comparableIndex, state);
assertEmptyKeyPartNonEmptyTarget1(target, result);
@@ -162,7 +160,7 @@
public void testEmptyKeyPartNonEmptyTarget2()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
ComparisonResult result = emptyKeyPart.compare(target,
targetIndex, comparableIndex, state);
assertEmptyKeyPartNonEmptyTarget2(target, result);
@@ -197,7 +195,7 @@
public void testOneElSameTarget()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSameTarget(target, result);
@@ -208,7 +206,7 @@
public void testOneElSameTargetIncIndex()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
comparableIndex.getElementIndex().increment(3);
targetIndex.getElementIndex().increment(3);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
@@ -221,7 +219,7 @@
public void testOneElSameTargetDiffIndex1()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
targetIndex.increment();
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -233,7 +231,7 @@
public void testOneElSameTargetDiffIndex2()
{
- KeyPart target = new KeyPart(oneElExpression + "." + oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression + "." + oneElExpression, '.');
targetIndex.increment();
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -245,7 +243,7 @@
public void testOneElSameTargetDiffIndex3()
{
- KeyPart target = new KeyPart(oneElExpression + "." + oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression + "." + oneElExpression, '.');
comparableIndex.getElementIndex().increment();
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -257,7 +255,7 @@
public void testOneElSameTargetIncomplete()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
target = target.extractPrefixPart(0, 4);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -269,7 +267,7 @@
public void testOneElSamePrefix()
{
- KeyPart target = new KeyPart(oneElExpression + ".anysuffix");
+ KeyPart target = new KeyPart(oneElExpression + ".anysuffix", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSamePrefix(target, result);
@@ -280,7 +278,7 @@
public void testOneElSamePrefixIncomplete()
{
- KeyPart target = new KeyPart(oneElExpression + ".any.suffix");
+ KeyPart target = new KeyPart(oneElExpression + ".any.suffix", '.');
target = target.extractPrefixPart(0, 5);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -293,7 +291,7 @@
public void testOneElSamePrefixIncIndexes()
{
KeyPart target = new KeyPart("anything.any" + oneElExpression +
- ".suffix");
+ ".suffix", '.');
targetIndex.increment();
targetIndex.getElementIndex().increment(4);
comparableIndex.getElementIndex().increment();
@@ -307,7 +305,7 @@
public void testOneElSamePrefixDiffLength()
{
- KeyPart target = new KeyPart(oneElExpression + "suffix");
+ KeyPart target = new KeyPart(oneElExpression + "suffix", '.');
target = target.extractPrefixPart(0, 6);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -319,7 +317,7 @@
public void testOneElSamePattern1()
{
- KeyPart target = new KeyPart("anyprefix" + oneElExpression + "suffix");
+ KeyPart target = new KeyPart("anyprefix" + oneElExpression + "suffix", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSamePattern1(target, result);
@@ -330,7 +328,7 @@
public void testOneElSamePattern2()
{
- KeyPart target = new KeyPart("oneEleoneElemoneElementElementoneElement");
+ KeyPart target = new KeyPart("oneEleoneElemoneElementElementoneElement", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSamePattern2(target, result);
@@ -342,7 +340,7 @@
public void testOneElSamePattern3()
{
KeyPart target = new KeyPart(
- "oneElemoneElementExpressiooneElementExpressionelem");
+ "oneElemoneElementExpressiooneElementExpressionelem", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSamePattern3(target, result);
@@ -354,7 +352,7 @@
public void testOneElSamePatternIncomplete1()
{
KeyPart target = new KeyPart("oneElemoneElementExpressio" +
- oneElExpression);
+ oneElExpression, '.');
target = target.extractPrefixPart(0, 15);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -366,7 +364,7 @@
public void testOneElSamePatternIncomplete2()
{
- KeyPart target = new KeyPart("anyprefix" + oneElExpression + "suffix");
+ KeyPart target = new KeyPart("anyprefix" + oneElExpression + "suffix", '.');
target = target.extractPrefixPart(0, 11);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -378,7 +376,7 @@
public void testOneElSamePatternIncIndexes()
{
- KeyPart target = new KeyPart("any.prefix" + oneElExpression + "suffix");
+ KeyPart target = new KeyPart("any.prefix" + oneElExpression + "suffix", '.');
targetIndex.increment(1);
targetIndex.getElementIndex().increment(2);
comparableIndex.getElementIndex().increment(3);
@@ -392,7 +390,7 @@
public void testOneElSameSuffix1()
{
- KeyPart target = new KeyPart("anyPrefix" + oneElExpression);
+ KeyPart target = new KeyPart("anyPrefix" + oneElExpression, '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSameSuffix1(target, result);
@@ -404,7 +402,7 @@
public void testOneElSameSuffix2()
{
KeyPart target = new KeyPart("anyPrefix" + oneElExpression +
- ".anySuffix");
+ ".anySuffix", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSameSuffix2(target, result);
@@ -416,7 +414,7 @@
public void testOneElSameSuffix3()
{
KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression +
- ".anySuffix");
+ ".anySuffix", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElSameSuffix3(target, result);
@@ -427,7 +425,7 @@
public void testOneElSameSuffixIncomplete1()
{
- KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression);
+ KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression, '.');
target = target.extractPrefixPart(0, 0);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -439,7 +437,7 @@
public void testOneElSameSuffixIncomplete2()
{
- KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression);
+ KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression, '.');
target = target.extractPrefixPart(0, 20);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -451,7 +449,7 @@
public void testOneElSameSuffixIncIndex1()
{
- KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression);
+ KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression, '.');
targetIndex.getElementIndex().increment(9);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -463,7 +461,7 @@
public void testOneElSameSuffixIncIndex2()
{
- KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression);
+ KeyPart target = new KeyPart("oneononononeEleone" + oneElExpression, '.');
targetIndex.getElementIndex().increment(22);
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -475,7 +473,7 @@
public void testOneElMismatch1()
{
- KeyPart target = new KeyPart("oneElementExppession");
+ KeyPart target = new KeyPart("oneElementExppession", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElMismatch1(result);
@@ -485,7 +483,7 @@
public void testOneElMismatch2()
{
- KeyPart target = new KeyPart("oneEleoneElemoneElementExpressiononon");
+ KeyPart target = new KeyPart("oneEleoneElemoneElementExpressiononon", '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElMismatch2(result);
@@ -495,7 +493,7 @@
public void testOneElMismatch3()
{
- KeyPart target = new KeyPart(oneElExpression + oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression + oneElExpression, '.');
ComparisonResult result = oneElKeyPart.compare(target, targetIndex,
comparableIndex, state);
assertOneElMismatch3(target, result);
@@ -506,7 +504,7 @@
public void testSameTarget()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSameTarget(target, result);
@@ -517,7 +515,7 @@
public void testSameTargetIncIndex1()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
comparableIndex.increment(2);
targetIndex.increment(2);
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -530,7 +528,7 @@
public void testSameTargetIncIndex2()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
comparableIndex.getElementIndex().increment(2);
targetIndex.getElementIndex().increment(2);
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -543,7 +541,7 @@
public void testSameTargetIncIndex3()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
target.getKeyElements()[0] = target.getKeyElements()[0].substring(1);
comparableIndex.getElementIndex().increment();
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -557,7 +555,7 @@
public void testSameTargetDiffIndex1()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
targetIndex.increment(4);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -569,7 +567,7 @@
public void testSameTargetDiffIndex2()
{
- KeyPart target = new KeyPart(expression + "." + expression);
+ KeyPart target = new KeyPart(expression + "." + expression, '.');
targetIndex.increment(4);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -583,7 +581,7 @@
{
targetIndex.increment(3);
comparableIndex.getElementIndex().increment();
- KeyPart target = new KeyPart(expression + "." + expression);
+ KeyPart target = new KeyPart(expression + "." + expression, '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSameTargetDiffIndex3(target, result);
@@ -594,7 +592,7 @@
public void testSameTargetIncomplete1()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
target = target.extractPrefixPart(1, 1);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -606,7 +604,7 @@
public void testSameTargetIncomplete2()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
target = target.extractPrefixPart(2, 3);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -618,7 +616,7 @@
public void testSameTargetIncomplete3()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
target = target.extractPrefixPart(3, 0);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -630,7 +628,7 @@
public void testSamePrefix()
{
- KeyPart target = new KeyPart(expression + ".any.suffix");
+ KeyPart target = new KeyPart(expression + ".any.suffix", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSamePrefix(target, result);
@@ -641,7 +639,7 @@
public void testSamePrefixIncomplete()
{
- KeyPart target = new KeyPart(expression + ".any.suffix");
+ KeyPart target = new KeyPart(expression + ".any.suffix", '.');
target = target.extractPrefixPart(4, 1);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -654,7 +652,7 @@
public void testSamePrefixIncIndexes()
{
KeyPart target = new KeyPart("something.to.ignore" + expression +
- ".suffix");
+ ".suffix", '.');
targetIndex.increment(2);
targetIndex.getElementIndex().increment(7);
comparableIndex.getElementIndex().increment();
@@ -668,7 +666,7 @@
public void testSamePrefixDiffLength1()
{
- KeyPart target = new KeyPart(expression +"suffix");
+ KeyPart target = new KeyPart(expression +"suffix", '.');
target = target.extractPrefixPart(3, 4);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -681,7 +679,7 @@
public void testSamePrefixDiffLength2()
{
- KeyPart target = new KeyPart(expression +"suffix");
+ KeyPart target = new KeyPart(expression +"suffix", '.');
target = target.extractPrefixPart(3, 7);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -693,7 +691,7 @@
public void testSamePattern1()
{
- KeyPart target = new KeyPart("anyprefix" + expression + "suffix");
+ KeyPart target = new KeyPart("anyprefix" + expression + "suffix", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSamePattern1(target, result);
@@ -704,7 +702,7 @@
public void testSamePattern2()
{
- KeyPart target = new KeyPart("anyprefix." + expression + ".suffix");
+ KeyPart target = new KeyPart("anyprefix." + expression + ".suffix", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSamePattern2(target, result);
@@ -715,7 +713,7 @@
public void testSamePattern3()
{
- KeyPart target = new KeyPart("mormormore.than.one.elementelemore");
+ KeyPart target = new KeyPart("mormormore.than.one.elementelemore", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSamePattern3(target, result);
@@ -726,7 +724,7 @@
public void testSamePatternIncomplete1()
{
- KeyPart target = new KeyPart("more.than.one.elemore.than.one.el");
+ KeyPart target = new KeyPart("more.than.one.elemore.than.one.el", '.');
target = target.extractPrefixPart(2, 3);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -738,7 +736,7 @@
public void testSamePatternIncomplete2()
{
- KeyPart target = new KeyPart("anyprefix" + expression + "suffix");
+ KeyPart target = new KeyPart("anyprefix" + expression + "suffix", '.');
target = target.extractPrefixPart(1, 1);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -750,7 +748,7 @@
public void testSamePatternIncIndexes1()
{
- KeyPart target = new KeyPart("any.prefix" + expression + "suffix");
+ KeyPart target = new KeyPart("any.prefix" + expression + "suffix", '.');
targetIndex.increment();
targetIndex.getElementIndex().increment(4);
comparableIndex.getElementIndex().increment();
@@ -764,7 +762,7 @@
public void testSamePatternIncIndexes2()
{
- KeyPart target = new KeyPart("any.prefix" + expression + "suffix");
+ KeyPart target = new KeyPart("any.prefix" + expression + "suffix", '.');
targetIndex.increment(3);
comparableIndex.increment(2);
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -777,7 +775,7 @@
public void testSamePatternIncIndexes3()
{
- KeyPart target = new KeyPart("element_suffix");
+ KeyPart target = new KeyPart("element_suffix", '.');
comparableIndex.increment(3);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -789,7 +787,7 @@
public void testSameSuffix1()
{
- KeyPart target = new KeyPart("anyPrefix" + expression);
+ KeyPart target = new KeyPart("anyPrefix" + expression, '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSameSuffix1(target, result);
@@ -800,7 +798,7 @@
public void testSameSuffix2()
{
- KeyPart target = new KeyPart("anyPrefix" + expression + ".anySuffix");
+ KeyPart target = new KeyPart("anyPrefix" + expression + ".anySuffix", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSameSuffix2(target, result);
@@ -811,7 +809,7 @@
public void testSameSuffix3()
{
- KeyPart target = new KeyPart("moromore" + expression + ".anySuffix");
+ KeyPart target = new KeyPart("moromore" + expression + ".anySuffix", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertSameSuffix3(target, result);
@@ -822,7 +820,7 @@
public void testSameSuffixIncomplete1()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
target = target.extractPrefixPart(3, 1);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -834,7 +832,7 @@
public void testSameSuffixIncomplete2()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
target = target.extractPrefixPart(3, 0);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -846,7 +844,7 @@
public void testSameSuffixIncomplete3()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
target = target.extractPrefixPart(0, 0);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -858,7 +856,7 @@
public void testSameSuffixIncomplete4()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
target = target.extractPrefixPart(0, 10);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -870,7 +868,7 @@
public void testSameSuffixIncIndex1()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
targetIndex.getElementIndex().increment(4);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -882,7 +880,7 @@
public void testSameSuffixIncIndex2()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
comparableIndex.increment(2);
targetIndex.increment(2);
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -895,7 +893,7 @@
public void testSameSuffixIncIndex3()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
comparableIndex.increment(3);
targetIndex.increment(3);
ComparisonResult result = keyPart.compare(target, targetIndex,
@@ -908,7 +906,7 @@
public void testMismatch1()
{
- KeyPart target = new KeyPart("same.number.of.elements");
+ KeyPart target = new KeyPart("same.number.of.elements", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertMismatch1(result);
@@ -918,7 +916,7 @@
public void testMismatch2()
{
- KeyPart target = new KeyPart("more.than.one.one.more.than.one.El");
+ KeyPart target = new KeyPart("more.than.one.one.more.than.one.El", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertMismatch2(result);
@@ -928,7 +926,7 @@
public void testMismatch3()
{
- KeyPart target = new KeyPart("moreaaa.than.one.one.more.than.one");
+ KeyPart target = new KeyPart("moreaaa.than.one.one.more.than.one", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertMismatch3(result);
@@ -939,7 +937,7 @@
public void testMismatch4()
{
KeyPart target = new KeyPart(
- "more.than.one.elemore.than.one.element.expresion");
+ "more.than.one.elemore.than.one.element.expresion", '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertMismatch4(result);
@@ -949,7 +947,7 @@
public void testMismatch5()
{
- KeyPart target = new KeyPart(expression);
+ KeyPart target = new KeyPart(expression, '.');
target.getKeyElements()[2] = target.getKeyElements()[2] + "suffix";
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -960,7 +958,7 @@
public void testMismatch6()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
targetIndex.getElementIndex().increment(9);
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
@@ -971,7 +969,7 @@
public void testMismatch7()
{
- KeyPart target = new KeyPart("moromore" + expression);
+ KeyPart target = new KeyPart("moromore" + expression, '.');
comparableIndex.increment(2);
comparableIndex.getElementIndex().increment();
targetIndex.increment(2);
@@ -984,7 +982,7 @@
public void testMismatch8()
{
- KeyPart target = new KeyPart(oneElExpression);
+ KeyPart target = new KeyPart(oneElExpression, '.');
ComparisonResult result = keyPart.compare(target, targetIndex,
comparableIndex, state);
assertMismatch8(result);
More information about the jboss-cvs-commits
mailing list