db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1483231 - /db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
Date Thu, 16 May 2013 08:09:24 GMT
Author: tfischer
Date: Thu May 16 08:09:24 2013
New Revision: 1483231

URL: http://svn.apache.org/r1483231
Log:
make SourceElement serializable because it is referenced by the serializable classes SourceElementAttributePointer
and SourceElementNodePointer

Modified:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java?rev=1483231&r1=1483230&r2=1483231&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
(original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
Thu May 16 08:09:24 2013
@@ -19,6 +19,7 @@ package org.apache.torque.generator.sour
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -33,15 +34,20 @@ import java.util.Set;
 /**
  * An element in the source graph.
  */
-public class SourceElement
+public class SourceElement implements Serializable
 {
     /**
+     * Serial Version UID.
+     */
+    private static final long serialVersionUID = 1L;
+
+    /**
      * The name of the source element.
      */
     private final String name;
 
     /**
-     * The parents of this  element; may be empty but not null.
+     * The parents of this element; may be empty but not null.
      */
     private final List<SourceElement> parents = new ParentList(this);
 
@@ -63,7 +69,7 @@ public class SourceElement
      *
      * @throws NullPointerException if name is null.
      */
-    public SourceElement(String name)
+    public SourceElement(final String name)
     {
         if (name == null)
         {
@@ -79,7 +85,7 @@ public class SourceElement
      *
      * @throws NullPointerException if sourceElementName is null.
      */
-    public SourceElement(SourceElementName sourceElementName)
+    public SourceElement(final SourceElementName sourceElementName)
     {
         this(sourceElementName.getName());
     }
@@ -145,7 +151,7 @@ public class SourceElement
      *
      * @throws NullPointerException if name is null.
      */
-    public List<SourceElement> getChildren(String name)
+    public List<SourceElement> getChildren(final String name)
     {
         if (name == null)
         {
@@ -175,7 +181,7 @@ public class SourceElement
      *
      * @throws NullPointerException if sourceElementName is null.
      */
-    public List<SourceElement> getChildren(SourceElementName sourceElementName)
+    public List<SourceElement> getChildren(final SourceElementName sourceElementName)
     {
         return getChildren(sourceElementName.getName());
     }
@@ -191,7 +197,7 @@ public class SourceElement
      *
      * @throws NullPointerException if name is null.
      */
-    public SourceElement getChild(String name)
+    public SourceElement getChild(final String name)
     {
         for (SourceElement sourceElement : children)
         {
@@ -215,7 +221,7 @@ public class SourceElement
      *
      * @throws NullPointerException if sourceElementName is null.
      */
-    public SourceElement getChild(SourceElementName sourceElementName)
+    public SourceElement getChild(final SourceElementName sourceElementName)
     {
         return getChild(sourceElementName.getName());
     }
@@ -229,7 +235,7 @@ public class SourceElement
      *
      * @throws NullPointerException if name is null.
      */
-    public boolean hasChild(String name)
+    public boolean hasChild(final String name)
     {
         return SourcePath.hasChild(this, name);
     }
@@ -275,7 +281,7 @@ public class SourceElement
      *
      * @see <a href="http://www.w3.org/TR/xpath#axes"></a>
      */
-    public List<SourceElement> getFollowing(String name)
+    public List<SourceElement> getFollowing(final String name)
     {
         return SourcePath.getFollowing(this, name);
     }
@@ -293,7 +299,7 @@ public class SourceElement
      * @throws IllegalArgumentException if parent is not a parent
      *         of this SourceElement.
      */
-    public SourceElement getFollowingSourceElement(SourceElement parent)
+    public SourceElement getFollowingSourceElement(final SourceElement parent)
     {
         if (!parents.contains(parent))
         {
@@ -366,7 +372,7 @@ public class SourceElement
      *
      * @see <a href="http://www.w3.org/TR/xpath#axes"></a>
      */
-    public List<SourceElement> getPreceding(String name)
+    public List<SourceElement> getPreceding(final String name)
     {
         return SourcePath.getPreceding(this, name);
     }
@@ -384,7 +390,7 @@ public class SourceElement
      * @throws IllegalArgumentException if parent is not a parent
      *         of this SourceElement.
      */
-    public SourceElement getPrecedingSourceElement(SourceElement parent)
+    public SourceElement getPrecedingSourceElement(final SourceElement parent)
     {
         if (!parents.contains(parent))
         {
@@ -419,7 +425,7 @@ public class SourceElement
      *
      * @return the stored object, or null if no object is stored under that key.
      */
-    public Object getAttribute(String name)
+    public Object getAttribute(final String name)
     {
         return attributes.get(name);
     }
@@ -433,7 +439,7 @@ public class SourceElement
      *
      * @throws NullPointerException if sourceAttributeName is null.
      */
-    public Object getAttribute(SourceAttributeName sourceAttributeName)
+    public Object getAttribute(final SourceAttributeName sourceAttributeName)
     {
         return getAttribute(sourceAttributeName.getName());
     }
@@ -447,7 +453,7 @@ public class SourceElement
      *
      * @return the previous value of this attribute.
      */
-    public Object setAttribute(String name, Object value)
+    public Object setAttribute(final String name, final Object value)
     {
         if (value == null)
         {
@@ -466,8 +472,8 @@ public class SourceElement
      * @return the previous value of this attribute.
      */
     public Object setAttribute(
-            SourceAttributeName sourceAttributeName,
-            Object value)
+            final SourceAttributeName sourceAttributeName,
+            final Object value)
     {
         return setAttribute(sourceAttributeName.getName(), value);
     }
@@ -507,8 +513,8 @@ public class SourceElement
      *
      * @return the copy of the source, not null.
      */
-    private SourceElement copy(SourceElement toCopy,
-            Map<SourceElement, SourceElement> copiedElements)
+    private SourceElement copy(final SourceElement toCopy,
+            final Map<SourceElement, SourceElement> copiedElements)
     {
         SourceElement copied = copiedElements.get(toCopy);
         if (copied != null)
@@ -562,7 +568,7 @@ public class SourceElement
      * @return true if all source elements in the toCompare tree have the equal
      *          content as the source elements in this tree.
      */
-    public boolean graphEquals(SourceElement toCompare)
+    public boolean graphEquals(final SourceElement toCompare)
     {
         Set<SourceElement> alreadyCompared = new HashSet<SourceElement>();
         return graphEquals(this, toCompare, alreadyCompared);
@@ -583,9 +589,9 @@ public class SourceElement
      * @return true if the elements are equal or if equality is currently
      *          checked in another recursive iteration.
      */
-    private boolean graphEquals(SourceElement reference,
-            SourceElement toCompare,
-            Set<SourceElement> compared)
+    private boolean graphEquals(final SourceElement reference,
+            final SourceElement toCompare,
+            final Set<SourceElement> compared)
     {
         if ((reference == null && toCompare != null)
                 || (reference != null && toCompare == null))
@@ -686,8 +692,8 @@ public class SourceElement
      *        should be appended.
      */
     private void toString(
-            Set<SourceElement> alreadyProcessed,
-            StringBuilder result)
+            final Set<SourceElement> alreadyProcessed,
+            final StringBuilder result)
     {
         alreadyProcessed.add(this);
         result.append("(name=").append(name)
@@ -745,7 +751,7 @@ public class SourceElement
          *
          * @throws NullPointerException if <code>sourceElement</code> is null.
          */
-        public ChildList(SourceElement sourceElement)
+        public ChildList(final SourceElement sourceElement)
         {
             if (sourceElement == null)
             {
@@ -756,7 +762,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement get(int index)
+        public SourceElement get(final int index)
         {
             return children.get(index);
         }
@@ -768,7 +774,7 @@ public class SourceElement
         }
 
         @Override
-        public void add(int position, SourceElement child)
+        public void add(final int position, final SourceElement child)
         {
             if (children.contains(child))
             {
@@ -785,7 +791,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement remove(int index)
+        public SourceElement remove(final int index)
         {
             SourceElement result = children.remove(index);
             result.getParents().remove(sourceElement);
@@ -793,7 +799,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement set(int index, SourceElement child)
+        public SourceElement set(final int index, final SourceElement child)
         {
             // allow setting an already contained child at the same position,
             // but throw an error if the child is set at other position.
@@ -834,7 +840,7 @@ public class SourceElement
          *
          * @throws NullPointerException if <code>sourceElement</code> is null.
          */
-        public ParentList(SourceElement sourceElement)
+        public ParentList(final SourceElement sourceElement)
         {
             if (sourceElement == null)
             {
@@ -845,7 +851,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement get(int index)
+        public SourceElement get(final int index)
         {
             return parents.get(index);
         }
@@ -857,7 +863,7 @@ public class SourceElement
         }
 
         @Override
-        public void add(int position, SourceElement parent)
+        public void add(final int position, final SourceElement parent)
         {
             if (parents.contains(parent))
             {
@@ -874,7 +880,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement remove(int index)
+        public SourceElement remove(final int index)
         {
             SourceElement result = parents.remove(index);
             result.getChildren().remove(sourceElement);
@@ -882,7 +888,7 @@ public class SourceElement
         }
 
         @Override
-        public SourceElement set(int index, SourceElement parent)
+        public SourceElement set(final int index, final SourceElement parent)
         {
             // allow setting an already contained parent at the same position,
             // but throw an error if the parent is set at other position.



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message