org.eigenbase.oj.util
Class OJSyntheticClass

java.lang.Object
  extended by openjava.mop.OJClass
      extended by org.eigenbase.oj.util.OJSyntheticClass
All Implemented Interfaces:
OJMember

public class OJSyntheticClass
extends OJClass

An OJSyntheticClass is a class declaration for intermediate results in expressions. It is created implicitly while expressions are being compiled.

Two synthetic classes are identical if their attributes are of the same number, type, and order.

Synthetic classes are created in two ways: OJClassMap.createProject(OJClass, OJClass[], String[]) creates the type of a select clause, and OJClassMap.createJoin(OJClass, OJClass[]) creates the type of a join. The semantics are slightly different: projection classes have field names, but join classes do not; two join classes with the same member types are equivalent, but two distinct projection classes may have the same set of attributes.


Field Summary
(package private)  OJClass[] classes
           
(package private)  ClassDeclaration decl
           
(package private)  String description
           
static String FIELD_PREFIX
           
static String JOIN_CLASS_PREFIX
           
static String PROJECT_CLASS_PREFIX
           
 
Fields inherited from interface openjava.mop.OJMember
DECLARED, PUBLIC
 
Constructor Summary
OJSyntheticClass(Environment env, OJClass declarer, OJClass[] classes, String[] fieldNames, ClassDeclaration decl, String description, boolean defineValueConstructor)
          Called only from OJClassMap methods.
 
Method Summary
static void addMembers(ClassDeclaration outerClassDecl, OJClass[] classes)
          Adds declarations of a set of classes classes as inner classes of a class declaration outerClassDecl.
static void addMethod(ClassDeclaration classDecl, StatementList statementList, String name, String[] parameterNames, OJClass[] parameterTypes, OJClass returnType)
          Creates a method in a class.
 boolean equals(Object o)
           
static int getOrdinal(String fieldName, boolean fail)
          Converts a field name back to an ordinal.
 int hashCode()
           
static boolean isJoinClass(OJClass clazz)
           
static String makeField(int ordinal)
           
 String toString()
           
 
Methods inherited from class openjava.mop.OJClass
addClass, addConstructor, addField, addInterface, addMethod, arrayOf, expandAllocation, expandArrayAccess, expandArrayAllocation, expandAssignmentExpression, expandCastedExpression, expandCastExpression, expandExpression, expandFieldRead, expandFieldWrite, expandMethodCall, expandTypeName, expandVariableDeclaration, forClass, forName, forParseTree, getAcceptableConstructor, getAcceptableMethod, getAllClasses, getAllField, getAllFields, getAllMethod, getAllMethods, getAllMethods, getByteCode, getClasses, getClasses, getCompatibleJavaClass, getComponentType, getConstructor, getConstructor, getConstructors, getConstructors, getDeclaredClasses, getDeclaredConstructor, getDeclaredConstructors, getDeclaredField, getDeclaredFields, getDeclaredMethod, getDeclaredMethods, getDeclaringClass, getDeclSuffixRule, getEnvironment, getField, getField, getFields, getFields, getInheritableClasses, getInheritableClasses, getInheritableConstructors, getInheritableFields, getInheritableFields, getInheritableMethods, getInheritableMethods, getInheritedClasses, getInheritedFields, getInheritedMethods, getInterfaces, getMetaInfo, getMetaInfoElements, getMetaInfoKeys, getMethod, getMethod, getMethods, getMethods, getModifiers, getName, getPackage, getSimpleName, getSourceCode, getSuffix, getSuperclass, getTypeSuffixRule, isAlterable, isArray, isAssignableFrom, isExecutable, isInSamePackage, isInterface, isPrimitive, isPrimitiveWrapper, isRegisteredKeyword, isRegisteredModifier, makeCopy, makeExpression, makeExpression, makeStatement, makeStatement, makeStatementList, makeStatementList, primitiveWrapper, putMetaInfo, removeClass, removeConstructor, removeField, removeMethod, resolveException, resolveException, setInterfaces, setName, setSuperclass, signature, translateDefinition, translateDefinition, unwrappedPrimitive, waitTranslation, writeMetaInfo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

JOIN_CLASS_PREFIX

public static final String JOIN_CLASS_PREFIX
See Also:
Constant Field Values

PROJECT_CLASS_PREFIX

public static final String PROJECT_CLASS_PREFIX
See Also:
Constant Field Values

FIELD_PREFIX

public static final String FIELD_PREFIX
See Also:
Constant Field Values

description

String description

classes

OJClass[] classes

decl

ClassDeclaration decl
Constructor Detail

OJSyntheticClass

OJSyntheticClass(Environment env,
                 OJClass declarer,
                 OJClass[] classes,
                 String[] fieldNames,
                 ClassDeclaration decl,
                 String description,
                 boolean defineValueConstructor)
Called only from OJClassMap methods.

Method Detail

toString

public String toString()
Overrides:
toString in class OJClass

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

addMembers

public static void addMembers(ClassDeclaration outerClassDecl,
                              OJClass[] classes)
Adds declarations of a set of classes classes as inner classes of a class declaration outerClassDecl. Declarations which are already present are not added again.


addMethod

public static void addMethod(ClassDeclaration classDecl,
                             StatementList statementList,
                             String name,
                             String[] parameterNames,
                             OJClass[] parameterTypes,
                             OJClass returnType)
Creates a method in a class.


getOrdinal

public static int getOrdinal(String fieldName,
                             boolean fail)
Converts a field name back to an ordinal. For example, getOrdinal("$f2") returns 2. If fieldName is not valid, throws an error if "fail" is true, otherwise returns -1.


makeField

public static String makeField(int ordinal)

isJoinClass

public static boolean isJoinClass(OJClass clazz)