[jboss-cvs] JBossAS SVN: r68921 - in projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree: search/common and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 12 09:09:46 EST 2008


Author: flavia.rainone at jboss.com
Date: 2008-01-12 09:09:46 -0500 (Sat, 12 Jan 2008)
New Revision: 68921

Modified:
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/ExtendedLengthRange.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/InternalNode.java
   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/LeafNode.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Node.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/search/common/PrefixFunctionLoader.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/ComparisonStart.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/MatchingState.java
   projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java
Log:
[JBAOP-503] Minior adjustments

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/ExtendedLengthRange.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/ExtendedLengthRange.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/ExtendedLengthRange.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -33,7 +33,7 @@
  * not only the key part has suffixes, as the last element also has. These
  * suffixes are the first element of the key part suffixes. In such case, the
  * key part needs to store its length range info and the length range info of
- * its last element. So, this class is used by key part when its last element is
+ * its last element. This class is used by key part when its last element is
  * incomplete.
  * 
  * @author Flavia Rainone

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/InternalNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/InternalNode.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/InternalNode.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -84,7 +84,6 @@
    public void search(Collection<E> result, SearchKey searchKey)
    {
       char nextChar = searchKey.matches(super.keyPart);
-      //Collection result = new ArrayList();
       if (nextChar == Flags.ALL)
       {
          Object[] all = children.getAllContents();
@@ -92,11 +91,7 @@
          for (int i = 0; i < all.length; i++)
          {
             searchKey.prepareWildcardInstance(wildcardSearchKey);
-            // TODO refazer isso... força a criação de várias coleções...
-            // sugestão: colocar em Tree uma coleção e passá-la como
-            // argumento para os métodos search... uma coleção que pertence
-            // à Tree e que será sempre resetada, e não recriada.
-            /*result.addAll(*/((Node<E>) all[i]).search(result, wildcardSearchKey)/*)*/;
+            ((Node<E>) all[i]).search(result, wildcardSearchKey);
          }
       }
       else if (nextChar != Flags.POSITIVE && nextChar != Flags.NEGATIVE)

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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/KeyPart.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -88,7 +88,7 @@
    public KeyPart(String keyPartExpression)
    {
       // splits the key into keyElements
-      Collection keyElements = new ArrayList();
+      Collection<String> keyElements = new ArrayList<String>();
       // split element
       int begin = 0;
       int end = keyPartExpression.indexOf('.');
@@ -272,7 +272,6 @@
          return new KeyPart(new String[]{""}, false, this);
       }
       String[] oldKeyElements = keyElements;
-      boolean oldLastElementComplete = lastElementComplete;
       String[] extractedKeyElements = (elementChar == 0)?
             new String[element]: new String[element + 1];;
       boolean extractedLastElementComplete;

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/LeafNode.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/LeafNode.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/LeafNode.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -71,7 +71,7 @@
       if (insertionKey.getNextChar() != InsertionKey.INSERTION_COMPLETE)
       {
          // creates a new leaf for the insertion key
-         Node leafNode = new LeafNode<E>(insertionKey.toKeyPart(), value);
+         Node<E> leafNode = new LeafNode<E>(insertionKey.toKeyPart(), value);
          // this leaf will contain only an empty key end
          KeyPart fatherKeyPart = this.keyPart;
          this.keyPart = KeyPart.EMPTY_KEY_END; // TODO this may generate more than one EMPTY KEY PART in a row... is this a problem?
@@ -88,12 +88,10 @@
    public void search(Collection<E> result, SearchKey searchKey)
    {
       char nextChar = searchKey.matches(super.keyPart);
-      //Collection result = new ArrayList();
       if (nextChar == Flags.POSITIVE)
       {
          result.add(value);
       }
-      //return result;
    }
    
    public String toString()

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Node.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Node.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Node.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -71,7 +71,7 @@
    }
    
    /**
-    * Insert <code>value</code> in the tree, identified by the key <code>
+    * Inserts <code>value</code> in the tree, identified by the key <code>
     * insertionKey</code>.
     * 
     * @param insertionKey the key that identifies <code>value</code>, provides

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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/Tree.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -79,6 +79,22 @@
     * @param searchKeyExpression element that defines the search; may contain
     *                            zero or more wildcards (<code>'*'</code>) to
     *                            indicate zero or more characters in the key.
+    * @param result a collection where all values matched by <code>
+    *         searchKeyExpresion</code> will be added
+    */
+   public void search(String searchKeyExpression, Collection<E> result)
+   {
+      SearchKey searchKey = new SearchKey(searchKeyExpression);
+      state.search(searchKey, result);
+   } 
+   
+   /**
+    * Searches for all values whose key matches the <code>
+    * searchKeyExpresion</code>.
+    * 
+    * @param searchKeyExpression element that defines the search; may contain
+    *                            zero or more wildcards (<code>'*'</code>) to
+    *                            indicate zero or more characters in the key.
     * @return a collection of all values whose key matches the <code>
     *         searchKeyExpresion</code> 
     */
@@ -127,6 +143,12 @@
        * @see Tree#search(String)
        */
       <E> Collection<E> search(SearchKey searchKey);
+      
+      /**
+       * Performs a search in the tree.
+       * @see Tree#search(String, Collection)
+       */
+      <E> void search(SearchKey searchKey, Collection<E> result);
    }
 
    /**
@@ -143,10 +165,13 @@
          state = new NotEmptyState();
          
       }
+      
       public <E> Collection<E> search(SearchKey searchKey)
       {
          return new ArrayList<E>();
       }
+      
+      public <E> void search(SearchKey searchKey, Collection<E> result) {}
    }   
 
    /**
@@ -161,6 +186,7 @@
       {
          root = root.insert(insertionKey, value);
       }
+      
       public <E> Collection<E> search(SearchKey searchKey)
       {
          //return root.search(searchKey);
@@ -168,6 +194,12 @@
     	  root.search(result, searchKey);
     	  return result;
       }
+      
+      public <E> void search(SearchKey searchKey, Collection<E> result)
+      {
+         //return root.search(searchKey);
+        root.search(result, searchKey);
+      }
    }
    
    public String toString()

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/common/PrefixFunctionLoader.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/common/PrefixFunctionLoader.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/common/PrefixFunctionLoader.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -115,7 +115,7 @@
    /**
     * Contains the elements of the pattern being loaded.
     */
