CommandPrinter
Extends:
CommandPrinter is a compiler engine which prints commands to stdout prior to sending them on to the next compiler engine.
Constructor Summary
| Public Constructor | ||
| public | 
       constructor(acceptInput: boolean, defaultMeasure: boolean, inPlace: boolean)  | 
    |
Member Summary
| Private Members | ||
| private | 
       _acceptInput: *  | 
    |
| private | 
      
       | 
    |
| private | 
       _inPlace: *  | 
    |
Method Summary
| Public Methods | ||
| public | 
       isAvailable(cmd: Command): boolean Specialized implementation of isAvailable: Returns true if the CommandPrinter is the last engine (since it can print any command).  | 
    |
| public | 
      
       Print a command or, if the command is a measurement instruction and the CommandPrinter is the last engine in the engine pipeline: Query the user for the measurement result (if accept_input = true) / Set the result to 0 (if it's false).  | 
    |
| public | 
      
       Receive a list of commands from the previous engine, print the commands, and then 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(acceptInput: boolean, defaultMeasure: boolean, inPlace: boolean) source
Override:
BasicEngine#constructorParams:
| Name | Type | Attribute | Description | 
| acceptInput | boolean | If accept_input is true, the printer queries the user to input measurement results if the CommandPrinter is the last engine. Otherwise, all measurements yield  | 
    |
| defaultMeasure | boolean | Default measurement result (if accept_input is false).  | 
    |
| inPlace | boolean | If in_place is true, all output is written on the same line of the terminal.  | 
    
Private Members
private _acceptInput: * source
private _defaultMeasure: * source
private _inPlace: * source
Public Methods
public isAvailable(cmd: Command): boolean source
Specialized implementation of isAvailable: Returns true if the CommandPrinter is the last engine (since it can print any command).
Override:
BasicEngine#isAvailableParams:
| Name | Type | Attribute | Description | 
| cmd | Command | Command of which to check availability (all Commands can be printed).  | 
    
public printCMD(cmd: Command) source
Print a command or, if the command is a measurement instruction and the CommandPrinter is the last engine in the engine pipeline: Query the user for the measurement result (if accept_input = true) / Set the result to 0 (if it's false).
Params:
| Name | Type | Attribute | Description | 
| cmd | Command | Command to print.  | 
    
public receive(commandList: Command[]) source
Receive a list of commands from the previous engine, print the commands, and then send them on to the next engine.
Override:
BasicEngine#receiveParams:
| Name | Type | Attribute | Description | 
| commandList | Command[] | List of Commands to print (and potentially send on to the next engine).  |