summaryrefslogtreecommitdiffstats
path: root/src/syntaxParser/GeneralCondenseExpr.java
blob: 397e36ad2a71779bcfe8786d5cebd0053e4e14c1 (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
package syntaxParser;
/**
 * GeneralCondenseExpr
 * Creation date: (3/3/2003 2:28:43 AM)
 * @author: mattia parigiani, Sorin stancu-Mara
 */
class GeneralCondenseExpr implements IParseTreeNode {
	
	String condenseOpType;
	ScalarExpr scalarExpr;
	VariableList variables;
	BooleanScalarExpr condition;

	public GeneralCondenseExpr(String op, VariableList vars, ScalarExpr val) {
	    condenseOpType = op;
	    variables = vars;
	    scalarExpr = val;
	}
	
	public GeneralCondenseExpr(String op, VariableList vars, BooleanScalarExpr cond, ScalarExpr val) {
	    condenseOpType = op;
	    variables = vars;
	    scalarExpr = val;
	    condition = cond;
	}	
	
	public String toXML(){
    	    String result = "<condense>" + variables.toXML();
	    if (condition !=  null) 
	        result += "<where>" + condition.toXML() + "</where>";
	    result += scalarExpr.toXML() + "</condense>"; 	
	    return result;
	}
	

	
}