@Override public void validateInput(String args[]) throws Exception { if (args.length < 2) { engine.inputMessage(); Miscellaneous.exit(); } }
@Override public void init(String args[]) throws Exception { String superArgs[] = null; StatsHolder.getInstanceOf().addStatArgs(args); engine.setDefaults(); try { superArgs = engine.processArgs(args); } catch (Exception d) { engine.inputMessage(); // Miscellaneous.printlnErr("************ ERROR Wrong input: " + d.getMessage()); // d.printStackTrace(); Miscellaneous.exit(); } // do not forget this. However, at the end as third parameter was set above properly super.init(superArgs); System.arraycopy(superArgs, 0, args, 0, args.length); }
@Override public void execute(String args[]) throws Exception { try { statHolder.addStat( StatGroups.BYTECODE_OPTIMIZATION, "Total size of all instructions ", CodeAtt.getCodeTotalLengthInput()); super.execute(args); if (!doOptimization) { return; } InputOptionsController.getInstanceOf().execute(); endWithOptimization = true; Oracle.getInstanceOf().updateAllCodeAttsLength(); } catch (Exception d) { d.printStackTrace(); Miscellaneous.exit(); } }
/** * Description: * * <p> * * @author Faisal Aslam * @version 1.0 */ public class StartMeBCC extends StartMeOGC { public static boolean doOptimization = true; private static boolean endWithOptimization = false; private static final InputOptionsController engine = InputOptionsController.getInstanceOf(); private static final StatsHolder statHolder = StatsHolder.getInstanceOf(); public StartMeBCC() { super(); } public static boolean isEndWithOptimization() { return endWithOptimization; } public static double totalReductionPercentage(double reduction) { double totalCodeSize = CodeAtt.getCodeTotalLengthInput(); return ((reduction) / totalCodeSize) * 100.0; } @Override public void init(String args[]) throws Exception { String superArgs[] = null; StatsHolder.getInstanceOf().addStatArgs(args); engine.setDefaults(); try { superArgs = engine.processArgs(args); } catch (Exception d) { engine.inputMessage(); // Miscellaneous.printlnErr("************ ERROR Wrong input: " + d.getMessage()); // d.printStackTrace(); Miscellaneous.exit(); } // do not forget this. However, at the end as third parameter was set above properly super.init(superArgs); System.arraycopy(superArgs, 0, args, 0, args.length); } @Override public void validateInput(String args[]) throws Exception { if (args.length < 2) { engine.inputMessage(); Miscellaneous.exit(); } } @Override public void execute(String args[]) throws Exception { try { statHolder.addStat( StatGroups.BYTECODE_OPTIMIZATION, "Total size of all instructions ", CodeAtt.getCodeTotalLengthInput()); super.execute(args); if (!doOptimization) { return; } InputOptionsController.getInstanceOf().execute(); endWithOptimization = true; Oracle.getInstanceOf().updateAllCodeAttsLength(); } catch (Exception d) { d.printStackTrace(); Miscellaneous.exit(); } } public static void main(String args[]) throws Exception { (new StartMeBCC()).start(args); } }