OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | gotm-commits List | August 2005 Index

<--  Date Index     <--  Thread Index  -->

CVS update of fractal-template/src/java/org/objectweb/fractal/lib (2 files)


    Date: Thursday, August 25, 2005 @ 16:14:05
  Author: rouvoy
    Path: /cvsroot/gotm/fractal-template/src/java/org/objectweb/fractal/lib

Modified: FcCollection.java
 Removed: FcCollectionIterator.java

* removing deprecated FcCollectionIterator class.
* improving FcCollection feeding algorithm.
* cosmetic updates.


---------------------------+
 FcCollection.java         |   20 +---
 FcCollectionIterator.java |  177 --------------------------------------------
 2 files changed, 8 insertions(+), 189 deletions(-)


Index: fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java
diff -u 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java:1.1 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java:1.2
--- fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java:1.1 
  Fri Aug 12 14:23:54 2005
+++ fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java     
  Thu Aug 25 16:14:05 2005
@@ -23,22 +23,19 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: FcCollection.java,v 1.1 2005/08/12 12:23:54 rouvoy Exp $
+$Id: FcCollection.java,v 1.2 2005/08/25 14:14:05 rouvoy Exp $
 ====================================================================*/
 package org.objectweb.fractal.lib;
 
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-
 import org.objectweb.fractal.api.NoSuchInterfaceException;
 import org.objectweb.fractal.api.control.BindingController;
 
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 12 août 2005
- * @modified $Date: 2005/08/12 12:23:54 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/08/25 14:14:05 $
+ * @version $Revision: 1.2 $
  * @fractal.itf 
  */
 public class FcCollection
@@ -49,14 +46,13 @@
      * @param name the root name of the collection.
      */
     public FcCollection(BindingController bc, String name){
-        for (Iterator itfs = 
Arrays.asList(bc.listFc()).iterator();itfs.hasNext();) {
-            String itf = (String) itfs.next();
-            if (itf.startsWith(name))
+        String[] names = bc.listFc();
+        for (int i=0;i<names.length;i++)
+            if (names[i].startsWith(name))
                 try {
-                    add(bc.lookupFc(itf));
+                    add(bc.lookupFc(names[i]));
                 } catch (NoSuchInterfaceException e) {
-                    //ignored
+                    //ignored -- never thrown.
                 }
-        }
     }
 }
Index: 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollectionIterator.java
diff -u 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollectionIterator.java:1.3
 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollectionIterator.java:removed
--- 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollectionIterator.java:1.3
   Wed Jan  5 16:50:48 2005
+++ 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollectionIterator.java 
      Thu Aug 25 16:14:05 2005
@@ -1,177 +0,0 @@
-/*====================================================================
- 
- GoTM: GoTM is an open Transaction Monitor
- Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
- Contact: gotm-team@xxxxxxxxxxxxx
- 
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
- 
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- Lesser General Public License for more details.
- 
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
- USA
- 
- Initial developer(s): Romain Rouvoy.
- Contributor(s): .
- 
- ---------------------------------------------------------------------
- $Id: FcCollectionIterator.java,v 1.3 2005/01/05 15:50:48 rouvoy Exp $
- ====================================================================*/
-package org.objectweb.fractal.lib;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.BindingController;
-import org.objectweb.util.monolog.Monolog;
-
-/**
- * Implementation of an iterator for browsing client interfaces
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
- * @version $Revision: 1.3 $
- */
-public class FcCollectionIterator 
-implements Iterator 
-{
-    /** the binding controller used for iterations. */
-    private final BindingController bc ;
-
-    /** the iteration key. */
-    private final String key ;
-
-    /** the interfaces listed by the binding controller. */
-    private final Iterator itfs ;
-    
-    /** the last element loaded in the iterator. */
-    private Object current ;
-
-    /** the name of the current interface. */
-    private String name;
-
-    /**
-     * Provides the name of the current interface.
-     * @return Returns the name.
-     */
-    protected String getName() {
-        return this.name;
-    }
-
-    /**
-     * Defines the name of the current interface.
-     * @param name the name of the current interface.
-     */
-    protected void setName(String name) {
-        this.name = name;
-    }
-    
-    /**
-     * Provides the current interface.
-     * @return Returns the current.
-     */
-    protected Object getCurrent() {
-        return this.current;
-    }
-
-    /**
-     * Defines the current interface.
-     * @param current The current to set.
-     */
-    protected void setCurrent(Object current) {
-        this.current = current;
-    }
-
-    /**
-     * Provides the list of iterating interfaces.
-     * @return Returns the itfs.
-     */
-    protected Iterator getItfs() {
-        return this.itfs;
-    }
-
-    /**
-     * Provides the binding controller interface used to iterate.
-     * @return Returns the bc.
-     */
-    protected BindingController getBc() {
-        return this.bc;
-    }
-    
-    /**
-     * Provides the key name used to iterate on the collection interface.
-     * @return Returns the key.
-     */
-    public String getKey() {
-        return this.key;
-    }
-    
-    /**
-     * Load the next element in the iterator.
-     * @return the element before iteration.
-     */
-    private String retrieveNext() {
-        while (getItfs().hasNext()) {
-            String itf = (String) getItfs().next();
-            if (itf.startsWith(getKey())) {
-                return itf;
-            }
-        }
-        return null;
-    }
-    
-    /**
-     * The iterator constructor.
-     * @param bc the binding controller to use.
-     * @param key the interface name to iterate.
-     */
-    public FcCollectionIterator(BindingController bc, String key) {
-        this.bc = bc ;
-        this.key = key ;
-        this.itfs = Arrays.asList(this.bc.listFc()).iterator();
-        setName(retrieveNext());
-    }    
-    
-    /* (non-Javadoc)
-     * @see java.util.Iterator#hasNext()
-     */
-    public boolean hasNext() {
-        return getName() != null;
-    }
-    
-    /* (non-Javadoc)
-     * @see java.util.Iterator#next()
-     */
-    public Object next() {
-        Object next = null;
-        try {
-            next = getBc().lookupFc(getName());
-        } catch (NoSuchInterfaceException e) {
-            Monolog.debug(e.getMessage());
-        }        
-        setName(retrieveNext());
-        return next;
-    }
-    
-    /* (non-Javadoc)
-     * @see java.util.Iterator#remove()
-     */
-    public void remove() {
-        retrieveNext();
-    }
-    
-    /**
-     * Provides the name of the next element.
-     * @return the identifier of the next element.
-     */
-    public String nextId() {
-        return getName();
-    }
-}



<--  Date Index     <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.