/*
 * 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 TODO
 * Attributes:
 * - Optional: construct_name (text) TODO
 *
 * @author clementval
 */

public class XifStatement extends XbaseElement {

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

  // attributes
  private String _constructName = 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
    _constructName = XelementHelper.getAttributeValue(this,
      XelementName.ATTR_CONSTRUCT_NAME);
  }
}

@@ -403,20 +403,23 @@
  - else 
-TODO
+(Xelse)
 %0A * Attr
@@ -466,13 +466,8 @@
 ext)
- TODO
 %0A *%0A
@@ -678,25 +678,26 @@
 g _construct
-N
+_n
 ame = null;%0A
@@ -1165,17 +1165,18 @@
 onstruct
-N
+_n
 ame = Xe
@@ -1257,10 +1257,432 @@
 E);%0A  %7D%0A
+%0A%0A  /**%0A   * Check whether the element has a construct name attribute defined.%0A   * @return True the attribute is defined. False otherwise.%0A   */%0A  public boolean hasConstructName()%7B%0A    return _construct_name != null;%0A  %7D%0A%0A  /**%0A   * Get the construct name attribute value.%0A   * @return Construct name value. Null if the attribute is not defined.%0A   */%0A  public String getConstructName()%7B%0A    return _construct_name;%0A  %7D%0A
 %7D%0A

Add accessor for construct_name