Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Declaration.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Declaration.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Declaration.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Declaration.java Fri Mar 18 17:02:29 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 declaration expression. Examples of + * declarations expressions are + * <code>ParameterDeclarationExpression</code> and + * <code>VariableDeclarationExpression</code>. Declaration expressions + * do not have any children. + * + * @author Michael Watzek + */ +public interface Declaration extends Node +{ + /** + * Returns the name of the specialized declaration. + * @return the name + */ + public String getName(); + + /** + * Returns the Java type name of the specialized declaration. + * @return the Java type name + */ + public String getTypeName(); +}
Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DescendingOrderingExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DescendingOrderingExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DescendingOrderingExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DescendingOrderingExpression.java Fri Mar 18 17:02:29 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 an operator defining descendent ordering of instances + * returned by a query execution. The order is determined by an expression + * such as <code>FieldAccessExpression</code>. This expression is this node's + * child. + * + * @author Michael Watzek + */ +public interface DescendingOrderingExpression extends OrderingExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DivideExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DivideExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DivideExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DivideExpression.java Fri Mar 18 17:02:29 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 division operator. + * A division operator is a binary expression. + * The string representation of this operator is <code>/</code>. + * + * @author Michael Watzek + */ +public interface DivideExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DoubleLiteralExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DoubleLiteralExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DoubleLiteralExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/DoubleLiteralExpression.java Fri Mar 18 17:02:29 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 double literal. It does not have any children. + * + * @author Michael Watzek + */ +public interface DoubleLiteralExpression extends ConstantExpression +{ + /** + * Returns the double value represented by this expression. + * @return the double value + */ + public double getDouble(); +} \ No newline at end of file Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EndsWithCallExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EndsWithCallExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EndsWithCallExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EndsWithCallExpression.java Fri Mar 18 17:02:29 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.endsWith</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 EndsWithCallExpression extends MethodCallExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EqualsExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EqualsExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EqualsExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/EqualsExpression.java Fri Mar 18 17:02:29 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 an equals operator. + * An equals operator is a binary expression. + * The string representation of this operator is <code>==</code>. + * + * @author Michael Watzek + */ +public interface EqualsExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Expression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Expression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Expression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Expression.java Fri Mar 18 17:02:29 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 general expression. Examples of general expressions + * are <code>UnaryExpression</code>, <code>BinaryExpression</code>, + * <code>FieldAccessExpression</code>, <code>CastExpression</code> + * and <code>MethodCallExpression</code>. + * + * @author Michael Watzek + */ +public interface Expression extends Node +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/ExpressionFactory.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/ExpressionFactory.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/ExpressionFactory.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/ExpressionFactory.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,330 @@ +/* + * 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 interface provides methods for factorizing expression nodes. + * Expression nodes are used as filter expressions for query trees. + * + * @author Michael Watzek + */ +public interface ExpressionFactory +{ + /** + * The implementation may decide to create an instance + * of <code>FieldAccessExpression</code>, + * <code>VariableAccessExpression</code> or + * <code>ParameterAccessExpression</code> depending on the fact + * whether the argument corresponds with a parameter, variable or + * a field of the candidate class. Optionally, the implementation + * may return an instance of <code>IdentifierExpression</code> + * which later may be replaced with its specialized counterpart + * semantically analysing a query tree. + * @param identifier the name of the identifier access expression + * @return the identifier access expression instance + */ + public IdentifierExpression newIdentifier(String identifier); + + /** + * Returns an instance of <code>FieldAccessExpression</code>. + * @param target the target expression of the field access expression + * @param fieldName the name of the field to access + * @return the field access expression instance + */ + public FieldAccessExpression newFieldAccess(Expression target, + String fieldName); + + /** + * Returns an instance of <code>StaticFieldAccessExpression</code>. + * @param clazz the class instance defining the field + * @param fieldName the name of the field to access + * @return the static field access expression instance + */ + public StaticFieldAccessExpression newFieldAccess(Class clazz, + String fieldName); + + /** + * The implementation may decide to create a specialized instance + * of <code>MethodCallExpression</code> (for example, + * <code>ContainsCallExpression</code>) + * depending on the argument <code>methodName</code>. + * Optionally, the implementation may return an instance of + * <code>MethodCallExpression</code> + * which later may be replaced with its specialized counterpart + * semantically analysing a query tree. + * @param target the target expression of the method call expression + * @param methodName the name of the method + * @param arguments the array of arguments + * @return the specialized method call expression instance + */ + public MethodCallExpression newMethodCall( + Expression target, String methodName, Expression[] arguments); + + /** + * Returns an instance of <code>CastExpression</code>. + * @param clazz the Java class to cast the argument + * <code>expression</code> to + * @param expression the expression to cast + * @return the cast expression instance + */ + public CastExpression newCast(Class clazz, Expression expression); + + ////////////////////////////////////////////////////////// + //methods for factorizing specialized constant expressions + ////////////////////////////////////////////////////////// + + /** + * Returns an instance of <code>BooleanLiteralExpression</code>. + * @param b the value wrapped by the boolean expression + * @return the boolean expression instance + */ + public ConstantExpression newConstant(boolean b); + + /** + * Returns an instance of <code>ByteLiteralExpression</code>. + * @param b the value wrapped by the byte expression + * @return the byte expression instance + */ + public ConstantExpression newConstant(byte b); + + /** + * Returns an instance of <code>CharLiteralExpression</code>. + * @param c the value wrapped by the char expression + * @return the char expression instance + */ + public ConstantExpression newConstant(char c); + + /** + * Returns an instance of <code>DoubleLiteralExpression</code>. + * @param d the value wrapped by the double expression + * @return the double expression instance + */ + public ConstantExpression newConstant(double d); + + /** + * Returns an instance of <code>FloatLiteralExpression</code>. + * @param f the value wrapped by the float expression + * @return the float expression instance + */ + public ConstantExpression newConstant(float f); + + /** + * Returns an instance of <code>IntLiteralExpression</code>. + * @param i the value wrapped by the int expression + * @return the int expression instance + */ + public ConstantExpression newConstant(int i); + + /** + * Returns an instance of <code>LongLiteralExpression</code>. + * @param l the value wrapped by the long expression + * @return the long expression instance + */ + public ConstantExpression newConstant(long l); + + /** + * Returns an instance of <code>ShortLiteralExpression</code>. + * @param s the value wrapped by the short expression + * @return the short expression instance + */ + public ConstantExpression newConstant(short s); + + /** + * Returns an instance of <code>ConstantExpression</code>. + * This method handles <code>null</code> as a constant expression. + * @param value the object wrapped by the constant expression + * @return the constant expression instance + */ + public ConstantExpression newConstant(Object value); + + /////////////////////////////////////////////////////// + //methods for factorizing specialized unary expressions + /////////////////////////////////////////////////////// + + /** + * Returns a complement expression for the argument + * <code>expr</code>. + * @param expr the expression argument for the operation + * @return the complement expression instance + */ + public ComplementExpression newComplement(Expression expr); + + /** + * Returns a unary minus expression for the argument + * <code>expr</code>. + * @param expr the expression argument for the operation + * @return the unary minus expression instance + */ + public UnaryMinusExpression newMinus(Expression expr); + + /** + * Returns a not expression for the argument + * <code>expr</code>. + * @param expr the expression argument for the operation + * @return the not expression instance + */ + public NotExpression newNot(Expression expr); + + /** + * Returns a plus expression for the argument + * <code>expr</code>. + * @param expr the expression argument for the operation + * @return the plus expression instance + */ + public UnaryPlusExpression newPlus(Expression expr); + + //////////////////////////////////////////////////////// + //methods for factorizing specialized binary expressions + //////////////////////////////////////////////////////// + + /** + * Returns an and expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the and expression instance + */ + public AndExpression newAnd(Expression left, Expression right); + + /** + * Returns a conditional and expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the conditional and expression instance + */ + public ConditionalAndExpression newConditionalAnd(Expression left, + Expression right); + + /** + * Returns a conditional or expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the conditional or expression instance + */ + public ConditionalOrExpression newConditionalOr(Expression left, + Expression right); + + /** + * Returns a divide expression for the arguments + * <code>left</code> and <code>right</code>. + * This method throws <code>NullPointerException</code> if one of + * the arguments <code>left</code> or <code>right</code> are + * <code>null</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the divide expression instance + */ + public DivideExpression newDivide(Expression left, Expression right); + + /** + * Returns an equals expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the equals expression instance + */ + public EqualsExpression newEquals(Expression left, Expression right); + + /** + * Returns a greater than expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the greater than expression instance + */ + public GreaterThanExpression newGreaterThan(Expression left, + Expression right); + + /** + * Returns a greater than equals expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the greater than equals expression instance + */ + public GreaterThanEqualsExpression newGreaterThanEquals(Expression left, + Expression right); + + /** + * Returns a less than expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the less than expression instance + */ + public LessThanExpression newLessThan(Expression left, Expression right); + + /** + * Returns a less than equals expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the less than equals expression instance + */ + public LessThanEqualsExpression newLessThanEquals(Expression left, + Expression right); + + /** + * Returns a minus expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the minus expression instance + */ + public MinusExpression newMinus(Expression left, Expression right); + + /** + * Returns a not equals expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the not equals expression instance + */ + public NotEqualsExpression newNotEquals(Expression left, Expression right); + + /** + * Returns a plus expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the plus expression instance + */ + public PlusExpression newPlus(Expression left, Expression right); + + /** + * Returns an or expression for the arguments + * <code>left</code> and <code>right</code>. + * This method throws <code>NullPointerException</code> if one of + * the arguments <code>left</code> or <code>right</code> are + * <code>null</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the or expression instance + */ + public OrExpression newOr(Expression left, Expression right); + + /** + * Returns a times expression for the arguments + * <code>left</code> and <code>right</code>. + * @param left the left expression argument for the operation + * @param right the right expression argument for the operation + * @return the times expression instance + */ + public TimesExpression newTimes(Expression left, Expression right); +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FieldAccessExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FieldAccessExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FieldAccessExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FieldAccessExpression.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,52 @@ +/* + * 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 field access expression. Field access expression + * have exactly one child, the target expression. + * This expression can be an arbitrary expression. + * + * @author Michael Watzek + */ +public interface FieldAccessExpression extends IdentifierExpression +{ + /** + * Returns the target expression of this field access. + * The target expression can be an instance of + * <code>ThisExpression</code> or an instance of an arbitrary other + * <code>Expression</code>, e.g. <code>FieldAccessExpression</code>. + * @return the target expression + */ + public Expression getTarget(); + + /** + * Returns the value of the field corresponding with this + * field access expression for the argument <code>object</code>. + * @param pm the persistence manager of the query + * @param object the instance for which to return the field value + * @return the field value for <code>object</code> + * @exception JDOQueryException if access to the corresponding field of this + * expression is denied + */ + public Object getFieldValue(PersistenceManager pm, Object object); +} + Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FloatLiteralExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FloatLiteralExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FloatLiteralExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/FloatLiteralExpression.java Fri Mar 18 17:02:29 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 float literal. It does not have any children. + * + * @author Michael Watzek + */ +public interface FloatLiteralExpression extends ConstantExpression +{ + /** + * Returns the float value represented by this expression. + * @return the float value + */ + public float getFloat(); +} \ No newline at end of file Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanEqualsExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanEqualsExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanEqualsExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanEqualsExpression.java Fri Mar 18 17:02:29 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 greater than equals operator. + * A greater than equals operator is a binary expression. + * The string representation of this operator is <code>>=</code>. + * + * @author Michael Watzek + */ +public interface GreaterThanEqualsExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/GreaterThanExpression.java Fri Mar 18 17:02:29 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 greater than operator. + * A greater equals operator is a binary expression. + * The string representation of this operator is <code>></code>. + * + * @author Michael Watzek + */ +public interface GreaterThanExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IdentifierExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IdentifierExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IdentifierExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IdentifierExpression.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,40 @@ +/* + * 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 identifier expression. + * Examples of identifier expressions are + * <code>FieldAccessExpression</code>, <code>ParameterAccessExpression</code>, + * <code>ThisExpression</code> or <code>VariableAccessExpression</code>. + * + * @author Michael Watzek + */ +public interface IdentifierExpression extends Expression +{ + /** + * Returns the name of the specialized identifier. + * @return the name + */ + public String getName(); + + /** + * Returns the Java type name of the specialized identifier. + * @return the Java type name + */ + public String getTypeName(); +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IntLiteralExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IntLiteralExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IntLiteralExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IntLiteralExpression.java Fri Mar 18 17:02:29 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 integer literal. It does not have any children. + * + * @author Michael Watzek + */ +public interface IntLiteralExpression extends ConstantExpression +{ + /** + * Returns the int value represented by this expression. + * @return the int value + */ + public int getInt(); +} \ No newline at end of file Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IsEmptyCallExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IsEmptyCallExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IsEmptyCallExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/IsEmptyCallExpression.java Fri Mar 18 17:02:29 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 the method call expression + * <code>Collection.isEmpty</code>. This node's child is a target + * expression (e.g. an instance of <code>FieldAccessExpression</code>). + * + * @author Michael Watzek + */ +public interface IsEmptyCallExpression extends MethodCallExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanEqualsExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanEqualsExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanEqualsExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanEqualsExpression.java Fri Mar 18 17:02:29 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 less than equals operator. + * A less than equals operator is a binary expression. + * The string representation of this operator is <code><=</code>. + * + * @author Michael Watzek + */ +public interface LessThanEqualsExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LessThanExpression.java Fri Mar 18 17:02:29 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 less than operator. + * A less than operator is a binary expression. + * The string representation of this operator is <code><</code>. + * + * @author Michael Watzek + */ +public interface LessThanExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LongLiteralExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LongLiteralExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LongLiteralExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/LongLiteralExpression.java Fri Mar 18 17:02:29 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 long literal. It does not have any children. + * + * @author Michael Watzek + */ +public interface LongLiteralExpression extends ConstantExpression +{ + /** + * Returns the long value represented by this expression. + * @return the long value + */ + public long getLong(); +} \ No newline at end of file Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MethodCallExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MethodCallExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MethodCallExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MethodCallExpression.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,50 @@ +/* + * 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 method call expression. + * Examples of method call expressions are + * <code>ContainsCallExpression</code>, <code>IsEmptyCallExpression</code>, + * <code>EndsWithCallExpression</code> and + * <code>StartsWithCallExpression</code>. + * + * @author Michael Watzek + */ +public interface MethodCallExpression extends Expression +{ + /** + * Returns the target expression of this method call. + * The target expression can be an instance of + * <code>ThisExpression</code> or an instance of an arbitrary other + * <code>Expression</code>, e.g. <code>FieldAccessExpression</code>. + * @return the target expression + */ + public Expression getTarget(); + + /** + * Returns the method name. + * @return the method name + */ + public String getMethodName(); + + /** + * Returns the argument array of this method call. + * @return the argument array + */ + public Expression[] getArguments(); +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MinusExpression.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MinusExpression.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MinusExpression.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/MinusExpression.java Fri Mar 18 17:02:29 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 minus operator. + * The string representation of this operator is <code>-</code>. + * + * @author Michael Watzek + */ +public interface MinusExpression extends BinaryExpression +{ +} Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Node.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Node.java?view=auto&rev=158176 ============================================================================== --- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Node.java (added) +++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/jdoql/tree/Node.java Fri Mar 18 17:02:29 2005 @@ -0,0 +1,119 @@ +/* + * 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.io.Serializable; + +/** + * This is the base interface of all nodes. Examples of nodes are + * <CandidateClass</code>, <code>Declaration</code>, <code>Expression</code> + * and <code>OrderingExpression<code>. + * + * @author Michael Watzek + */ +public interface Node extends Serializable +{ + /** + * Returns the user object. + * @return the ouser object + */ + public Object getObject(); + + /** + * Sets the user object. + * @param object the user object + */ + public void setObject(Object object); + + /** + * Returns this node's parent node. + * @return the parent node + */ + public Node getParent(); + + /** + * Sets the parent of this node. + * @param parent the parent node + */ + public void setParent(Node parent); + + /** + * Returns this node's children. + * @return the children + */ + public Node[] getChildren(); + + /** + * Returns the Java type of this node. + * @return the Java type + */ + public Class getJavaClass(); + + /** + * Returns the token type of this node. + * @return the token type + */ + public int getTokenType(); + + /** + * This method is called by the tree walker when this node is walked + * but its children have not been walked yet. + * It delegates to the argument <code>visitor</code>. + * @param visitor the node visitor + */ + public void arrive(NodeVisitor visitor); + + /** + * This method is called by the tree walker when this node is walked + * and all of its children have been walked. + * It delegates to the argument <code>visitor</code>. + * The argument <code>results</code> contains the result instances + * returned by all <code>leave</code> methods of this node's children. + * This method returns the result instance of the delegation call + * of the argument <code>visitor</code>. + * @param visitor the node visitor + * @param results the result array containing result instances of + * this node's children + * @return the result instance of the delegation call + * of the argument <code>visitor</code> + */ + public Object leave(NodeVisitor visitor, Object[] results); + + /** + * This method is called by the tree walker after walking each child + * except the last child. + * It delegates to the argument <code>visitor</code>. The argument + * <code>resultOfPreviousChild</code> contains the result instance + * returned by the <code>leave</code> method of the last walked + * child. The argument <code></code> indicates the index of the + * next child in the children array returned by method + * <code>getChildren</code>. If this method returns + * <code>false</code> then the tree walker does not walk any more + * children of this node. Instead, it calls method + * <code>leave</code> immediately. + * @param visitor the node visitor + * @param resultOfPreviousChild the result computed by leaving the + * previous child node + * @param indexOfNextChild the index in the children array of the + * next child to walk + * @return <code>false</code> if remaining children should not be walked + */ + public boolean walkNextChild(NodeVisitor visitor, + Object resultOfPreviousChild, + int indexOfNextChild); + +}