db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r171353 [13/13] - in /incubator/jdo/trunk/query20: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/jdoql/ src/java/org/apache/jdo/impl/jdoql/jdoqlc/ src/java/org/apache/jdo/impl/jdoql/scope/ src/java/org/apache/jdo/impl/jdoql/tree/ src/java/org/apache/jdo/jdoql/ src/java/org/apache/jdo/jdoql/tree/
Date Sun, 22 May 2005 18:09:00 GMT
Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotEqualsExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotEqualsExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotEqualsExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotEqualsExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a not equals operator.
+ * A not equals operator is a binary expression.
+ * The string representation of this operator is <code>!=</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface NotEqualsExpression extends BinaryExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/NotExpression.java Sun
May 22 11:08:57 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a logical not operator.
+ * A logical not operator is a unary expression.
+ * The string representation of this operator is <code>!</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface NotExpression extends UnaryExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrExpression.java Sun May
22 11:08:57 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a bitwise or logical or operator depending on the result
+ * types of its children. A bitwise operator is based on arithmetical types.
+ * In contrast, a logical operator is based on boolean types.
+ * The string representation of this operator is <code>|</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface OrExpression extends BinaryExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrderingExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrderingExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrderingExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/OrderingExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents an ordering expression. Examples of ordering expressions
+ * are <code>AscendingOrderingExpression</code> and
+ * <code>DescendingOrderingExpression</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface OrderingExpression extends Node
+{
+    /**
+     * Returns the node's ordering expression.
+     * @return the node's expression
+     */
+    public Expression getOrdering();
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterAccessExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterAccessExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterAccessExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterAccessExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a parameter access expression.
+ * It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface ParameterAccessExpression extends IdentifierExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterDeclaration.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterDeclaration.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterDeclaration.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ParameterDeclaration.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a parameter access expression.
+ * It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface ParameterDeclaration extends Declaration
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/PlusExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/PlusExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/PlusExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/PlusExpression.java Sun
May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a binary plus operator.
+ * The string representation of this operator is <code>+</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface PlusExpression extends BinaryExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/QueryTree.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/QueryTree.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/QueryTree.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/QueryTree.java Sun May
22 11:08:57 2005
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Instances of classes implementing this interface
+ * represent the root of a query tree.
+ * You can use these intances to factorize this node's children, as there are
+ * candidate class, declarations, filter expression and
+ * ordering expressions as children.
+ *
+ * @author Michael Watzek
+ */
+public interface QueryTree extends ExpressionFactory, Node
+{
+    /**
+     * Sets the candidate class for this query tree.
+     * @param clazz the candidate class
+     */
+    public void setCandidateClass(Class clazz);
+
+    /**
+     * Declares a parameter for this query tree.
+     * Once you have declared a parameter, you can access it using method
+     * <code>newIdentifier</code>.
+     * @param type the instance of a Java class which is the type of the declared parameter
+     * @param parameter the name of the declared parameter
+     */
+    public void declareParameter(Class type, String parameter);
+
+    /**
+     * Declares a variable for this query tree.
+     * Once you have declared a variable, you can access it using method
+     * <code>newIdentifier</code>.
+     * @param type the instance of a Java class which is the type of the declared variable
+     * @param variable the name of the declared variable
+     */
+    public void declareVariable(Class type, String variable);
+
+    /**
+     * Sets the filter expression for this query tree.
+     * @param filter the filter expression
+     */
+    public void setFilter(Expression filter);
+
+    /**
+     * Adds an ascending ordering expression to this query tree.
+     * The order of adding ascending and descending ordering expressions defines
+     * the order of instances in the result collection of an executed query
+     * instance corresponding with this query tree.
+     * @param expression the order expression
+     */
+    public void addAscendingOrdering(Expression expression);
+
+    /**
+     * Adds an descending ordering expression to this query tree.
+     * The order of adding ascending and descending ordering expressions defines
+     * the order of instances in the result collection of an executed query
+     * instance corresponding with this query tree.
+     * @param expression the order expression
+     */
+    public void addDescendingOrdering(Expression expression);
+
+    /**
+     * Returns the candidate class.
+     * @return the candidate class
+     */
+    public Class getCandidateClass();
+
+
+    /**
+     * Returns a map containing all declared parameters.
+     * This map contains parameter names as keys and instances of
+     * <code>ParameterDeclaration</code> as values.
+     * @return the map of declared parameters
+     */
+    public Map getDeclaredParameters();
+    /**
+     * Returns a map containing all declared variables.
+     * This map contains variable names as keys and instances of
+     * <code>VariableDeclaration</code> as values.
+     * @return the map of declared variables
+     */
+    public Map getDeclaredVariables();
+
+    /**
+     * Returns a list of all declared parameters. The order of entries is
+     * defined by the order of calls <code>declareParameter</code>.
+     * This list contains instances of
+     * <code>ParametersDeclaration</code> as entries.
+     * @return the list of declared parameters
+     */
+    public List getDeclaredParametersAsList();
+
+    /**
+     * Returns the filter expression of this query tree.
+     * @return the filter or null.
+     */
+    public Expression getFilter();
+
+    /**
+     * Returns a list of all added ordering expressions.
+     * The order of entries is defined by the order of calls
+     * <code>addAscendingOrdering</code> and <code>addDescendingOrdering</code>.
+     * This list contains instances of
+     * <code>OrderingExpression</code> as entries.
+     * @return the list of declared parameters
+     */
+    public List getOrderingExpressions();
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ShortLiteralExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ShortLiteralExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ShortLiteralExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ShortLiteralExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a short literal. It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface ShortLiteralExpression extends ConstantExpression
+{
+    /**
+     * Returns the short value represented by this expression.
+     * @return the short value
+     */
+    public short getShort();
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StartsWithCallExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StartsWithCallExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StartsWithCallExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StartsWithCallExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents the method call expression
+ * <code>String.startsWith</code>. Children of this node are a target
+ * expression (e.g. a <code>FieldAccessExpression</code>) and the method
+ * argument which is an arbitrary expression.
+ *
+ * @author Michael Watzek
+ */
+public interface StartsWithCallExpression extends MethodCallExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StaticFieldAccessExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StaticFieldAccessExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StaticFieldAccessExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/StaticFieldAccessExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+import javax.jdo.PersistenceManager;
+
+import org.apache.jdo.jdoql.JDOQueryException;
+
+/**
+ * This node represents a static field access expression.
+ * It inherits from <code>IdentifierExpression</code>.
+ * Static Field access expressions have exactly one child, the type of the clazz
+ * containing the static field.
+ *
+ * @author Michael Watzek
+ */
+public interface StaticFieldAccessExpression extends IdentifierExpression
+{
+    /**
+     * Returns the value of the field corresponding with this static
+     * field access expression.
+     * @param pm the persistence manager of the query
+     * @return the field value
+     * @exception JDOQueryException if access to the corresponding field of this
+     * expression is denied
+     */
+    public Object getFieldValue(PersistenceManager pm);
+}
+

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ThisExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ThisExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ThisExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ThisExpression.java Sun
May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents an access to <code>this</code>.
+ * It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface ThisExpression extends IdentifierExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TimesExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TimesExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TimesExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TimesExpression.java Sun
May 22 11:08:57 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a times operator.
+ * A times operator is a binary expression.
+ * The string representation of this operator is <code>*</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface TimesExpression extends BinaryExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TreeWalker.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TreeWalker.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TreeWalker.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/TreeWalker.java Sun May
22 11:08:57 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * An instance of this class is used to walk any query node. It provides
+ * a walk method which takes a node and a node visitor as arguments. It delegates
+ * to methods <code>Node.arrive</code>, <code>Node.leave/code> and
+ * <code>Node.walkNextChild</code>. Node implementations are required
+ * to delegate these calls to corresponding methods of the supplied node
+ * visitor.
+ *
+ * @author Michael Watzek
+ */
+public final class TreeWalker
+{
+    /**
+     * Walks the tree specified by the argument <code>node</code>
+     * implementing a depth first algorithm.
+     * Executes the visitor instance callback <code>arrive</code>
+     * when starting to walk the argument <code>node</code>.
+     * Subsequently iterates that node's children and
+     * executes the visitor instance callback <code>walkNextChild</code>
+     * before the current child is walked. For the case that
+     * <code>walkNextChild</code> returns <code>true</code>,
+     * this tree walker walkes the next child.
+     * Otherwise, the next child and all remaining childs are not walked.
+     * In both cases, this tree walker
+     * executes the visitor instance callback <code>leave</code> indicating
+     * that the argument <code>node</code> and its children have been walked.
+     * The result of <code>leave</code> is returned.
+     * when starting to traverse a node.
+     * @param node the tree instance
+     * @param visitor the node visitor instance
+     * @return the object returned by the visitor instance callback <code>leave</code>
+     */
+    public Object walk(Node node, NodeVisitor visitor)
+    {
+        if( node!=null )
+        {   node.arrive( visitor );
+            Object[] results = null;
+            Node[] children = node.getChildren();
+            if( children!=null )
+            {   results = new Object[children.length];
+                for( int i=0; i<children.length; i++ )
+                {   Object resultOfPrevChild = i==0 ? null : results[i-1];
+                    if( !node.walkNextChild(visitor, resultOfPrevChild, i) )
+                        break;
+                    results[i] = walk( children[i], visitor );
+            }   }
+            return node.leave( visitor, results );
+        }
+        return null;
+    }
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/Type.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/Type.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/Type.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/Type.java Sun May 22 11:08:57
2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a type instance. A type instance wraps a <code>java.lang.Class</code>
+ * instance which has been supplied by the application. The following nodes
+ * have type instances as children:
+ * <LI><code>CandidateClass</code>
+ * <LI><code>CastExpression</code>
+ * <LI><code>Declaration</code>
+ * The result type of a type instance is the wrapped <code>java.lang.Class</code>
+ * instance. Type instances are not visible in query tree factory methods and
+ * expression factory methods. They are internally created by in implementation
+ * and are walked by a node visitor.
+ *
+ * @author Michael Watzek
+ */
+public interface Type extends Node
+{
+    /**
+     * Returns the string representation of the Java class,
+     * which is wrapped by this instance.
+     * @return the Java type name
+     */
+    public String getTypeName();
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryExpression.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryExpression.java Sun
May 22 11:08:57 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a unary operator. All unary operators have exactly
+ * one children. Examples of binary operators
+ * are <code>ComplementExpression</code> and <code>NotExpression</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface UnaryExpression extends Expression
+{
+    /**
+     * Returns the node's expression.
+     * @return the node's expression
+     */
+    public Expression getExpression();
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryMinusExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryMinusExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryMinusExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryMinusExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a unary minus operator.
+ * The string representation of this operator is <code>-</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface UnaryMinusExpression extends UnaryExpression
+{
+}
+

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryPlusExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryPlusExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryPlusExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/UnaryPlusExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a unary plus operator.
+ * The string representation of this operator is <code>+</code>.
+ *
+ * @author Michael Watzek
+ */
+public interface UnaryPlusExpression extends UnaryExpression
+{
+}
+

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ValueTable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ValueTable.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ValueTable.java (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/ValueTable.java Sun May
22 11:08:57 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * A ValueTable manages values for declared identifiers (such as variables 
+ * or parameters) of a query. It provides methods to declare an identifier, 
+ * to set and get its value and check a value to be compaitible with the 
+ * identifier's type.
+ *
+ * @author Michael Bouschen
+ */
+public interface ValueTable
+{
+    /**
+     * This method declares an identifier. The methods takes the name of the 
+     * declared identifier from the specified declaration node.
+     * @param decl the declaration node
+     */
+    public void declare(Declaration decl);
+
+    /**
+     * Sets the value of the specified identifier for later retrieval using 
+     * method {@link #getValue}). The identifier must be declared (see method 
+     * {@link #declare}) prior to a call of this method.
+     * @param name the name of the identifier
+     * @param value the new value of the identifier
+     */
+    public void setValue(String name, Object value);
+
+    
+    /**
+     * Returns the current value of the specified identifier. The identifier 
+     * must be declared using method {@link #declare}) and its value must be 
+     * set using method {@link #getValue}) prior to a call of this method.
+     * @param name the name of the identifier
+     * @return the current value of the identifier
+     */
+    public Object getValue(String name);
+
+    /**
+     * Checks whether the type of the specified value is compatible with the 
+     * type of the identifier.
+     * @return <code>true</code> if the type of the value is compatible with

+     * the type of the identifier; <code>false</code> otherwise
+     */
+    public boolean isCompatibleValue(String name, Object value);
+}
+

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableAccessExpression.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableAccessExpression.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableAccessExpression.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableAccessExpression.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a variable access expression.
+ * It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface VariableAccessExpression extends IdentifierExpression
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableDeclaration.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableDeclaration.java?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableDeclaration.java
(added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/VariableDeclaration.java
Sun May 22 11:08:57 2005
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.jdoql.tree;
+
+/**
+ * This node represents a variable declaration.
+ * It does not have any children.
+ *
+ * @author Michael Watzek
+ */
+public interface VariableDeclaration extends Declaration
+{
+}

Added: incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/package.html?rev=171353&view=auto
==============================================================================
--- incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/package.html (added)
+++ incubator/jdo/trunk/query20/src/java/org/apache/jdo/jdoql/tree/package.html Sun May 22
11:08:57 2005
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>Package org.apache.jdo.jdoql.tree</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains the query tree node interfaces, the node visitor interface
and the tree walker.</p>
+</body>
+</html>



Mime
View raw message