Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal.machine
Class ProgramManager

java.lang.Object
  extended by org.openquark.cal.machine.ProgramManager

public abstract class ProgramManager
extends Object

This is the ProgramManager class. This is a factory class used to create a machine specific ProgramModifier, EntryPointGenerator or TypeCheckerImpl.

Created: Feb 19, 2003 at 12:15:13 PM

Author:
Raymond Cypher, Joseph Wong

Field Summary
protected  ResourceAccess resourceAccess
          Provides access to the resources of the current environment (e.g. from the workspace, or from Eclipse).
protected  org.openquark.cal.machine.Program theProgram
          The copy of the machine specific program.
 
Constructor Summary
protected ProgramManager(org.openquark.cal.machine.Program program, ResourceAccess resourceAccess)
          Protected constructor for this abstract ProgramManager class.
 
Method Summary
 boolean containsModule(ModuleName moduleName)
          Returns true iff the specified module is in the Program instance encapsulated by this ProgramManager.
 org.openquark.cal.machine.MachineFunction getMachineFunction(QualifiedName functionName)
          Retrieves the specified machine function.
abstract  MachineStatistics getMachineStatistics()
           
abstract  MachineStatistics getMachineStatisticsForModule(ModuleName moduleName)
           
abstract  MachineType getMachineType()
          Returns the machine type associated with this ProgramManager.
 org.openquark.cal.machine.Module getModule(ModuleName name)
          Gets the module with a given moduleName.
 ModuleName[] getModuleNames()
          Returns the names of the modules contained by the Program instance encapsulated by this ProgramManager.
 List<org.openquark.cal.machine.Module> getModules()
          Return a list of Module object for modules contained the Program instance encapsulated by this ProgramManager.
 ModuleTypeInfo getModuleTypeInfo(ModuleName moduleName)
          Returns the type info for the specified module.
 int getNFunctionsInModule(ModuleName moduleName)
          Returns the number of functions in the specified module.
static ProgramManager getProgramManager(MachineType machineType, org.openquark.cal.machine.ProgramResourceRepository.Provider resourceRepositoryProvider, ResourceAccess resourceAccess)
          Factory method for a workspace manager.
static ProgramManager getProgramManager(org.openquark.cal.machine.ProgramResourceRepository.Provider resourceRepositoryProvider, ResourceAccess resourceAccess)
          Factory method for a workspace manager.
abstract  org.openquark.cal.machine.ProgramResourceRepository getProgramResourceRepository()
           
 Set<ModuleName> getSetOfDependentModuleNames(ModuleName dependeeModulename, boolean returnEmptySetIfNonexistent)
          Generates a list of all modules that depend on the named module either directly or indirectly.
abstract  EntryPointGenerator makeEntryPointGenerator()
          Factory method for creating a machine-specific EntryPointGenerator.
abstract  ExecutionContext makeExecutionContext(ExecutionContextProperties properties)
          Factory method for creating a machine-specific execution context.
abstract  CALExecutor makeExecutor(ExecutionContext context)
          Factory method for creating a machine-specific executor.
abstract  ProgramModifier makeProgramModifier()
          Factory method for creating a machine-specific ProgramModifier.
