# Interface: com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer

Definition of a master optimizer, whose role is to manage and orchestrate the execution of individual optimizers. 

 Implementation note: the master optimizer may call optimizers repeatedly until no more optimizations are performed.

## Static Field: DEFAULT_GROUP
Type: `int`

Constant value: `1`
Description: Default optimizer group.

## Method: getMode
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`

Description: Retrieve the current operating mode for this MO.
return: the current operating mode

## Method: getOptimizationCount
- parameter: `deobfuscationOnly`, type: `boolean`
- return type: `int`

Description: Retrieve the number of optimizations performed by this master optimizer.
parameter: deobfuscationOnly: true to count deobfuscation optimizers only
return: the optimization count

## Method: getOptimizer
- parameter: `clazz`, type: `java.lang.Class<? extends com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`

Description: Retrieve a registered optimizer entry by class.
parameter: clazz: optimizer class
return: optimizer entry, or null if not registered

## Method: getOptimizerObject
- parameter: `clazz`, type: `java.lang.Class<? extends com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`

Description: Retrieve a registered optimizer object by class.
parameter: clazz: optimizer class
return: optimizer object, or null if not registered

## Method: getRegisteredOptimizers
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`

Description: Get a copy of the list of optimizer entries registered with this MO.
return: a copy of the registered optimizer entries

## Method: getRegisteredOptimizers
- parameter: `groupId`, type: `int`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`

Description: Get a copy of the lists of optimizer entries registered with this MO and belonging to the provided optimizer group.
parameter: groupId: optimizer group id
return: a copy of the registered optimizer entries for that group

## Method: getTarget
- return type: `T`

Description: Get the target onto which the optimizations will be performed.
return: the optimization target

## Method: getTotalOptimizationCount
- return type: `int`

Description: Retrieve the total number of optimizations performed by this master optimizer.
return: the total optimization count

## Method: perform
- return type: `int`

Description: Perform an optimization pass. All the optimizers will be run according to this master's schedule. They may be run multiple times.
return: the total number of optimizations performed

## Method: performMultiple
- parameter: `list`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>>`
- return type: `int`

Description: Run the list of optimizers, in sequence. Each optimizer is run once.
parameter: list: a list of optimizers
return: the total number of optimizations performed

## Method: performSingle
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`
- return type: `int`

Description: Perform a single optimization, using the provided optimizer \(which must have been previously registered\).
parameter: e: an optimizer
return: the total number of optimizations performed

## Method: registerInstrumenter
- parameter: `instrumenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizerInstrumenter<T>`

Description: Register an instrumenter. Instrumenters will be called following their registration order.
parameter: instrumenter: instrumenter to register

## Method: registerOptimizer
- parameter: `opt`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`

Description: Register an optimizer to the [main group](#DEFAULT_GROUP), using the optimizer's configured priority. Refer to [IOptimizer#getPriority()](IOptimizer#getPriority()).
parameter: opt: optimizer to register
return: the registered optimizer entry

## Method: registerOptimizer
- parameter: `group`, type: `int`
- parameter: `opt`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IOptimizer<T>`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`

Description: Register an optimizer, using the optimizer's configured priority. Refer to [IOptimizer#getPriority()](IOptimizer#getPriority()).
parameter: group: optimizer group
parameter: opt: optimizer to register
return: the registered optimizer entry

## Method: setMode
- parameter: `optimizerMode`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`
- return type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerMode`

Description: Set the current operating mode for this master optimizer.
parameter: optimizerMode: new operating mode
return: the previous mode

## Method: setPolicyForOptimizerTag
- parameter: `tag`, type: `java.lang.String`
- parameter: `allowed`, type: `boolean`

Description: Set the running policy associated to a tag or group of tags. Policy checks when deciding whether an optimizer should be run works as follow: 1\) the tag must be allowed, 2\) if passed, the tag must not be blocked. By default, all tags are allowed, none are blocked. To reset to that default policy: first invoke this method with `("*", true)`, then invoke it with `(null,
 false)`.
parameter: tag: tag name; the special name `"*"` means all tags; the special name `""`            \(empty string\) or null string means no tag
parameter: allowed: true to allow the master optimizer to run the optimizer with the specified            tag; false to block it

## Method: setTarget
- parameter: `t`, type: `T`

Description: Set the optimizer's target.
parameter: t: optimization target

## Method: unregisterInstrumenter
- parameter: `instrumenter`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizerInstrumenter<T>`
- return type: `boolean`

Description: Unregister an instrumenter
parameter: instrumenter: instrumenter to unregister
return: true if the instrumenter was removed, false otherwise

## Method: unregisterOptimizer
- parameter: `entry`, type: `com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.OptimizerEntry<T>`
- return type: `boolean`

Description: Remove an optimizer.
parameter: entry: optimizer entry to unregister
return: true if the optimizer was removed

