package x2x.translator.xcodeml.xelement;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * The Xpragma represents the FpragmaStatement (6.25) element in XcodeML
 * intermediate representation.
 *
 * Elements: contains value of the pragma line.
 */

public class Xpragma extends XbaseElement {
  private String _value = null;
  private String _line = null;
  private String _filename = null;

  public Xpragma(Element pragmaElement){
    super(pragmaElement);
    if(pragmaElement != null){
      _value = getData();
      _line = XelementHelper.getAttributeValue(baseElement,
        XelementName.ATTR_LINENO);
      _filename = XelementHelper.getAttributeValue(baseElement,
        XelementName.ATTR_FILE);
    }
  }

  public String getFilename(){
    return _filename;
  }

  public String getLine(){
    return _line;
  }

  public Xpragma cloneObject(){
    Node clone = clone();
    return new Xpragma((Element)clone);
  }

  public void setData(String value){
    if(baseElement != null){
      baseElement.setTextContent(value);
      _value = value;
    }
  }
}

@@ -340,22 +340,19 @@
 private 
-Str
 in
-g
+t
  _line =
@@ -348,28 +348,25 @@
 int _line = 
-null
+0
 ;%0A  private 
@@ -521,21 +521,31 @@
 ;%0A      
-_line
+String lineAttr
  = Xelem
@@ -620,16 +620,96 @@
 INENO);%0A
+      if(lineAttr != null)%7B%0A        _line = Integer.parseInt(lineAttr);%0A      %7D%0A
       _f
@@ -871,30 +871,27 @@
 %7D%0A%0A  public 
-Str
 in
-g
+t
  getLine()%7B%0A

Return line as int