01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query.parser.serql.ast;
07:
08: import java.util.List;
09:
10: import info.aduna.collections.CastingList;
11:
12: public class ASTFrom extends SimpleNode {
13:
14: public ASTFrom(int id) {
15: super (id);
16: }
17:
18: public ASTFrom(SyntaxTreeBuilder p, int id) {
19: super (p, id);
20: }
21:
22: @Override
23: public Object jjtAccept(SyntaxTreeBuilderVisitor visitor,
24: Object data) throws VisitorException {
25: return visitor.visit(this , data);
26: }
27:
28: public boolean hasContextID() {
29: return getContextID() != null;
30: }
31:
32: public ASTValueExpr getContextID() {
33: Node firstNode = children.get(0);
34:
35: if (firstNode instanceof ASTValueExpr) {
36: return (ASTValueExpr) firstNode;
37: }
38:
39: return null;
40: }
41:
42: public List<ASTPathExpr> getPathExprList() {
43: if (this .hasContextID()) {
44: return new CastingList<ASTPathExpr>(children.subList(1,
45: children.size()));
46: } else {
47: return new CastingList<ASTPathExpr>(children);
48: }
49: }
50: }
|