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/05/26 03:57:35 UTC

svn commit: r660069 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java

Author: mrglavas
Date: Sun May 25 18:57:35 2008
New Revision: 660069

URL: http://svn.apache.org/viewvc?rev=660069&view=rev
Log:
Making every field of this class final.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java?rev=660069&r1=660068&r2=660069&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/StringListImpl.java Sun May 25 18:57:35 2008
@@ -19,6 +19,7 @@
 
 import org.apache.xerces.xs.StringList;
 import java.util.Vector;
+
 /**
  * Containts a list of Object's.
  *
@@ -28,7 +29,7 @@
  *
  * @version $Id$
  */
-public class StringListImpl implements StringList {
+public final class StringListImpl implements StringList {
 
     /**
      * An immutable empty list.
@@ -46,17 +47,18 @@
     };
     
     // The array to hold all data
-    private String[] fArray = null;
+    private final String[] fArray;
     // Number of elements in this list
-    private int fLength = 0;
+    private final int fLength;
 
     // REVISIT: this is temp solution. In general we need to use this class
     //          instead of the Vector.
-    private Vector fVector;
+    private final Vector fVector;
 
     public StringListImpl(Vector v) {
         fVector = v;        
         fLength = (v == null) ? 0 : v.size();
+        fArray = null;
     }
 
     /**
@@ -68,6 +70,7 @@
     public StringListImpl(String[] array, int length) {
         fArray = array;
         fLength = length;
+        fVector = null;
     }
 
     /**
@@ -87,9 +90,9 @@
      *   <code>item</code>. 
      */
     public boolean contains(String item) {
-        if (fVector != null)
+        if (fVector != null) {
             return fVector.contains(item);
-        
+        }
         if (item == null) {
             for (int i = 0; i < fLength; i++) {
                 if (fArray[i] == null)
@@ -106,8 +109,9 @@
     }
 
     public String item(int index) {
-        if (index < 0 || index >= fLength)
+        if (index < 0 || index >= fLength) {
             return null;
+        }
         if (fVector != null) {
             return (String)fVector.elementAt(index);
         }



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