public abstract class

AbstractJStatementOptimizer

extends AbstractJOptimizer
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.AbstractPlugin
     ↳ com.pnfsoftware.jeb.core.units.code.java.AbstractJOptimizer
       ↳ com.pnfsoftware.jeb.core.units.code.java.AbstractJStatementOptimizer

Class Overview

A specialized skeleton implementation for a method AST optimizer meant to run on every statement of AST code of the method, recursively. This optimizer may be used to optimize AST methods only, not AST classes.

Refer to the javadoc of the parent types for more information.

Summary

[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.core.units.code.java.AbstractJOptimizer
Public Constructors
AbstractJStatementOptimizer()
Create a standard optimizer.
AbstractJStatementOptimizer(JOptimizerType type)
Create an optimizer.
AbstractJStatementOptimizer(JOptimizerType type, String name)
Create an optimizer.
Public Methods
abstract int optimizeStatement(IJavaStatement stm)
Optimize an AST statement.
int perform()
The default implementation calls performInternal(IJavaBlock) on the input AST method, if the element to be optimized is a method.
Protected Methods
int performInternal(IJavaBlock b)
The default implementation calls optimizeStatement(IJavaStatement) on all statements of the AST method to be optimized.
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.core.units.code.java.AbstractJOptimizer
From class com.pnfsoftware.jeb.core.AbstractPlugin
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.IPlugin
From interface com.pnfsoftware.jeb.core.units.code.java.IJOptimizer

Public Constructors

public AbstractJStatementOptimizer ()

Create a standard optimizer.

public AbstractJStatementOptimizer (JOptimizerType type)

Create an optimizer.

public AbstractJStatementOptimizer (JOptimizerType type, String name)

Create an optimizer.

Public Methods

public abstract int optimizeStatement (IJavaStatement stm)

Optimize an AST statement. Optimizers must implement this method.

Parameters
stm statement to be optimized
Returns
  • number of optimizations performed

public int perform ()

The default implementation calls performInternal(IJavaBlock) on the input AST method, if the element to be optimized is a method.

It may be overridden, although it is not recommended.

Returns
  • the number of optimizations performed, 0 if none

Protected Methods

protected int performInternal (IJavaBlock b)

The default implementation calls optimizeStatement(IJavaStatement) on all statements of the AST method to be optimized. The method tree is visited in depth, statements are optimized pre-visit.

It may be overridden, although it is not recommended.

Returns
  • number of optimizations performed