Skip to content

Commit 6251e96

Browse files
javadoc: HTML 5 tags; package is on 1st line in java src (#16)
1 parent 4094a03 commit 6251e96

31 files changed

Lines changed: 119 additions & 179 deletions

src/main/java/org/z3950/zing/cql/CQLAndNode.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package org.z3950.zing.cql;
32

43

@@ -10,6 +9,13 @@ public class CQLAndNode extends CQLBooleanNode {
109
/**
1110
* Creates a new AND node with the specified left- and right-hand
1211
* sides and modifiers.
12+
* @param left the left-hand side of the AND
13+
* @param right the right-hand side of the AND
14+
* @param ms the modifiers to apply to this AND
15+
* @see ModifierSet
16+
* @see CQLNode
17+
* @see CQLBoolean
18+
* @see CQLBooleanNode
1319
*/
1420
public CQLAndNode(CQLNode left, CQLNode right, ModifierSet ms) {
1521
super(left, right, ms, CQLBoolean.AND);
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
/*
2-
* Copyright (c) 1995-2016, Index Data
3-
* All rights reserved.
4-
* See the file LICENSE for details.
5-
*/
61
package org.z3950.zing.cql;
72

83
/**
9-
*
4+
* Represents a boolean operator in CQL.
105
* @author jakub
116
*/
127
public enum CQLBoolean {
13-
AND, OR, NOT, PROX;
8+
/** AND is the same as CQL's "and" */
9+
AND,
10+
/** OR is the same as CQL's "or" */
11+
OR,
12+
/** NOT is the same as CQL's "not" */
13+
NOT,
14+
/** PROX is the same as CQL's "prox" */
15+
PROX;
1416
}

src/main/java/org/z3950/zing/cql/CQLBooleanNode.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
package org.z3950.zing.cql;
2+
33
import java.util.List;
44
import java.util.Properties;
55

@@ -18,6 +18,7 @@ public CQLBoolean getOperator() {
1818

1919
/**
2020
* The root of a parse-tree representing the left-hand side.
21+
* @return the left operand of this boolean node
2122
*/
2223
public CQLNode getLeftOperand() {
2324
return left;
@@ -27,6 +28,7 @@ public CQLNode getLeftOperand() {
2728

2829
/**
2930
* The root of a parse-tree representing the right-hand side.
31+
* @return the right operand of this boolean node
3032
*/
3133
public CQLNode getRightOperand() {
3234
return right;
@@ -36,6 +38,7 @@ public CQLNode getRightOperand() {
3638

3739
/**
3840
* The set of modifiers that are applied to this boolean.
41+
* @return a list of Modifier objects, which may be empty.
3942
*/
4043
public List<Modifier> getModifiers() {
4144
return ms.getModifiers();
@@ -57,7 +60,6 @@ public void traverse(CQLNodeVisitor visitor) {
5760
visitor.onBooleanNodeEnd(this);
5861
}
5962

60-
6163
@Override
6264
void toXCQLInternal(XCQLBuilder b, int level,
6365
List<CQLPrefix> prefixes, List<ModifierSet> sortkeys) {

src/main/java/org/z3950/zing/cql/CQLDefaultNodeVisitor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* Copyright (c) 1995-2014, Index Data
3-
* All rights reserved.
4-
* See the file LICENSE for details.
5-
*/
6-
71
package org.z3950.zing.cql;
82

93
/**

src/main/java/org/z3950/zing/cql/CQLGenerator.java

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
21
package org.z3950.zing.cql;
2+
33
import java.util.Properties;
44
import java.util.Random;
55
import java.io.InputStream;
66
import java.io.FileInputStream;
7-
import java.io.FileNotFoundException;
8-
97

108
/**
119
* A generator that produces random CQL queries.
1210
* <P>
1311
* Why is that useful? Mainly to produce test-cases for CQL parsers
14-
* (including the <TT>CQLParser</TT> class in this package): you can
12+
* (including the <code>CQLParser</code> class in this package): you can
1513
* generate a random search tree, render it to XCQL and remember the
1614
* result. Then decompile the tree to CQL, feed the generated CQL to
1715
* the parser of your choice, and check that the XCQL it comes up with
1816
* is the same what you got from your initial rendering.
1917
* <P>
20-
* This code is based on the same grammar as the <TT>CQLParser</TT> class in
21-
* this distribution - there is a <TT>generate_<I>x</I>()</TT> method
18+
* This code is based on the same grammar as the <code>CQLParser</code> class in
19+
* this distribution - there is a <code>generate_<I>x</I>()</code> method
2220
* for each grammar element <I>X</I>.
2321
*
2422
* @see <A href="http://zing.z3950.org/cql/index.html"
@@ -31,67 +29,61 @@ public class CQLGenerator {
3129

3230
/**
3331
* Creates a new CQL generator with the specified parameters.
34-
* <P>
3532
* @param params
36-
* A <TT>Properties</TT> table containing configuration
33+
* A <code>Properties</code> table containing configuration
3734
* parameters for the queries to be generated by this generator.
38-
* Recognised parameters are:
3935
* <P>
36+
* Recognised parameters are:
37+
* </P>
4038
* <DL>
41-
* <DT><TT>seed</TT></DT>
39+
* <DT><code>seed</code></DT>
4240
* <DD>
43-
* If specified, this is a <TT>long</TT> used to seed the
41+
* If specified, this is a <code>long</code> used to seed the
4442
* random number generator, so that the CQL generator can be
4543
* run repeatably, giving the same results each time. If it's
4644
* omitted, then no seed is explicitly specified, and the
4745
* results of each run will be different (so long as you don't
4846
* run it more that 2^32 times :-)
49-
* <P>
5047
* </DD>
51-
* <DT><TT>complexQuery</TT></DT>
48+
* <DT><code>complexQuery</code></DT>
5249
* <DD>
5350
* [mandatory] A floating-point number between 0.0 and 1.0,
54-
* indicating the probability for each <TT>cql-query</TT> node
51+
* indicating the probability for each <code>cql-query</code> node
5552
* that it will be expanded into a ``complex query''
56-
* (<TT>cql-query&nbsp;boolean&nbsp;search-clause</TT>) rather
57-
* than a <TT>search-clause</TT>.
58-
* <P>
53+
* (<code>cql-query&nbsp;boolean&nbsp;search-clause</code>) rather
54+
* than a <code>search-clause</code>.
5955
* </DD>
60-
* <DT><TT>complexClause</TT></DT>
56+
* <DT><code>complexClause</code></DT>
6157
* <DD>
6258
* [mandatory] A floating-point number between 0.0 and 1.0,
63-
* indicating the probability for each <TT>search-clause</TT>
59+
* indicating the probability for each <code>search-clause</code>
6460
* node that it will be expanded into a full sub-query rather
65-
* than an <TT>[ index relation ] term</TT> triplet.
66-
* <P>
61+
* than an <code>[ index relation ] term</code> triplet.
6762
* </DD>
68-
* <DT><TT>proxOp</TT></DT>
63+
* <DT><code>proxOp</code></DT>
6964
* <DD>
7065
* [mandatory] A floating-point number between 0.0 and 1.0,
7166
* indicating the probability that each boolean operator will
7267
* be chosen to be proximity operation; otherwise, the three
73-
* simpler boolean operations (<TT>and</TT>, <TT>or</TT> and
74-
* <TT>not</TT>) are chosen with equal probability.
75-
* <P>
68+
* simpler boolean operations (<code>and</code>, <code>or</code> and
69+
* <code>not</code>) are chosen with equal probability.
7670
* </DD>
77-
* <DT><TT>equalsRelation</TT></DT>
71+
* <DT><code>equalsRelation</code></DT>
7872
* <DD>
7973
* [mandatory] A floating-point number between 0.0 and 1.0,
8074
* indicating the probability that each relation will be chosen
81-
* to be <TT>=</TT> - this is treated as a special case, since
75+
* to be <code>=</code> - this is treated as a special case, since
8276
* it's likely to be by far the most common relation in
8377
* ``real life'' searches.
84-
* <P>
8578
* </DD>
86-
* <DT><TT>numericRelation</TT></DT>
87-
* <DD>
79+
* <DT><code>numericRelation</code></DT>
80+
* <DD>q
8881
* [mandatory] A floating-point number between 0.0 and 1.0,
8982
* indicating the probability that a relation, having chosen
90-
* not to be <TT>=</TT>, is instead chosen to be one of the six
91-
* numeric relations (<TT>&lt;</TT>, <TT>&gt;</TT>,
92-
* <TT>&lt;=</TT>, <TT>&gt;=</TT>, <TT>&lt;&gt;</TT> and
93-
* <TT>=</TT>).
94-
* <P>
83+
* not to be <code>=</code>, is instead chosen to be one of the six
84+
* numeric relations (<code>&lt;</code>, <code>&gt;</code>,
85+
* <code>&lt;=</code>, <code>&gt;=</code>, <code>&lt;&gt;</code> and
86+
* <code>=</code>).
9587
* </DD>
9688
* </DL>
9789
*/
@@ -116,11 +108,11 @@ private static void debug(String str) {
116108
* when it was created. You are free to create as many random
117109
* queries as you wish from a single generator; each of them will
118110
* use the same parameters.
119-
* <P>
111+
* </P>
120112
* @return
121-
* A <TT>CQLNode</TT> that is the root of the generated tree.
122-
* That tree may be rendered in XCQL using its <TT>toXCQL()</TT>
123-
* method, or decompiled into CQL using its <TT>toCQL</TT>
113+
* A <code>CQLNode</code> that is the root of the generated tree.
114+
* That tree may be rendered in XCQL using its <code>toXCQL()</code>
115+
* method, or decompiled into CQL using its <code>toCQL</code>
124116
* method.
125117
*/
126118
public CQLNode generate() throws MissingParameterException {
@@ -264,9 +256,9 @@ boolean maybe(String param) throws MissingParameterException {
264256
* decompiles it into CQL which is written to standard output.
265257
* <P>
266258
* For example,
267-
* <TT>java org.z3950.zing.cql.CQLGenerator
268-
* etc/generate.properties seed 18398</TT>,
269-
* where the file <TT>generate.properties</TT> contains:<PRE>
259+
* <code>java org.z3950.zing.cql.CQLGenerator
260+
* etc/generate.properties seed 18398</code>,
261+
* where the file <code>generate.properties</code> contains:<PRE>
270262
* complexQuery=0.4
271263
* complexClause=0.4
272264
* equalsRelation=0.5

src/main/java/org/z3950/zing/cql/CQLLexer.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/*
2-
* Copyright (c) 1995-2014, Index Datassss
3-
* All rights reserved.
4-
* See the file LICENSE for details.
5-
*/
61
package org.z3950.zing.cql;
72

83
import java.io.BufferedReader;

src/main/java/org/z3950/zing/cql/CQLNode.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
21
package org.z3950.zing.cql;
2+
33
import java.util.HashMap;
44
import java.util.List;
55
import java.util.Map;
66
import java.util.Properties;
77

8-
9-
108
/**
119
* Represents a node in a CQL parse-tree.
1210
*
@@ -29,7 +27,6 @@ public String getResultSetName() {
2927

3028
/**
3129
* Translates a parse-tree into an XCQL document.
32-
* <P>
3330
* @return
3431
* A String containing an XCQL document equivalent to the
3532
* parse-tree whose root is this node.
@@ -79,7 +76,6 @@ static void renderSortKeys(XCQLBuilder b, int level,
7976

8077
/**
8178
* Decompiles a parse-tree into a CQL query.
82-
* <P>
8379
* @return
8480
* A String containing a CQL query equivalent to the parse-tree
8581
* whose root is this node, so that compiling that query will
@@ -96,17 +92,20 @@ static void renderSortKeys(XCQLBuilder b, int level,
9692
* <A href="http://indexdata.dk/yaz/doc/tools.php#PQF"
9793
* >Chapter 7 (Supporting Tools)</A> of the
9894
* <A href="http://indexdata.dk/yaz/">YAZ</A> manual.
99-
* <P>
10095
* @param config
101-
* A <TT>Properties</TT> object containing configuration
96+
* A <code>Properties</code> object containing configuration
10297
* information that specifies the mapping from CQL indexes,
10398
* relations, etc. to Type-1 attributes. The mapping
10499
* specification is described in the CQL-Java distribution's
105100
* sample PQF-mapping configuration file,
106-
* <TT>etc/pqf.properties</TT>, which see.
101+
* <code>etc/pqf.properties</code>, which see.
107102
* @return
108103
* A String containing a PQF query equivalent to the parse-tree
109104
* whose root is this node.
105+
* @throws PQFTranslationException
106+
* If the parse-tree cannot be translated into PQF, for example
107+
* because it contains a CQL relation that is not supported by the
108+
* PQF configuration.
110109
*/
111110
abstract public String toPQF(Properties config)
112111
throws PQFTranslationException;
@@ -118,17 +117,21 @@ abstract public String toPQF(Properties config)
118117
* primarily for SRW-to-Z39.50 gateways.
119118
*
120119
* @param config
121-
* A <TT>Properties</TT> object containing configuration
120+
* A <code>Properties</code> object containing configuration
122121
* information that specifies the mapping from CQL indexes,
123122
* relations, etc. to Type-1 attributes. The mapping
124123
* specification is described in the CQL-Java distribution's
125124
* sample PQF-mapping configuration file,
126-
* <TT>etc/pqf.properties</TT>, which see.
125+
* <code>etc/pqf.properties</code>, which see.
127126
* @return
128127
* A byte array containing the BER packet.
129128
* @see
130129
* <A href="ftp://ftp.rsasecurity.com/pub/pkcs/ascii/layman.asc"
131130
* >ftp://ftp.rsasecurity.com/pub/pkcs/ascii/layman.asc</A>
131+
* @throws PQFTranslationException
132+
* If the parse-tree cannot be translated into PQF, for example
133+
* because it contains a CQL relation that is not supported by the
134+
* PQF configuration.
132135
*/
133136
abstract public byte[] toType1BER(Properties config)
134137
throws PQFTranslationException;

src/main/java/org/z3950/zing/cql/CQLNodeVisitor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* Copyright (c) 1995-2014, Index Data
3-
* All rights reserved.
4-
* See the file LICENSE for details.
5-
*/
6-
71
package org.z3950.zing.cql;
82

93
/**

src/main/java/org/z3950/zing/cql/CQLNotNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
21
package org.z3950.zing.cql;
32

4-
53
/**
64
* Represents a NOT node in a CQL parse-tree.
75
*

src/main/java/org/z3950/zing/cql/CQLOrNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
21
package org.z3950.zing.cql;
32

4-
53
/**
64
* Represents an OR node in a CQL parse-tree.
75
*

0 commit comments

Comments
 (0)