/* // $Id: //guest/julian_hyde/saffron/src/main/saffron/opt/CallingConvention.java#1 $ // Saffron preprocessor and data engine // Copyright (C) 2002 Julian Hyde <julian.hyde@mail.com> // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // See the COPYING file located in the top-level-directory of // the archive of this library for complete text of license. */ package saffron.opt; /** * <code>CallingConvention</code> is an enumerated type describing possible * calling conventions. It is abstract. **/ public abstract class CallingConvention { /** * The <code>NONE</code> calling convention means that expression does not * support any calling convention -- in other words, it is not * implementable, and has to be transformed to something else in order to * be implemented. **/ public static final int NONE = -1; /** * The <code>PLAN</code> calling convention means that the expression is * converted to a {@link Plan}. (We still need to specify whether the * objects returned from that plan are good after further objects have been * retrieved. It makes a lot of difference when implementing a blocking * expression such as an aggregator.) **/ public static final int PLAN = -2; /** * The <code>JAVA</code> calling convention means that the expression is * converted into an Openjava parse tree, which can then be un-parsed, * compiled, and executed as java code. * * <p>The {@link Rel#implement} method generates a piece of code which will * call the piece of code corresponding to the parent once for each * row:<ul> * * <li>The <dfn>parent code</dfn> is generated by calling {@link * Implementor#generateParentBody}, which in turn calls {@link * Rel#implement}() on the parent.</li> * * <li>The code is generated into the <dfn>current block</dfn> (gleaned * from {@link Implementor#getStatementList}).</li></ul></p> **/ public static final int JAVA = 0; /** * The <code>ITERATOR</code> calling convention means that the expression * is converted to an openjava expression ({@link * openjava.ptree.Expression}) which evalutes to an {@link * java.util.Iterator}. See {@link Converter}. **/ public static final int ITERATOR = 1; /** * The <code>ARRAY</code> calling convention results in a Java expression * which evaluates to an array containing the rows returned. Compare with * {@link #INLINE}, where a loop <em>does something</em> for each row * returned). **/ public static final int ARRAY = 2; /** * The <code>COLLECTION</code> calling convention results in a Java * expression which evaluates to a {@link java.util.Collection}, typcially * a {@link java.util.Vector}. **/ public static final int COLLECTION = 3; /** * <code>for (int i = 0; i < MAX; i++) ...</code> iterates over all the * real conventions, but misses the looney conventions {@link #NONE}, * {@link #PLAN} and {@link #EXISTS}. **/ public static final int MAX = COLLECTION + 1; public static final int VECTOR = 4; public static final int ENUMERATION = 5; public static final int MAP = 6; public static final int HASHTABLE = 7; /** * The <code>EXISTS</code> calling convention is only allowed for a * terminator. **/ public static final int EXISTS = 8; /** * Returns the name of each convention code. */ public static String getName(int convention) { switch (convention) { case NONE: return "NONE"; case PLAN: return "PLAN"; case JAVA: return "INLINE"; case ITERATOR: return "ITERATOR"; case ARRAY: return "ARRAY"; case COLLECTION: return "COLLECTION"; case EXISTS: return "EXISTS"; case MAP: return "MAP"; case HASHTABLE: return "HASHTABLE"; case ENUMERATION: return "ENUMERATION"; default: return "Unknown convention: " + convention; } } } // End CallingConvention.java
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 1801 | Julian Hyde |
saffron: add ObjectSchema; rules can now be matched more than once; started to implement correlations in queries in from list. |
||
#3 | 1748 | Julian Hyde |
saffron: convert unit tests to JUnit; add CallingConvention.ITERABLE; lots of other stuff; release 0.1. |
||
#2 | 1474 | Julian Hyde |
saffron: Aggregations are working. Renamed 'aggregator' to 'aggregation'. |
||
#1 | 1467 | Julian Hyde |
saffron: First saffron check-in; incorporate my changes to openjava. |