KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > query > regexptrees > RegexpTreeGenerator


1 /*
2   (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP, all rights reserved.
3   [See end of file]
4   $Id: RegexpTreeGenerator.java,v 1.8 2005/02/21 11:52:29 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.graph.query.regexptrees;
8
9 import java.util.List JavaDoc;
10
11 /**
12      A RegexpTreeGenerator supplies appropriate RegexpTrees; different users
13      of the RegexpTree parsers can supply specialised generators that produce
14      instances appropriate to their needs, or fail by throwing an exception.
15      @author hedgehog
16 */

17 public interface RegexpTreeGenerator
18     {
19     /**
20          Answer some instance of AnySingle (a pattern that matches any one
21          character). May return the same instance on each call.
22     */

23     public abstract RegexpTree getAnySingle();
24
25     /**
26          Answer some instance of StartOfLine (a pattern that matches the start of
27          a line). May return the same instance on each call.
28     */

29     public abstract RegexpTree getStartOfLine();
30
31     /**
32          Answer some instance of EndOfLine (a pattern that matches the end of
33          a line). May return the same instance on each call.
34     */

35     public abstract RegexpTree getEndOfLine();
36
37     /**
38          Answer some instance of Text which matches the literal character
39          <code>ch</code>.
40     */

41     public abstract RegexpTree getText( char ch );
42
43     /**
44          Answer an instance of ZeroOrMore with repeated content <code>d</code>.
45     */

46     public abstract RegexpTree getZeroOrMore( RegexpTree d );
47
48     /**
49          Answer an instance of OneOrMore with repeated content <code>d</code>.
50     */

51     public abstract RegexpTree getOneOrMore( RegexpTree d );
52
53     /**
54          Answer an instance of Optional with content <code>d</code>.
55     */

56     public abstract RegexpTree getOptional( RegexpTree d );
57
58     /**
59          Answer a RegexpTree which for matching the sequence of operands
60          in the list. Every element must be a RegexpTree. If the list contains
61          exactly one element, it is strongly recommended that that element be
62          returned. If the list is empty, it is recommended that Nothing be returned.
63     */

64     public abstract RegexpTree getSequence( List JavaDoc operands );
65
66     /**
67          Answer a RegexpTree for matching one of a set of alternative operand
68          expressions from the list. Every element must be a RegexpTree. If the
69          list has exactly one element, it is recommended that that element be
70          returned.
71     */

72     public abstract RegexpTree getAlternatives( List JavaDoc operands );
73
74     /**
75          Answer an empty RegexpTree (corresponding to nothing in a parsed
76          expression, and matching the empty string).
77     */

78     public abstract RegexpTree getNothing();
79
80     /**
81          Answer a RegexpTree that encodes a match which accepts (reject=false)
82          or rejects (reject=true) any (all) of the characters in <code>chars</code>.
83     */

84     public abstract RegexpTree getClass( String JavaDoc chars, boolean reject );
85     
86     /**
87          Answer a RegexpTree that wraps parentheses around an operand. The
88          index is non-zero if this is a back-reference referrable object.
89     */

90     public abstract RegexpTree getParen( RegexpTree operand, int index );
91
92     /**
93          Answer a RegexpTree that refers back to noted parenthesisation n.
94     */

95     public abstract RegexpTree getBackReference( int n );
96     }
97
98 /*
99     (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP
100     All rights reserved.
101     
102     Redistribution and use in source and binary forms, with or without
103     modification, are permitted provided that the following conditions
104     are met:
105     
106     1. Redistributions of source code must retain the above copyright
107        notice, this list of conditions and the following disclaimer.
108     
109     2. Redistributions in binary form must reproduce the above copyright
110        notice, this list of conditions and the following disclaimer in the
111        documentation and/or other materials provided with the distribution.
112     
113     3. The name of the author may not be used to endorse or promote products
114        derived from this software without specific prior written permission.
115     
116     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
117     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
118     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
119     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
120     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
121     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
122     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
123     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
124     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
125     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
126 */
Popular Tags