|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pl.edu.pjwstk.yaod.yaql.visitors.EvalVisitor
The EvalVisitor
class represents one of the interpratations
of the program - in this case evaluataion. It consists of
many visit
methods - each for one main node in abstract syntax
tree.
AbstractSyntaxTree
,
Visitor
,
EvalException
Constructor Summary | |
EvalVisitor(java.io.PrintWriter wr,
QueryResultStack QRES,
EnvironmentalStack ENVS,
SVRP SP,
java.util.Vector results)
Creates a new evaluator with specified environmental stack, query result stack, abstract syntax tree, server process, writer and vector of results. |
Method Summary | |
QueryResult |
combine(NonAlgebraicExpression n,
QueryResult e,
QueryResult tmp)
Auxilary method responsible for evaluating binary non algebraic expression nodes. |
boolean |
compare(QueryResult l,
QueryResult r)
Auxilary method responsible for evaluating binary non algebraic expression node - precisely SortingExpression . |
void |
compareAndReplace(SequenceValue seq,
int i,
int j,
int z)
Auxilary method responsible for evaluating binary non algebraic expression node - precisely SortingExpression . |
QueryResult |
compute(AlgebraicExpression n,
QueryResult l,
QueryResult r)
Auxilary method responsible for evaluating binary expression nodes. |
QueryResult |
compute(NonParametricExpression n,
QueryResult r)
Auxilary method responsible for evaluating unary expression nodes. |
QueryResult |
compute(ParametricExpression n,
QueryResult l,
QueryResult r)
Auxilary method responsible for evaluating unary expression nodes. |
QueryResult |
compute(SingleExpression n)
Auxilary method responsible for evaluating single expression nodes. |
QueryResult |
compute(TernaryExpression n,
QueryResult l,
QueryResult m,
QueryResult r)
Auxilary method responsible for evaluating ternary expression nodes. |
ObjectID |
getEntry()
Returns the entry of the object store. |
ObjectManager |
getObjectManager()
Returns the object manager of the object store. |
QueryResult |
merge(NonAlgebraicExpression n,
BagValue bag)
Auxilary method responsible for evaluating binary non algebraic expression nodes. |
void |
visit(AlgebraicExpression n)
Method responsible for traversing certain binary node in abstract syntax tree. |
void |
visit(BlockStatement n)
Method responsible for traversing node representing block statement ( { ... } ) in abstract syntax tree. |
void |
visit(BreakStatement n)
Method responsible for traversing node representing break statement ( break ; )in abstract syntax tree. |
void |
visit(DeleteStatement n)
Method responsible for traversing node representing delete statement ( delet ... |
void |
visit(DoWhileStatement n)
Method responsible for traversing node representing do while statement ( do ... while (...) |
void |
visit(EmptyBlockStatement n)
Method responsible for traversing node representing empty block statement ( { } ) in abstract syntax tree. |
void |
visit(EmptyProcedureDeclarationStatement n)
Method responsible for traversing node representing empty procedure declaration statement (procedure without parameters) ( procedure/function id() { ... } ) in abstract syntax tree. |
void |
visit(EmptyReturnStatement n)
Method responsible for traversing node representing empty return statement ( return ; ) in abstract syntax tree. |
void |
visit(EmptyStatement n)
Method responsible for traversing node representing empty statement ( ; ) in abstract syntax tree. |
void |
visit(ExpressionStatement n)
Method responsible for traversing node representing expression statement ( ... |
void |
visit(ForEachStatement n)
Method responsible for traversing node representing for each statement ( for each ... do ... ) in abstract syntax tree. |
void |
visit(ForStatement n)
Method responsible for traversing node representing for statement ( for (...; ...; ...) |
void |
visit(IfElseStatement n)
Method responsible for traversing node representing if else statement ( if (...) |
void |
visit(IfStatement n)
Method responsible for traversing node representing if statement ( if (...) |
void |
visit(InsertIntoStatement n)
Method responsible for traversing node representing insert into statement ( insert ... into ... |
void |
visit(LastStatementList n)
Method responsible for traversing node representing last statement list ( ... |
void |
visit(NonAlgebraicExpression n)
Method responsible for traversing certain binary node in abstract syntax tree. |
void |
visit(NonParametricExpression n)
Method responsible for traversing certain unary node in abstract syntax tree. |
void |
visit(PairStatementList n)
Method responsible for traversing node representing pair statement list ( ... |
void |
visit(ParametricExpression n)
Method responsible for traversing certain unary node in abstract syntax tree. |
void |
visit(PrintStatement n)
Method responsible for traversing node representing print statement ( print (...) |
void |
visit(ProcedureDeclarationStatement n)
Method responsible for traversing node representing procedure declaration statement ( procedure/function id(...) { |
void |
visit(RenameToStatement n)
Method responsible for traversing node representing rename to statement ( rename ... to ... |
void |
visit(ReturnStatement n)
Method responsible for traversing node representing return statement ( return ...; ) in abstract syntax tree. |
void |
visit(ShowStatement n)
Method responsible for traversing node representing show statement ( show (...) |
void |
visit(SingleExpression n)
Method responsible for traversing certain single node in abstract syntax tree. |
void |
visit(TernaryExpression n)
Method responsible for traversing certain ternary node in abstract syntax tree. |
void |
visit(UpdateToStatement n)
Method responsible for traversing node representing update to statement ( update ... to ... |
void |
visit(WhileStatement n)
Method responsible for traversing node representing while statement ( while (...) |
void |
visit(XmlPrintStatement n)
Method responsible for traversing node representing xmlprint statement ( xmlprint (...) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EvalVisitor(java.io.PrintWriter wr, QueryResultStack QRES, EnvironmentalStack ENVS, SVRP SP, java.util.Vector results)
wr
- an object responsible for displaying information.QRES
- a query result stack.ENVS
- an environmental stack.SP
- a link to data store (server process).results
- vector of results of evaluation.QueryResultStack
,
EnvironmentalStack
,
SVRP
Method Detail |
public ObjectID getEntry()
ObjectID
,
SVRP
public ObjectManager getObjectManager()
ObjectManager
,
SVRP
public void visit(SingleExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain single node in abstract syntax tree.EvalException
- if evaluation in this node fails.SingleExpression
public void visit(ParametricExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain unary node in abstract syntax tree.EvalException
- if evaluation in this node fails.UnaryExpression
,
ParametricExpression
public void visit(NonParametricExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain unary node in abstract syntax tree.EvalException
- if evaluation in this node fails.UnaryExpression
,
NonParametricExpression
public void visit(AlgebraicExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain binary node in abstract syntax tree.EvalException
- if evaluation in this node fails.BinaryExpression
,
AlgebraicExpression
public void visit(NonAlgebraicExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain binary node in abstract syntax tree.EvalException
- if evaluation in this node fails.BinaryExpression
,
NonAlgebraicExpression
public void visit(TernaryExpression n) throws EvalException
visit
in interface Visitor
n
- is a certain ternary node in abstract syntax tree.EvalException
- if evaluation in this node fails.TernaryExpression
public void visit(EmptyStatement n) throws EvalException
;
) in abstract syntax tree.visit
in interface Visitor
n
- is a empty statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.EmptyStatement
public void visit(ExpressionStatement n) throws EvalException
... ;
)in abstract syntax tree.visit
in interface Visitor
n
- is a expression statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ExpressionStatement
public void visit(PrintStatement n) throws EvalException
print (...) ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a print statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.PrintStatement
public void visit(XmlPrintStatement n) throws EvalException
xmlprint (...) ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a xmlprint statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.XmlPrintStatement
public void visit(ShowStatement n) throws EvalException
show (...) ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a show statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ShowStatement
public void visit(BlockStatement n) throws EvalException
{ ... }
) in abstract syntax tree.visit
in interface Visitor
n
- is a block statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.BlockStatement
public void visit(EmptyBlockStatement n) throws EvalException
{ }
) in abstract syntax tree.visit
in interface Visitor
n
- is a empty block statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.EmptyBlockStatement
public void visit(IfStatement n) throws EvalException
if (...) ...
) in abstract syntax tree.visit
in interface Visitor
n
- is a if statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.IfStatement
public void visit(IfElseStatement n) throws EvalException
if (...) ... else ...
) in abstract syntax tree.visit
in interface Visitor
n
- is a if else statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.IfElseStatement
public void visit(WhileStatement n) throws EvalException
while (...) ...
) in abstract syntax tree.visit
in interface Visitor
n
- is a while statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.WhileStatement
public void visit(ForStatement n) throws EvalException
for (...; ...; ...) ...
) in abstract syntax tree.visit
in interface Visitor
n
- is a for statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ForStatement
public void visit(DoWhileStatement n) throws EvalException
do ... while (...) ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a do while statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.DoWhileStatement
public void visit(ForEachStatement n) throws EvalException
for each ... do ...
) in abstract syntax tree.visit
in interface Visitor
n
- is a for each statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ForEachStatement
public void visit(DeleteStatement n) throws EvalException
delet ... ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a delete statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.DeleteStatement
public void visit(RenameToStatement n) throws EvalException
rename ... to ... ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a rename to statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.RenameToStatement
public void visit(InsertIntoStatement n) throws EvalException
insert ... into ... ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a insert into statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.InsertIntoStatement
public void visit(UpdateToStatement n) throws EvalException
update ... to ... ;
)in abstract syntax tree.visit
in interface Visitor
n
- is a update to statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.UpdateToStatement
public void visit(EmptyProcedureDeclarationStatement n) throws EvalException
procedure/function id() { ... }
) in abstract syntax tree.visit
in interface Visitor
n
- is a empty procedure declaration statement node in abstract
syntax tree.EvalException
- if evaluation in this node fails.EmptyProcedureDeclarationStatement
public void visit(ProcedureDeclarationStatement n) throws EvalException
procedure/function id(...) { ... }
) in abstract
syntax tree.visit
in interface Visitor
n
- is a procedure declaration statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ProcedureDeclarationStatement
public void visit(BreakStatement n) throws EvalException
break ;
)in abstract syntax tree.visit
in interface Visitor
n
- is a break statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.BreakStatement
public void visit(ReturnStatement n) throws EvalException
return ...;
) in abstract syntax tree.visit
in interface Visitor
n
- is a return statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.ReturnStatement
public void visit(EmptyReturnStatement n) throws EvalException
return ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a empty return statement node in abstract syntax tree.EvalException
- if evaluation in this node fails.EmptyReturnStatement
public void visit(PairStatementList n) throws EvalException
... ; ... ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a pair statement list node in abstract syntax tree.EvalException
- if evaluation in this node fails.PairStatementList
public void visit(LastStatementList n) throws EvalException
... ;
) in abstract syntax tree.visit
in interface Visitor
n
- is a last statement list node in abstract syntax tree.EvalException
- if evaluation in this node fails.LastStatementList
public QueryResult compute(SingleExpression n) throws EvalException
n
- is a certain single expression node in abstract syntax tree.EvalException
- if evaluation in this node fails.SingleExpression
public QueryResult compute(ParametricExpression n, QueryResult l, QueryResult r) throws EvalException
n
- is a certain unary expression node in abstract syntax tree.l
- is a left operand.r
- is a right operand.EvalException
- if evaluation in this node fails.UnaryExpression
,
ParametricExpression
,
QueryResult
public QueryResult compute(NonParametricExpression n, QueryResult r) throws EvalException
n
- is a certain unary expression node in abstract syntax tree.r
- is a right operand.EvalException
- if evaluation in this node fails.UnaryExpression
,
NonParametricExpression
,
QueryResult
public QueryResult compute(AlgebraicExpression n, QueryResult l, QueryResult r) throws EvalException
n
- is a certain binary expression node in abstract syntax tree.l
- is a left operand.r
- is a right operand.EvalException
- if evaluation in this node fails.BinaryExpression
,
AlgebraicExpression
,
QueryResult
public QueryResult compute(TernaryExpression n, QueryResult l, QueryResult m, QueryResult r) throws EvalException
n
- is a certain ternary expression node in abstract syntax tree.l
- is a left operand.m
- is a middle operand.r
- is a right operand.EvalException
- if evaluation in this node fails.TernaryExpression
,
QueryResult
public QueryResult combine(NonAlgebraicExpression n, QueryResult e, QueryResult tmp) throws EvalException
n
- is a certain binary expression node in abstract syntax tree.e
- is one of the results of the left operand evaluation.tmp
- is a the result of nested(e)
.EvalException
- if evaluation in this node fails.BinaryExpression
,
NonAlgebraicExpression
,
QueryResult
public QueryResult merge(NonAlgebraicExpression n, BagValue bag) throws EvalException
n
- is a certain binary expression node in abstract syntax tree.bag
- is the set of all partial results yielded by method combine
.tmp
- is a the result of nested(e)
.EvalException
- if evaluation in this node fails.BinaryExpression
,
NonAlgebraicExpression
,
BagValue
public void compareAndReplace(SequenceValue seq, int i, int j, int z) throws TypeMismatchException
SortingExpression
. Its goal is to compare two
elemens with indexes i
and j
and replace them
if there is such need.bag
- is the set of all partial results yielded by method combine
.i
- the index of the first element to compare.j
- the index of the second element to compare.z
- the number of the sorting key.TypeMismatchException
- if evaluation in this node fails.BinaryExpression
,
NonAlgebraicExpression
,
SequenceValue
public boolean compare(QueryResult l, QueryResult r) throws TypeMismatchException
SortingExpression
. Its goal is to compare two
elements and if they are comparable and the first element is greater than
second the result is true
, otherwise the result
is false
.l
- the first element to compare.r
- the second element to compare.TypeMismatchException
- if evaluation in this node fails.BinaryExpression
,
NonAlgebraicExpression
,
QueryResult
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |