# SaxAttributesImpl.java

    /*
    ** Module   : SaxAttributesImpl
    ** Abstract : SAX attributes specific features implementation.
    **
    ** Copyright (c) 2013-2022, Golden Code Development Corporation.
    **
    ** -#- -I- --Date-- ---------------------------------------Description----------------------------------------
    ** 001 EVL 20130208 Created initial version. Implementation is limited to the stubs to get the
    **                  converted java code compiled.
    ** 002 CA  20130221 Added ADM-DATA and UNIQUE-ID support.
    ** 003 EVK 20131001 Implement methods and class logic.
    ** 004 CA  20220222 Fixed insertAttribute, to process a qualified attribute name properly.
    */
    /*
    ** This program is free software: you can redistribute it and/or modify
    ** it under the terms of the GNU Affero General Public License as
    ** published by the Free Software Foundation, either version 3 of the
    ** License, or (at your option) any later version.
    **
    ** This program is distributed in the hope that it will be useful,
    ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ** GNU Affero General Public License for more details.
    **
    ** You may find a copy of the GNU Affero GPL version 3 at the following
    ** location: https://www.gnu.org/licenses/agpl-3.0.en.html
    **
    ** Additional terms under GNU Affero GPL version 3 section 7:
    **
    **   Under Section 7 of the GNU Affero GPL version 3, the following additional
    **   terms apply to the works covered under the License.  These additional terms
    **   are non-permissive additional terms allowed under Section 7 of the GNU
    **   Affero GPL version 3 and may not be removed by you.
    **
    **   0. Attribution Requirement.
    **
    **     You must preserve all legal notices or author attributions in the covered
    **     work or Appropriate Legal Notices displayed by works containing the covered
    **     work.  You may not remove from the covered work any author or developer
    **     credit already included within the covered work.
    **
    **   1. No License To Use Trademarks.
    **
    **     This license does not grant any license or rights to use the trademarks
    **     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
    **     of Golden Code Development Corporation. You are not authorized to use the
    **     name Golden Code, FWD, or the names of any author or contributor, for
    **     publicity purposes without written authorization.
    **
    **   2. No Misrepresentation of Affiliation.
    **
    **     You may not represent yourself as Golden Code Development Corporation or FWD.
    **
    **     You may not represent yourself for publicity purposes as associated with
    **     Golden Code Development Corporation, FWD, or any author or contributor to
    **     the covered work, without written authorization.
    **
    **   3. No Misrepresentation of Source or Origin.
    **
    **     You may not represent the covered work as solely your work.  All modified
    **     versions of the covered work must be marked in a reasonable way to make it
    **     clear that the modified work is not originating from Golden Code Development
    **     Corporation or FWD.  All modified versions must contain the notices of
    **     attribution required in this license.
    */

    package com.goldencode.p2j.xml;

    import com.goldencode.p2j.util.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;

    /**
     * Interface describing SAX-Attributes specific features of the SAX objects.
     */
    public class SaxAttributesImpl
    extends SaxEntityImpl
    implements SaxAttributes
    {
       /** List of XML attributes.*/
       private final AttributesImpl attributes = new AttributesImpl();

       /**
        * Default constructor.
        */
       public SaxAttributesImpl()
       {
          // no-op
       }

       /**
        * Special constructor accepting a Attributes object.
        *
        * @param    attrs
        *           List of XML attributes.
        */
       SaxAttributesImpl(Attributes attrs)
       {
          attributes.setAttributes(attrs);
       }

       /**
        * Copies SAX attributes form source provided to the current SAX-Attributes object.
        *
        * @param    attrHandle
        *           The handle of the SAX-Attribute object to be used as source.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical copySaxAttributes(handle attrHandle)
       {
          if (!handle.isHandleTypeOf(attrHandle, SaxAttributes.class))
          {
             invalidArgumentError("COPY-SAX-ATTRIBUTES");
             return new logical(false);
          }

          Attributes attrs = ((SaxAttributesImpl)attrHandle.getResource()).attributes;

          attributes.setAttributes(attrs);

          return new logical(true);
       }

       /**
        * Gets the 1-based index of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByNamespaceName(String uri, Text localname)
       {
          return getIndexByNamespaceName(new character(uri), localname);
       }

       /**
        * Gets the 1-based index of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByNamespaceName(Text uri, Text localname)
       {
          if (!BaseDataType.elementsOfType(character.class, uri, localname))
          {
             invalidArgumentError("GET-INDEX-BY-NAMESPACE-NAME");
             return new integer();
          }
          if (localname.isUnknown())
          {
             invalidArgumentError("GET-INDEX-BY-NAMESPACE-NAME");
             return new integer();
          }

          String uriStr = uri.isUnknown() ? "" : uri.toStringMessage();
          String localName = localname.toStringMessage();

          int result = attributes.getIndex(uriStr, localName);
          if (result < 0)
          {
             return new integer();
          }
          return new integer(result + 1);
       }

       /**
        * Gets the 1-based index of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByNamespaceName(Text uri, String localname)
       {
          return getIndexByNamespaceName(uri, new character(localname));
       }

       /**
        * Gets the 1-based index of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByNamespaceName(String uri, String localname)
       {
          return getIndexByNamespaceName(new character(uri), new character(localname));
       }

       /**
        * Gets the 1-based index of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the index.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByQname(String qname)
       {
          return getIndexByQname(new character(qname));
       }

       /**
        * Gets the 1-based index of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the index.
        *
        * @return   The integer value of the given attribute index.
        */
       @Override
       public integer getIndexByQname(Text qname)
       {
          if (!BaseDataType.elementsOfType(character.class, qname))
          {
             invalidArgumentError("GET-INDEX-BY-QNAME");
             return new integer();
          }

          if (qname.isUnknown())
          {
             invalidArgumentError("GET-INDEX-BY-QNAME");
             return new integer();
          }

          int result = attributes.getIndex(qname.toStringMessage());
          if (result < 0)
          {
             return new integer();
          }
          return new integer(result + 1);
       }

       /**
        * Gets the unqualified local name of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute name to get.
        *
        * @return   The character value of the attribute local name with given number.
        */
       @Override
       public character getLocalnameByIndex(double index)
       {
          return getLocalnameByIndex(new integer(index));
       }

       /**
        * Gets the unqualified local name of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute name to get.
        *
        * @return   The character value of the attribute local name with given number.
        */
       @Override
       public character getLocalnameByIndex(NumberType index)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("GET-LOCALNAME-BY-INDEX");
             return new character();
          }

          return new character(attributes.getLocalName(index.intValue() - 1));
       }

       /**
        * Gets the numbers of the entries in the attributes object.
        *
        * @return   The integer value of the num-items attribute.
        */
       @Override
       public integer getNumItems()
       {
          return new integer(attributes.getLength());
       }

       /**
        * Gets the qualified name of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute name to get.
        *
        * @return   The character value of the attribute qualified name with given number.
        */
       @Override
       public character getQnameByIndex(double index)
       {
          return getQnameByIndex(new integer(index));
       }

       /**
        * Gets the qualified local name of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute name to get.
        *
        * @return   The character value of the attribute qualified name with given number.
        */
       @Override
       public character getQnameByIndex(NumberType index)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("GET-QNAME-BY-INDEX");
             return new character();
          }

          return new character(attributes.getQName(index.intValue() - 1));
       }

       /**
        * Gets the type of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute type to get.
        *
        * @return   The character value of the attribute type with given number.
        */
       @Override
       public character getTypeByIndex(double index)
       {
          return getTypeByIndex(new integer(index));
       }

       /**
        * Gets the type of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the attribute type to get.
        *
        * @return   The character value of the attribute type with given number.
        */
       @Override
       public character getTypeByIndex(NumberType index)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("GET-TYPE-BY-INDEX");
             return new character();
          }

          return new character(attributes.getType(index.intValue() - 1));
       }

       /**
        * Gets the type of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByNamespaceName(String uri, Text localname)
       {
          return getTypeByNamespaceName(new character(uri), localname);
       }

       /**
        * Gets the type of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByNamespaceName(Text uri, Text localname)
       {
          if (!BaseDataType.elementsOfType(character.class, uri, localname))
          {
             invalidArgumentError("GET-TYPE-BY-NAMESPACE-NAME");
             return new character();
          }
          if (localname.isUnknown())
          {
             invalidArgumentError("GET-TYPE-BY-NAMESPACE-NAME");
             return new character();
          }

          String uriStr = uri.isUnknown() ? null : uri.toStringMessage();

          return new character(attributes.getType(uriStr, localname.toStringMessage()));
       }

       /**
        * Gets the type of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByNamespaceName(Text uri, String localname)
       {
          return getTypeByNamespaceName(uri, new character(localname));
       }

       /**
        * Gets the type of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByNamespaceName(String uri, String localname)
       {
          return getTypeByNamespaceName(new character(uri), new character(localname));
       }

       /**
        * Gets the type of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the type.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByQname(String qname)
       {
          return getTypeByQname(new character(qname));
       }

       /**
        * Gets the type of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the type.
        *
        * @return   The character value of the given attribute type.
        */
       @Override
       public character getTypeByQname(character qname)
       {
          if (qname.isUnknown())
          {
             invalidArgumentError("GET-TYPE-BY-QNAME");
             return new character();
          }

          return new character(attributes.getType(qname.toStringMessage()));
       }

       /**
        * Gets the namespace URI of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the namespace URI to get.
        *
        * @return   The character value of the namespace URI with given number.
        */
       @Override
       public character getUriByIndex(double index)
       {
          return getUriByIndex(new integer(index));
       }

       /**
        * Gets the namespace URI of the current attribute object by the given 1-based index.
        *
        * @param    index
        *           The 1-based index of the namespace URI to get.
        *
        * @return   The character value of the namespace URI with given number.
        */
       @Override
       public character getUriByIndex(NumberType index)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("GET-URI-BY-INDEX");
             return new character();
          }

          return new character(attributes.getURI(index.intValue() - 1));
       }

       /**
        * Gets the value of the atribute with given index.
        *
        * @param    index
        *           The 1-based index of the attribute to get.
        *
        * @return   The character value of the attribute with given number.
        */
       @Override
       public character getValueByIndex(double index)
       {
          return getValueByIndex(new integer(index));
       }

       /**
        * Gets the value of the atribute with given index.
        *
        * @param    index
        *           The 1-based index of the attribute to get.
        *
        * @return   The character value of the attribute with given number.
        */
       @Override
       public character getValueByIndex(NumberType index)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("GET-VALUE-BY-INDEX");
             return new character();
          }
          int number = index.intValue();

          if (number < 1 || number > attributes.getLength())
          {
             return new character();
          }

          return new character(attributes.getValue(number - 1));
       }

       /**
        * Gets the value of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByNamespaceName(String uri, Text localname)
       {
          return getValueByNamespaceName(new character(uri), localname);
       }

       /**
        * Gets the value of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByNamespaceName(Text uri, Text localname)
       {
          if (!BaseDataType.elementsOfType(character.class, uri, localname))
          {
             invalidArgumentError("GET-VALUE-BY-NAMESPACE-NAME");
             return new character();
          }

          if (localname.isUnknown())
          {
             invalidArgumentError("GET-VALUE-BY-NAMESPACE-NAME");
             return new character();
          }

          String uriStr = uri.isUnknown() ? "" : uri.toStringMessage();
          return new character(attributes.getValue(uriStr, localname.toStringMessage()));
       }

       /**
        * Gets the value of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByNamespaceName(Text uri, String localname)
       {
          return getValueByNamespaceName(uri, new character(localname));
       }

       /**
        * Gets the value of the attribute with given namespace name.
        *
        * @param    uri
        *           The namespace URI or empty string if none.
        * @param    localname
        *           The local(unqualified) name of the attribute.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByNamespaceName(String uri, String localname)
       {
          return getValueByNamespaceName(new character(uri), new character(localname));
       }

       /**
        * Gets the value of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the value.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByQname(String qname)
       {
          return getValueByQname(new character(qname));
       }

       /**
        * Gets the value of the attribute with given XML qualified name.
        *
        * @param    qname
        *           The XML qualified name of the attribute to get the value.
        *
        * @return   The character value of the given attribute.
        */
       @Override
       public character getValueByQname(character qname)
       {
          if (qname.isUnknown())
          {
             invalidArgumentError("GET-VALUE-BY-QNAME");
             return new character();
          }

          return new character(attributes.getValue(qname.toStringMessage()));
       }

       /**
        * Adding the single attribute to the start tag in the XML document if applied for SAX writer
        * object. For SAX attributes object inserts attribute and its name into SAX attributes object.
        *
        * @param    name
        *           The attribute name to insert.
        * @param    value
        *           The attribute value to insert.
        * @param    uri
        *           The URI of the attribute to insert or '?' for unknown value.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical insertAttribute(Text name, Text value, Text uri)
       {
          if (!BaseDataType.elementsOfType(character.class, uri, name, value))
          {
             invalidArgumentError("INSERT-ATTRIBUTE");
             return new logical(false);
          }
          if (name.isUnknown() || value.isUnknown())
          {
             invalidArgumentError("INSERT-ATTRIBUTE");
             return new logical(false);
          }
          String uriStr = uri.isUnknown() ? "" : uri.toStringMessage();
          String qname = name.toStringMessage();
          String localName = qname;
          int idx = localName.indexOf(':');
          if (idx >= 0)
          {
             localName = localName.substring(idx + 1);
          }
          attributes.addAttribute(uriStr, localName, qname, "CDATA", value.toStringMessage());

          return new logical(true);
       }

       /**
        * Removes the specified attribute.
        *
        * @param    name
        *           The name of the attribute to remove.
        * @param    uri
        *           The URI of the attribute to remove.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical removeAttribute(character name, character uri)
       {
          if (name.isUnknown())
          {
             invalidArgumentError("REMOVE-ATTRIBUTE");
             return new logical(false);
          }

          integer id = getIndexByNamespaceName(uri, name);
          if (id.isUnknown())
          {
             return new logical(false);
          }

          return removeAttribute(id, uri);
       }

       /**
        * Removes the specified attribute.
        *
        * @param    index
        *           The 1-based index of the attribute to remove.
        * @param    uri
        *           The URI of the attribute to remove.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical removeAttribute(NumberType index, character uri)
       {
          if (index.isUnknown())
          {
             invalidArgumentError("REMOVE-ATTRIBUTE");
             return new logical(false);
          }

          try
          {
             attributes.removeAttribute(index.intValue());
          }
          catch (ArrayIndexOutOfBoundsException ignored)
          {
             return new logical(false);
          }

          return new logical(true);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, character value)
       {
          return updateAttribute(name, new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, character value, character uri)
       {
          if (name.isUnknown() || value.isUnknown())
          {
             invalidArgumentError("UPDATE-ATTRIBUTE");
             return new logical(false);
          }

          integer id = getIndexByNamespaceName(uri, name);
          if (id.isUnknown())
          {
             return new logical(false);
          }

          return updateAttribute(id, value, uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, character value, character uri)
       {
          if (index.isUnknown() || value.isUnknown())
          {
             invalidArgumentError("UPDATE-ATTRIBUTE");
             return new logical(false);
          }
          int indx = index.intValue() - 1;
          attributes.setAttribute(indx,
                                  attributes.getURI(indx),
                                  attributes.getLocalName(indx),
                                  attributes.getQName(indx),
                                  attributes.getType(indx),
                                  value.toStringMessage());
          return new logical(true);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, String value)
       {
          return updateAttribute(name, new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, String value, character uri)
       {
          return updateAttribute(name, new character(value), uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, character value, String uri)
       {
          return updateAttribute(name, value, new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(character name, String value, String uri)
       {
          return updateAttribute(name, new character(value), new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, character value)
       {
          return updateAttribute(new character(name), new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, String value)
       {
          return updateAttribute(new character(name), new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, String value, character uri)
       {
          return updateAttribute(new character(name), new character(value), uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, character value, String uri)
       {
          return updateAttribute(new character(name), value, new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, String value, String uri)
       {
          return updateAttribute(new character(name), new character(value),
                                 new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    name
        *           The name of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(String name, character value, character uri)
       {
          return updateAttribute(new character(name), value, uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, character value)
       {
          return updateAttribute(index, new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, String value)
       {
          return updateAttribute(index, new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, String value, character uri)
       {
          return updateAttribute(index, new character(value), uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, character value, String uri)
       {
          return updateAttribute(index, value, new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(NumberType index, String value, String uri)
       {
          return updateAttribute(index, new character(value), new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, character value)
       {
          return updateAttribute(new integer(index), new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, String value)
       {
          return updateAttribute(new integer(index), new character(value), new character());
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, String value, character uri)
       {
          return updateAttribute(new integer(index), new character(value), uri);
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, character value, String uri)
       {
          return updateAttribute(new integer(index), value, new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, String value, String uri)
       {
          return updateAttribute(new integer(index), new character(value),
                                 new character(uri));
       }

       /**
        * Updates the specified attribute.
        *
        * @param    index
        *           The 1-based position index of the attribute to update.
        * @param    value
        *           The new value of the updated attribute.
        * @param    uri
        *           The URI of the attribute to update.
        *
        * @return   The <code>true</code> in case of success <code>false</code> otherwise.
        */
       @Override
       public logical updateAttribute(double index, character value, character uri)
       {
          return updateAttribute(new integer(index), value, uri);
       }

       /**
        * Getter for attributes.
        *
        * @return   attributes.
        */
       Attributes getAttributes()
       {
          return attributes;
       }

    }