/**
   * Sets the indexed type of IdxPropertyPattern
   *
   * @param type New indexed type of the indexed property
   * @throws SourceException If the modification of source code is impossible
   */
  public void setIndexedType(Type type) throws SourceException {

    if (this.indexedType.compareTo(type, true)) return;

    // Remember the old type & old indexed type
    Type oldIndexedType = this.indexedType;
    Type oldType = this.type;

    // Change the indexed type
    if (indexedGetterMethod != null) {
      indexedGetterMethod.setReturn(type);
    }
    if (indexedSetterMethod != null) {
      MethodParameter[] params = indexedSetterMethod.getParameters();
      if (params.length > 1) {
        params[1].setType(type);
        indexedSetterMethod.setParameters(params);
      }
    }

    // Test if the old type of getter and seter was an array of indexedType
    // if so change the type of that array.
    if (oldType != null
        && oldType.isArray()
        && oldType.getElementType().compareTo(oldIndexedType, false)) {
      Type newArrayType = Type.createArray(type);
      super.setType(newArrayType);
    }

    indexedType = type;
  }
  /**
   * Sets the name of IdxPropertyPattern
   *
   * @param name New name of the property.
   * @throws SourceException If the modification of source code is impossible.
   */
  public void setName(String name) throws SourceException {
    super.setName(name);

    name = capitalizeFirstLetter(name);

    if (indexedGetterMethod != null) {
      Identifier idxGetterMethodID =
          Identifier.create(
              (indexedGetterMethod.getName().getName().startsWith("get")
                      ? // NOI18N
                      "get"
                      : "is")
                  + name); // NOI18N
      indexedGetterMethod.setName(idxGetterMethodID);
    }
    if (indexedSetterMethod != null) {
      Identifier idxSetterMethodID = Identifier.create("set" + name); // NOI18N
      indexedSetterMethod.setName(idxSetterMethodID);
    }
  }
  /**
   * Sets the non-indexed type of IdxPropertyPattern
   *
   * @param type New non-indexed type of the indexed property
   * @throws SourceException If the modification of source code is impossible
   */
  public void setType(Type type) throws SourceException {

    if (this.type != null && this.type.compareTo(type, true)) return;

    // Remember the old type & old indexed type
    Type oldIndexedType = this.indexedType;
    Type oldType = this.type;

    if (oldType == null) {
      this.type = type;
      oldType = type;
      int mode = getMode();
      if (mode == READ_WRITE || mode == READ_ONLY) generateGetterMethod();
      if (mode == READ_WRITE || mode == WRITE_ONLY) generateSetterMethod();
    } else
      // Change the type
      super.setType(type);

    // Test if the idexedType is the type of array and change it if so
    if (type.isArray()
        && oldType.isArray()
        && oldType.getElementType().compareTo(oldIndexedType, false)) {
      Type newType = type.getElementType();

      if (indexedGetterMethod != null) {
        indexedGetterMethod.setReturn(newType);
      }
      if (indexedSetterMethod != null) {
        MethodParameter[] params = indexedSetterMethod.getParameters();
        if (params.length > 1) {
          params[1].setType(newType);
          indexedSetterMethod.setParameters(params);
        }
      }

      // Set the type  to new type
      setIndexedType(newType);
    }
  }
 /**
  * Generates non-indexed setter method without body and without Javadoc comment.
  *
  * @throws SourceException If modification of source code is impossible.
  */
 void generateSetterMethod() throws SourceException {
   if (type != null) super.generateSetterMethod();
 }
 /**
  * Destroys methods associated methods with the pattern in source
  *
  * @throws SourceException If modification of source is impossible
  */
 public void destroy() throws SourceException {
   deleteIndexedSetterMethod();
   deleteIndexedGetterMethod();
   super.destroy();
 }