(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 5 Jun 2008 21:01:56 +0000 (21:01 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 5 Jun 2008 21:01:56 +0000 (21:01 +0000)
system/general/src/main/java/org/wamblee/system/core/ReadWriteNamedInterfaces.java
system/general/src/main/java/org/wamblee/system/core/ReadWriteProvidedInterfaces.java
system/general/src/main/java/org/wamblee/system/core/ReadWriteRequiredInterfaces.java

index 0dcd4187db15443915720e2d12538c7b327d90c7..ea7d4903e66e24797e86bb5a89d5e4cafa9f07fb 100644 (file)
@@ -20,43 +20,22 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
-public class ReadWriteNamedInterfaces<T extends NamedInterface> implements Iterable<T> {
-    
-    protected List<T> _interfaces; 
+public class ReadWriteNamedInterfaces<T extends NamedInterface> extends ArrayList<T> {
 
     public ReadWriteNamedInterfaces() {
-        _interfaces = new ArrayList<T>(); 
+        // Empty.
     }
     
     public ReadWriteNamedInterfaces(T[] aInterfaces) { 
-        _interfaces = new ArrayList<T>();
-        _interfaces.addAll(Arrays.asList(aInterfaces));
-    }
-    
-    public int size() { 
-        return _interfaces.size();
+        addAll(Arrays.asList(aInterfaces));
     }
-    
-    public T get(int aIndex) { 
-        return _interfaces.get(aIndex);
-    }
-    
+   
     public T get(String aName) { 
-        for (T intf: _interfaces) { 
+        for (T intf: this) { 
             if ( intf.getName().equals(aName)) { 
                 return intf; 
             }
         }
         return null; 
     }
-    
-    public void add(T aInterface) { 
-        _interfaces.add(aInterface);
-    }
-    
-    @Override
-    public Iterator<T> iterator() {
-        return _interfaces.iterator();
-    }
-
 }
index 8581c939d2dde6c6735b56a91102628993294fa3..3c5c1590b24ccf5a1188860c99c2abb52cdb4fba 100644 (file)
@@ -26,6 +26,6 @@ public class ReadWriteProvidedInterfaces extends ReadWriteNamedInterfaces<Provid
     }
 
     public ProvidedInterfaces readOnlyView() { 
-        return new ProvidedInterfaces(_interfaces);
+        return new ProvidedInterfaces(this);
     }
 }
index 3cdccebb3774395790de0ba099ac70091806b435..033afa869ae49f5dfa64b0cee1cd7e747ef40f1d 100644 (file)
@@ -26,6 +26,6 @@ public class ReadWriteRequiredInterfaces extends ReadWriteNamedInterfaces<Requir
     }
     
     public RequiredInterfaces readOnlyView() {
-        return new RequiredInterfaces(_interfaces);
+        return new RequiredInterfaces(this);
     }
 }