summaryrefslogtreecommitdiffstats
path: root/src/syntaxParser/SetMetaDataExpr.java
blob: e8624b791a4e0f08dbaf2ea5eb5eb5cdb094f281 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package syntaxParser;
/**
 * SetMetaDataExpr
 * Creation date: (3/3/2003 2:28:43 AM)
 * @author: mattia parigiani, Sorin Stancu-Mara
 */
class SetMetaDataExpr implements IParseTreeNode {

	String function;
	CoverageExpr expr;
	IParseTreeNode param;
	String field;

	public SetMetaDataExpr(String op, CoverageExpr expr,IParseTreeNode param) {
		function = op;
		this.expr = expr;
		this.param = param;
	}
	public SetMetaDataExpr(String op, CoverageExpr expr, IParseTreeNode param, String field) {
		function = op;
		this.expr = expr;
		this.param = param;
	}
	
	public String toXML(){
		String result=  ""  ;

		if (function.equals("setNullDefault")) {
			result = "<setNullDefault>" + "<null>" +  param.toXML()  + "</null>"
				+ expr.toXML() 
				+ "</setNullDefault>";
		} else if (function.equals("setNullSet")) {
			result = "<setNullSet>";
			RangeValueList list = (RangeValueList) param;
			list.setTag("null");
			result += list.toXML();
			result += expr.toXML() + "</setNullSet>";
		} else if (function.equals("setInterpolationDefault")) {
			result = "<setInterpolationDefault><field>" + field + "</field>" 
				+ param.toXML()	+ expr.toXML() + "</setInterpolationDefault>";
		} else if (function.equals("setInterpolationSet")) {
			result = "<setInterpolationSet><field>" + field + "</field>" + param.toXML() +
					 expr.toXML() + "</setInterpolationSet>";
		} else if (function.equals("setCrsSet")) {
			// TODO(smsorin): schema/grammar inconsistencies
			result += "<setCrsSet>" + expr.toXML()  
				+ "</setCrsSet>";
		}	

		result+=  "";
		return result;
	}
	
}