CommandModifier
Extends:
CommandModifier is a compiler engine which applies a function to all incoming commands, sending on the resulting command instead of the original one.
Constructor Summary
| Public Constructor | ||
| public | 
       constructor(cmdModFunc: function)  | 
    |
Member Summary
| Private Members | ||
| private | 
       _cmdModFunc: *  | 
    |
Method Summary
| Public Methods | ||
| public | 
      
       Receive a list of commands from the previous engine, modify all commands, and send them on to the next engine.  | 
    |
Inherited Summary
| From class BasicEngine | ||
| public | 
      
       | 
    |
| public | 
       allocateQubit(dirty: boolean): Qureg Return a new qubit as a list containing 1 qubit object (quantum register of size 1).  | 
    |
| public | 
       allocateQureg(n: number): Qureg Allocate n qubits and return them as a quantum register, which is a list of qubit objects.  | 
    |
| public | 
       deallocateQubit(qubit: BasicQubit) Deallocate a qubit (and sends the deallocation command down the pipeline).  | 
    |
| public | 
       isAvailable(cmd: Command): boolean Default implementation of isAvailable: Ask the next engine whether a command is available, i.e., whether it can be executed by the next engine(s).  | 
    |
| public | 
       isMetaTagSupported(metaTag: function): boolean Check if there is a compiler engine handling the meta tag  | 
    |
| public | 
       receive()  | 
    |
| public | 
      
       Forward the list of commands to the next engine in the pipeline.  | 
    |
Public Constructors
public constructor(cmdModFunc: function) source
Override:
BasicEngine#constructorParams:
| Name | Type | Attribute | Description | 
| cmdModFunc | function | Function which, given a command cmd, returns the command it should send instead.  | 
    
Example:
function cmd_mod_fun(cmd)
cmd.tags += [new MyOwnTag()]
compiler_engine = new CommandModifier(cmd_mod_fun)
    Private Members
private _cmdModFunc: * source
Public Methods
public receive(cmdList: Command[]) source
Receive a list of commands from the previous engine, modify all commands, and send them on to the next engine.
Override:
BasicEngine#receiveParams:
| Name | Type | Attribute | Description | 
| cmdList | Command[] | List of commands to receive and then (after modification) send on.  |