Update of /var/cvs/src/org/mmbase/framework
In directory james.mmbase.org:/tmp/cvs-serv31854/src/org/mmbase/framework

Modified Files:
        Block.java ComponentRepository.java 
Log Message:
Given variables a real name


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/framework


Index: Block.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/framework/Block.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- Block.java  23 Feb 2008 16:46:19 -0000      1.33
+++ Block.java  21 Mar 2008 09:26:33 -0000      1.34
@@ -21,7 +21,7 @@
  *
  * @author Johannes Verelst
  * @author Michiel Meeuwissen
- * @version $Id: Block.java,v 1.33 2008/02/23 16:46:19 michiel Exp $
+ * @version $Id: Block.java,v 1.34 2008/03/21 09:26:33 fpunt Exp $
  * @since MMBase-1.9
  */
 public class Block {
@@ -69,6 +69,7 @@
         return title;
     }
 
+
     /**
      * Mimetype for this block. E.g. "text/html".
      */
@@ -180,28 +181,30 @@
          */
         public static Type[] getClassification(String p, boolean create) {
             if (p == null || "".equals(p)) return new Type[] {NO};
-            List<Type> r = new ArrayList<Type>();
+            List<Type> result = new ArrayList<Type>();
             PARTS:
             for (String part : p.split("\\s*?[,\\s]\\s*")) {
-                Type t = ROOT;
-                for (String e : part.split("\\.")) {
-                    Type proposal = new Type(e, t);
-                    int i = t.subs.indexOf(proposal);
-                    if (i == -1) {
+                Type type = ROOT;
+                for (String subpart : part.split("\\.")) {
+                       int weight = 
subpart.contains(":")?Integer.parseInt(subpart.substring(subpart.indexOf(":")+1)):0;
+                       subpart = 
subpart.contains(":")?subpart.substring(0,subpart.indexOf(":")):subpart;
+                    Type proposal = new Type(subpart, type);
+                    int index = type.subs.indexOf(proposal);
+                    if (index == -1) {
                         if (create) {
-                            t.subs.add(proposal);
+                            type.subs.add(proposal);
                         } else {
                             continue PARTS;
                         }
                     } else {
-                        proposal = t.subs.get(i);
+                        proposal = type.subs.get(index);
                     }
-                    Collections.sort(t.subs);
-                    t = proposal;
+                    Collections.sort(type.subs);
+                    type = proposal;
                 }
-                r.add(t);
+                result.add(type);
             }
-            return r.toArray(new Type[] {});
+            return result.toArray(new Type[] {});
         }
 
         private final String name;


Index: ComponentRepository.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/framework/ComponentRepository.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- ComponentRepository.java    22 Feb 2008 14:30:35 -0000      1.30
+++ ComponentRepository.java    21 Mar 2008 09:26:33 -0000      1.31
@@ -23,7 +23,7 @@
  * This (singleton) class maintains all compoments which are registered in the 
current MMBase.
  *
  * @author Michiel Meeuwissen
- * @version $Id: ComponentRepository.java,v 1.30 2008/02/22 14:30:35 michiel 
Exp $
+ * @version $Id: ComponentRepository.java,v 1.31 2008/03/21 09:26:33 fpunt Exp 
$
  * @since MMBase-1.9
  */
 public class ComponentRepository {
@@ -191,5 +191,4 @@
         component.configure(doc.getDocumentElement());
         return component;
     }
-
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to