mjc

org.multijava.mjc
Class CUniverseRuntimeHelper

java.lang.Object
  extended byorg.multijava.mjc.CUniverseRuntimeHelper

public class CUniverseRuntimeHelper
extends Object

This is a helper class for the universe runtime checks. Its purpose is to store some information at a central place and therefore make it easier to maintain the transformations that are used to implement the runtime checks.

Author:
scdaniel

Constructor Summary
private CUniverseRuntimeHelper()
           
 
Method Summary
static JMethodCallExpression getCurrentContext()
           
static JExpression getCurrentUniverseOwner(CExpressionContextType context)
          Get the owner of the current universe.
static JNameExpression getHashTable()
           
static JNameExpression getNameExpression(String ident)
          Creates a JNameExpression form a String.
static JExpression getOwnerTest(CExpressionContextType context, CType dest, JExpression testObject, JExpression expr)
          Get the owner test that tests if testObject is compatible (can be casted to) the type described by dest.
static JNameExpression getPolicy()
           
static JLocalVariable getTmpVariable(CExpressionContextType context, JExpression currentNode, CType type)
          Get a reference to a temporary variable to store expressions that are used more than once, but should not be evaluated more than once of course.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CUniverseRuntimeHelper

private CUniverseRuntimeHelper()
Method Detail

getNameExpression

public static JNameExpression getNameExpression(String ident)
Creates a JNameExpression form a String. Example String: "org.multijava.universes.rt.UniverseRuntime.handler"

Parameters:
ident - the String
Returns:
the corresponding JNameExpression

getCurrentContext

public static JMethodCallExpression getCurrentContext()
Returns:
a JMethodCallExpression, that calls Thread.currentThread()

getHashTable

public static JNameExpression getHashTable()
Returns:
a JNameExpression representing the hashTable class used at runtime.

getPolicy

public static JNameExpression getPolicy()
Returns:
a JNameExpression representing the policy class used at runtime.

getCurrentUniverseOwner

public static JExpression getCurrentUniverseOwner(CExpressionContextType context)
Get the owner of the current universe.

Parameters:
context - the current context
Returns:
the owner of the current universe

getTmpVariable

public static JLocalVariable getTmpVariable(CExpressionContextType context,
                                            JExpression currentNode,
                                            CType type)
                                     throws PositionedError
Get a reference to a temporary variable to store expressions that are used more than once, but should not be evaluated more than once of course. The type of the variable returned is Object[] for array expressions and Object else.

Parameters:
context - the current context
currentNode - the current node ("this" wherever you call it from)
type - the type of the expression
Returns:
a reference to a temporary variable
Throws:
PositionedError

getOwnerTest

public static JExpression getOwnerTest(CExpressionContextType context,
                                       CType dest,
                                       JExpression testObject,
                                       JExpression expr)
Get the owner test that tests if testObject is compatible (can be casted to) the type described by dest. The return value can be null. Then the test is not necessary (testing for readonly for example).

Parameters:
context - the current context
dest - the destination type (what to test for)
testObject - the location where the expression is found (ie maybe a temporary variable)
expr - the expression itself
Returns:
the test for this conversion

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.