-   protected final List elements = new ArrayList();
+   protected final List<String> elements = new ArrayList<String>();
    
 
    /**
@@ -185,7 +185,7 @@
       if (this.prefixFunction != null)
       {
          String[] elementArray = new String[elements.size()];
-         elementArray = (String[]) elements.toArray(elementArray);
+         elementArray = elements.toArray(elementArray);
          elements.clear();
          prefixFunction.initialize(elementArray, lastElementComplete);
       }

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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/Comparable.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -77,7 +77,7 @@
    /**
     * Returns the prefix function associated with this comparable.
     * <p>
-    * Is involked only when the matcher associated with this comparable has the
+    * Is invoked only when the matcher associated with this comparable has the
     * {@link MatcherProfile#PATTERN PATTERN} or the {@link MatcherProfile#SUFFIX
     * SUFFIX} profile.
     * 

Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStart.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStart.java	2008-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/ComparisonStart.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -51,7 +51,7 @@
    /**
     * Tight comparison start, increments the indexes until the number of
     * available comparable components and the minimum number of available target
-    * components become the same (the number of available components it the
+    * components become the same (the number of available components is the
     * number of components that still need to be compared and matched).
     * 
     * @see MatchingState#tightenComparison(Comparable, Index, int, Index)

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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatcherFactory.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -62,7 +62,7 @@
          ComparableFactory comparableFactory,
          MatcherSequenceProfile profile)
    {
-      Collection matchers = new ArrayList();
+      Collection<Matcher> matchers = new ArrayList<Matcher>();
       char separator = comparableFactory.getSeparator();
       int begin = 0;
       int end = matchableExpression.indexOf(separator);
@@ -105,6 +105,6 @@
       comparableFactory.stopCreation();
       // create and return sequence
       Matcher[] matcherArray = new Matcher[matchers.size()];
-      return (Matcher[]) matchers.toArray(matcherArray);
+      return matchers.toArray(matcherArray);
    }
 }
\ 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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/match/MatchingState.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -35,7 +35,7 @@
  * that the same state object is passed along to every comparable in the matcher
  * sequence, since this object is associated with the matching state. The
  * comparable is completely responsible for managing this state data. To
- * assigin a comparison state to the matching state, invoke the {@link
+ * assign a comparison state to the matching state, invoke the {@link
  * #MatchingState(State)} constructor instead of the default one.
  * 
  * @author Flavia Rainone
@@ -49,11 +49,6 @@
    private static final State DUMMY_STATE = new DummyState();
    
    /**
-    * The state value, answers to all methods in this class, since their
-    * behaviour is dependent on this value.
-    */
-   
-   /**
     * The comparison state, stores data relevant to comparables.
     */
    State comparisonState;

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-01-12 14:02:52 UTC (rev 68920)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/graph/tree/search/part/ComparableKeyPartFactory.java	2008-01-12 14:09:46 UTC (rev 68921)
@@ -62,14 +62,14 @@
    /**
     * Contains created <code>ComparableKeyPart</code> instances. 
     */
-   private Collection parts;
+   private Collection<ComparableKeyPart> parts;
    
    /**
     * Private constructor (singleton class).
     */
    private ComparableKeyPartFactory()
    {
-      parts = new ArrayList();
+      parts = new ArrayList<ComparableKeyPart>();
       matcherSeqProfile = new MatcherSequenceProfile(MatcherProfile.PREFIX,
             MatcherProfile.PATTERN, MatcherProfile.SUFFIX,
             MatcherProfile.SIMPLE);




More information about the jboss-cvs-commits mailing list