source: VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/query/RelationNode.java @ 213

Last change on this file since 213 was 213, checked in by oschonef, 14 years ago
  • implement basic search feature
  • Property svn:eol-style set to native
File size: 778 bytes
Line 
1package eu.clarin.cmdi.virtualcollectionregistry.query;
2
3import org.antlr.runtime.Token;
4import org.antlr.runtime.tree.CommonTree;
5
6class RelationNode extends CommonTree implements ParseTreeNode {
7        public static enum Relation { EQ, NE };
8        private Relation relation;
9       
10        public RelationNode(Token token) {
11                super(token);
12                this.relation = fromType(token.getType());
13        }
14
15        public Relation getRelation() {
16                return this.relation;
17        }
18
19        public void accept(ParseTreeNodeVisitor visitor) {
20                visitor.visit(this);
21        }
22
23        private static Relation fromType(int type) {
24                switch (type) {
25                case VCRQLLexer.EQ:
26                        return Relation.EQ;
27                case VCRQLLexer.NE:
28                        return Relation.NE;                     
29                default:
30                        throw new IllegalArgumentException("bad relation type: " + type);
31                }
32        }
33
34} // class RelationNode
Note: See TracBrowser for help on using the repository browser.