openjava.ptree.util
Class SyntheticClass

java.lang.Object
  |
  +--openjava.mop.OJClass
        |
        +--openjava.ptree.util.SyntheticClass
All Implemented Interfaces:
OJMember

public class SyntheticClass
extends OJClass

A SyntheticClass is a class declaration for intermediate results in saffron 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: ClassMap.createProject(OJClass, OJClass[], String[]) creates the type of a select clause, and ClassMap.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 class openjava.mop.OJClass
 
Fields inherited from interface openjava.mop.OJMember
DECLARED, PUBLIC
 
Constructor Summary
(package private) SyntheticClass(Environment env, OJClass declarer, OJClass[] classes, String[] fieldNames, ClassDeclaration decl, String description)
          Called only from ClassMap methods.
 
Method Summary
static void addMembers(ClassDeclaration outerClassDecl, OJClass[] classes)
          Add 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()
          Converts the object to a string.
 
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, forObject, forParseTree, getAcceptableConstructor, getAcceptableMethod, getAllClasses, getAllField, getAllFields, getAllMethod, getAllMethods, getAllMethods, getByteCode, getClasses, getClasses, getClassLoader, 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, getResource, getResourceAsStream, getSigners, getSimpleName, getSourceCode, getSuffix, getSuperclass, getTypeSuffixRule, isAlterable, isArray, isAssignableFrom, isExecutable, isInSamePackage, isInstance, isInterface, isPrimitive, isPrimitiveWrapper, isRegisteredKeyword, isRegisteredModifier, makeCopy, makeExpression, makeExpression, makeStatement, makeStatement, makeStatementList, makeStatementList, newInstance, primitiveWrapper, putMetaInfo, removeClass, removeConstructor, removeField, removeMethod, replaceDotWithDollar, 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

description

String description

classes

OJClass[] classes

decl

ClassDeclaration decl

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
Constructor Detail

SyntheticClass

SyntheticClass(Environment env,
               OJClass declarer,
               OJClass[] classes,
               String[] fieldNames,
               ClassDeclaration decl,
               String description)
Called only from ClassMap methods.

Method Detail

toString

public String toString()
Description copied from class: OJClass
Converts the object to a string. The string representation is the string "class" or "interface", followed by a space, and then by the fully qualified name of the class in the format returned by getName. If this OJClass object represents a primitive type, this method returns the name of the primitive type. If this OJClass object represents void this method returns "void".

Overrides:
toString in class OJClass
Returns:
a string representation of this class object.

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)
Add 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)

SourceForge.net_Logo