summaryrefslogtreecommitdiffstats
path: root/src/syntaxParser/BinaryInducedExpr.java
blob: fd34bda4c035fc605990260671ca11204adf8781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package syntaxParser;
/**
 * BinaryInducedExpr
 * Creation date: (3/3/2003 2:28:43 AM)
 * @author: mattia parigiani, Sorin Stancu-Mara
 */
class BinaryInducedExpr implements IParseTreeNode {

	IParseTreeNode leftCoverageExpr;
	IParseTreeNode rightCoverageExpr;
    int wrapInScalar;
	String operator;

	public BinaryInducedExpr(  String o, IParseTreeNode le, IParseTreeNode re ){	
		leftCoverageExpr = le;
		rightCoverageExpr = re;
        wrapInScalar = 0;
		operator = o;
	}
	public BinaryInducedExpr(  String o, IParseTreeNode le, IParseTreeNode re, int wis ){	
		leftCoverageExpr = le;
		rightCoverageExpr = re;
        wrapInScalar = wis;
		operator = o;
	}
	public String toXML(){
		String result="";
		result = "<" + operator + ">";
        if (wrapInScalar == -1) result += "<scalar>";
		result += leftCoverageExpr.toXML();
        if (wrapInScalar == -1) result += "</scalar>";
        if (wrapInScalar == 1) result += "<scalar>";
		result += rightCoverageExpr.toXML();
        if (wrapInScalar == 1) result += "</scalar>";
		result += "</" + operator + ">";
		return result;
	}
}