User: ko5tik  
  Date: 02/04/14 09:55:28

  Modified:    src/xjavadoc DefaultXTag.java
  Log:
  Xtag is now mutable and recomputes _value after changes
  in parameters
  
  Revision  Changes    Path
  1.11      +396 -373  xjavadoc/src/xjavadoc/DefaultXTag.java
  
  Index: DefaultXTag.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xjavadoc/src/xjavadoc/DefaultXTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- DefaultXTag.java  4 Apr 2002 10:59:51 -0000       1.10
  +++ DefaultXTag.java  14 Apr 2002 16:55:27 -0000      1.11
  @@ -38,7 +38,8 @@
   import org.apache.log4j.Category;
   
   import java.util.Set;
  -import java.util.Hashtable;
  +import java.util.TreeMap;
  +import java.util.Iterator;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]";>Aslak Helles�y</a>
  @@ -60,11 +61,11 @@
        /**
         * @todo-javadoc Describe the field
         */
  -     private final String _value;
  +     private String _value;
        /**
         * @todo-javadoc Describe the field
         */
  -     private final Hashtable _attributes = new Hashtable(1, 1);
  +     private final TreeMap _attributes = new TreeMap();
        /**
         * @todo-javadoc Describe the field
         */
  @@ -74,6 +75,11 @@
         * @todo-javadoc Describe the field
         */
        private int hash = Integer.MIN_VALUE;
  +
  +     /**
  +      * indicate dirty state
  +      */
  +     private boolean _isDirty = false;
        /**
         * @todo-javadoc Describe the field
         */
  @@ -106,6 +112,7 @@
                instanceCount++;
                _name = name;
                _value = value;
  +             _isDirty = false;
        }
   
   
  @@ -124,6 +131,7 @@
                        parse();
                }
                _attributes.put(attributeName, attributeValue);
  +             _isDirty = true;
        }
   
   
  @@ -180,11 +188,25 @@
        /**
         * Returns the full value of the tag.
         *
  -      * @todo update this value when attributes are removed or added
  -      * @return Describe the return value
  -      * @todo-javadoc Write javadocs for return value
  +      * @return full value of the tag
         */
        public String value() {
  +             if (_isDirty) {
  +                     Iterator iter = _attributes.keySet().iterator();
  +                     StringBuffer sb = new StringBuffer();
  +
  +                     while (iter.hasNext()) {
  +                             String attName = (String)iter.next();
  +                             String attValue = (String)_attributes.get(attName);
  +
  +                             sb.append(attName);
  +                             sb.append("=\"");
  +                             sb.append(attValue.trim());
  +                             sb.append("\" ");
  +                     }
  +                     _value = sb.toString();
  +                     _isDirty = false;
  +             }
                return _value;
        }
   
  @@ -201,6 +223,7 @@
                if (!_isParsed) {
                        parse();
                }
  +             _isDirty = true;
                return (String)_attributes.remove(attributeName);
        }
   
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to