// This file is copyrighted and is part of nzdis-oql package.
// See the file LICENSE for copyright information and the terms and conditions for copying, distributing and modifications of nzdis-oql package.
// @copyright@
package nzdis.lang.oql;
/**/
import nzdis.lang.oql.analysis.DepthFirstAdapter;
import nzdis.lang.oql.node.*;
import java.util.Hashtable;
/**
* Represents an utility class via which the node substitution can be
* easily made.
*
*
* QueryBuilder.java
* Created: Fri Feb 25 12:30:12 2000
*
* @author Mariusz Nowostawski
* @version @version@ $Revision: 1.1 $
*/
public class QueryBuilder extends DepthFirstAdapter {
Node ast;
Hashtable context;
public QueryBuilder() {
this.context = new Hashtable();
}
public void setContext(Hashtable context){
this.context = context;
}
public void setNode(Node ast){
this.ast = ast;
}
/**
* Returns the string representation of the query. */
public String getQueryString(){
final Oql2AsciiWalker w = new Oql2AsciiWalker();
final OqlOutputStrategyString s = new OqlOutputStrategyString();
w.setStategy(s);
w.setContext(this.context);
ast.apply(w);
return s.toAscii().toString();
}
} // QueryAnalyser
//////////////////// end of file ////////////////////