abstract  TypeCheckerImpl makeTypeCheckerImpl()
          Factory method for creating a machine-specific TypeCheckerImpl.
 void resetCachedResults(ExecutionContext context)
          Discards any cached (memoized) results in this program.
 void resetCachedResults(ModuleName moduleName, ExecutionContext context)
          Discards any cached (memoized) results in the named module and any dependent modules.
 void resetMachineState(ExecutionContext context)
          Discards the machine state, including any cached (memoized) results in this program.
 void resetMachineState(ModuleName moduleName, ExecutionContext context)
          Discards the machine state, including any cached (memoized) results in the named module and any dependent modules.
 void useOptimizer(boolean useOptimizer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theProgram

protected final org.openquark.cal.machine.Program theProgram
The copy of the machine specific program. The scope of this field is protected so as to allow subclasses to access it. It is never meant to be made available to external clients.


resourceAccess

protected final ResourceAccess resourceAccess
Provides access to the resources of the current environment (e.g. from the workspace, or from Eclipse).

Constructor Detail

ProgramManager

protected ProgramManager(org.openquark.cal.machine.Program program,
                         ResourceAccess resourceAccess)
Protected constructor for this abstract ProgramManager class.

Parameters:
program - the Program object to be encapsulated by this ProgramManager instance.
resourceAccess - the ResourceAccess instance to provide access to the resources of the current environment (e.g. from the workspace, or from Eclipse).
Method Detail

getProgramManager

public static ProgramManager getProgramManager(org.openquark.cal.machine.ProgramResourceRepository.Provider resourceRepositoryProvider,
                                               ResourceAccess resourceAccess)
Factory method for a workspace manager. The default machine type will be used, unless otherwise specified by the system property.

Parameters:
resourceAccess - the ResourceAccess instance to provide access to the resources of the current environment (e.g. from the workspace, or from Eclipse).
Returns:
the ProgramManager for this workspace.

getProgramManager

public static ProgramManager getProgramManager(MachineType machineType,
                                               org.openquark.cal.machine.ProgramResourceRepository.Provider resourceRepositoryProvider,
                                               ResourceAccess resourceAccess)
Factory method for a workspace manager. Note that specification of the machine type is intended as "internal" public. Clients will always use the default machine type, unless they are intended to have "special" knowledge that other machine types are available.

Parameters:
machineType - the machine type.
resourceAccess - the ResourceAccess instance to provide access to the resources of the current environment (e.g. from the workspace, or from Eclipse).

getMachineType

public abstract MachineType getMachineType()
Returns the machine type associated with this ProgramManager.

Returns:
the machine type.

makeProgramModifier

public abstract ProgramModifier makeProgramModifier()
Factory method for creating a machine-specific ProgramModifier.

Returns:
a new ProgramModifier instance.

makeEntryPointGenerator

public abstract EntryPointGenerator makeEntryPointGenerator()
Factory method for creating a machine-specific EntryPointGenerator.

Returns:
a new EntryPointGenerator instance.

makeTypeCheckerImpl

public abstract TypeCheckerImpl makeTypeCheckerImpl()
Factory method for creating a machine-specific TypeCheckerImpl.

Returns:
a new TypeCheckerImpl instance.

makeExecutionContext

public abstract ExecutionContext makeExecutionContext(ExecutionContextProperties properties)
Factory method for creating a machine-specific execution context.

Parameters:
properties - the ExecutionContextProperties instance encapsulating an immutable map of key-value pairs which is exposed as system properties from within CAL.
Returns:
a new CALExecutor.Context instance.

makeExecutor

public abstract CALExecutor makeExecutor(ExecutionContext context)
Factory method for creating a machine-specific executor.

Parameters:
context - the execution context to be used by the executor.
Returns:
a new CALExecutor instance.

resetCachedResults

public void resetCachedResults(ExecutionContext context)
Discards any cached (memoized) results in this program.

Parameters:
context - the context with which the cached results are associated.

resetCachedResults

public void resetCachedResults(ModuleName moduleName,
                               ExecutionContext context)
Discards any cached (memoized) results in the named module and any dependent modules.

Parameters:
moduleName - the name of the module whose cached results, and whose dependents' cached results, are to be discarded.
context - the context with which the cached results are associated.

resetMachineState

public void resetMachineState(ExecutionContext context)
Discards the machine state, including any cached (memoized) results in this program.

Parameters:
context - the context with which the machine state is associated.

resetMachineState

public void resetMachineState(ModuleName moduleName,
                              ExecutionContext context)
Discards the machine state, including any cached (memoized) results in the named module and any dependent modules.

Parameters:
moduleName - the name of the module whose machine state, and whose dependents' machine state, are to be discarded.
context - the context with which the machine state associated.

containsModule

public boolean containsModule(ModuleName moduleName)
Returns true iff the specified module is in the Program instance encapsulated by this ProgramManager.

Parameters:
moduleName - the name of the module to check.
Returns:
true iff the specified module is in the program.

getModuleNames

public ModuleName[] getModuleNames()
Returns the names of the modules contained by the Program instance encapsulated by this ProgramManager.

Returns:
an array of module names for the modules in the program.

getModules

public List<org.openquark.cal.machine.Module> getModules()
Return a list of Module object for modules contained the Program instance encapsulated by this ProgramManager.

Returns:
a list of Module objects for the modules in this program.

getModule

public org.openquark.cal.machine.Module getModule(ModuleName name)
Gets the module with a given moduleName.

Parameters:
name - the module name
Returns:
the module with a given module name

getSetOfDependentModuleNames

public Set<ModuleName> getSetOfDependentModuleNames(ModuleName dependeeModulename,
                                                    boolean returnEmptySetIfNonexistent)
Generates a list of all modules that depend on the named module either directly or indirectly.

Parameters:
dependeeModulename - the name of the dependee module.
returnEmptySetIfNonexistent - if true, this method returns an empty list if the module is not in the program. Otherwise it returns null in such a case.
Returns:
A list of names of all dependent modules.

getModuleTypeInfo

public ModuleTypeInfo getModuleTypeInfo(ModuleName moduleName)
Returns the type info for the specified module.

Parameters:
moduleName - the name of the module whose type info is requested.
Returns:
the type info for the specified module, or null if the module is not in the program.

getNFunctionsInModule

public int getNFunctionsInModule(ModuleName moduleName)
Returns the number of functions in the specified module.

Parameters:
moduleName - the name of the module.
Returns:
the number of functions in the specified module, or 0 if the module is not in the program.

getMachineFunction

public org.openquark.cal.machine.MachineFunction getMachineFunction(QualifiedName functionName)
                                                             throws org.openquark.cal.machine.Program.ProgramException
Retrieves the specified machine function.

Parameters:
functionName - the qualified name of the function.
Returns:
the specified machine function, or null if it does not exist.
Throws:
org.openquark.cal.machine.Program.ProgramException - if the program does not contain the module for the function.

useOptimizer

public void useOptimizer(boolean useOptimizer)
Parameters:
useOptimizer - True iff the CAL based optimizer should be used during compilation.

getProgramResourceRepository

public abstract org.openquark.cal.machine.ProgramResourceRepository getProgramResourceRepository()
Returns:
the repository for program resources, or null if none.

getMachineStatistics

public abstract MachineStatistics getMachineStatistics()
Returns:
the machine statistics associated with this program.

getMachineStatisticsForModule

public abstract MachineStatistics getMachineStatisticsForModule(ModuleName moduleName)
Parameters:
moduleName -
Returns:
the machine statistics associated with the given module.

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.