You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2008/12/14 01:16:48 UTC

svn commit: r726313 - /xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java

Author: mrglavas
Date: Sat Dec 13 16:16:48 2008
New Revision: 726313

URL: http://svn.apache.org/viewvc?rev=726313&view=rev
Log:
As a consequence of our choice to design XSModel in IDL instead of Java we ended
up creating many list type interfaces. If we had started this work in Java we
would have used java.util.List instead, an interface which is built into the Java
class library that has first class support in the Collections API and is used by
countless applications. When we revisit the XSModel for XML Schema 1.1 we should
retrofit java.util.List everywhere in the API where we are returning the XSModel
specific list types. In anticipation of this change I've updated each of the
list implementations so that they now implement java.util.List. This will make it
easier to update the API when the time comes.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java?rev=726313&r1=726312&r2=726313&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/XSModelImpl.java Sat Dec 13 16:16:48 2008
@@ -17,6 +17,7 @@
 
 package org.apache.xerces.impl.xs;
 
+import java.util.AbstractList;
 import java.util.Vector;
 
 import org.apache.xerces.impl.Constants;
@@ -50,7 +51,7 @@
  *
  * @version $Id$
  */
-public final class XSModelImpl implements XSModel, XSNamespaceItemList {
+public final class XSModelImpl extends AbstractList implements XSModel, XSNamespaceItemList {
 
     // the max index / the max value of XSObject type
     private static final short MAX_COMP_IDX = XSTypeDefinition.SIMPLE_TYPE;
@@ -551,5 +552,20 @@
         }
         return fGrammarList[index];
     }
+    
+    //
+    // java.util.List methods
+    //
+
+    public Object get(int index) {
+        if (index >= 0 && index < fGrammarCount) {
+            return fGrammarList[index];
+        }
+        throw new IndexOutOfBoundsException("Index: " + index);
+    }
+
+    public int size() {
+        return getLength();
+    }
 
 } // class XSModelImpl



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org