/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xelement;

import org.w3c.dom.Element;
import cx2x.xcodeml.helper.*;


/**
 * The XifStatement represents the FifStatement (6.4) element in XcodeML
 * intermediate representation.
 *
 * Elements:
 * - Required:
 *   - condition (Xcondition)
 *   - then (Xthen)
 * - Optional:
 *   - else (Xelse)
 * Attributes:
 * - Optional: construct_name (text)
 *
 * @author clementval
 */

public class XifStatement extends XbaseElement {

  private Xcondition _cond = null;
  private Xthen _then = null;
  private Xelse _else = null;

  // attributes
  private String _construct_name = null;

  /**
   * Xelement standard ctor. Pass the base element to the base class and read
   * inner information (elements and attributes).
   * @param baseElement The root element of the Xelement
   */
  public XifStatement(Element baseElement){
    super(baseElement);
    _cond = XelementHelper.findCondition(this, false);
    _then = XelementHelper.findThen(this, false);
    _else = XelementHelper.findElse(this, false);


    // read optional attributes
    _construct_name = XelementHelper.getAttributeValue(this,
      XelementName.ATTR_CONSTRUCT_NAME);
  }


  /**
   * Check whether the element has a construct name attribute defined.
   * @return True the attribute is defined. False otherwise.
   */
  public boolean hasConstructName(){
    return _construct_name != null;
  }

  /**
   * Get the construct name attribute value.
   * @return Construct name value. Null if the attribute is not defined.
   */
  public String getConstructName(){
    return _construct_name;
  }
}

@@ -310,16 +310,41 @@
 lements:
+ (condition, then, else?)
 %0A * - Re
@@ -491,16 +491,58 @@
 ext)%0A *%0A
+ * Can have lineno and file attribtues%0A *%0A
  * @auth
@@ -1745,11 +1745,467 @@
 ame;%0A  %7D
+%0A%0A  /**%0A   * Get the condition part of the if statement.%0A   * @return A Xcondition object.%0A   */%0A  public Xcondition getCondition()%7B%0A    return _cond;%0A  %7D%0A%0A  /**%0A   * Get the then block of the if statement.%0A   * @return A Xthen object.%0A   */%0A  public Xthen getThen()%7B%0A    return _then;%0A  %7D%0A%0A  /**%0A   * Get the else block of the if statement%0A   * @return A Xelse object. Null if there is no else block. %0A   */%0A  public Xelse getElse()%7B%0A    return _else;%0A  %7D
 %0A%7D%0A

Add accessors