/** * Provides a static entry point for running DAVE as standalone utility. * * @param args */ public static void main(String args[]) { boolean success = false; DAVE dave = new DAVE(args); if (dave.noProcessingRequired) { System.exit(exit_success); // short circuit if just help requested } try { success = dave.parseFile(); } catch (IOException e) { System.err.println(e.getMessage()); } // quit now if problems in parsing if (!success) { System.exit(exit_failure); } // If checkcase data is included, run quick verification if (dave.checkcases != null) { if (dave.ignoreCheckcases) { System.out.println("(Verification cases(s) ignored.)"); } else if (!dave.verify()) { System.exit(exit_failure); } } // Did user ask for stats? if (dave.genStatsFlag) { dave.reportStats(); // report parsing stats } // Did user ask for a listing? if (dave.makeListing) { dave.describeSelf(); } // Did user ask to perform evalution? if (dave.evaluate) { while (true) { // run until ^D entered try { VectorInfoArrayList inputVec = dave.m.getInputVector(); int eof = dave.loadInputs(inputVec); if (eof == -1) { System.out.println(); System.exit(exit_success); } dave.m.cycle(); // run model with inputs VectorInfoArrayList outputVec = dave.m.getOutputVector(); if (outputVec == null) { System.err.println(" Null output vector returned from Model.cycle() "); System.exit(exit_failure); } dave.listOutputs(outputVec); if (dave.createInternalValues) { VectorInfoArrayList internalVec = dave.m.getInternalsVector(); if (internalVec == null) { System.err.println(" Null internal results vector returned from Model.cycle() "); System.exit(exit_failure); } dave.listInternals(internalVec); } } catch (Exception e) { System.err.println(e.getMessage()); } } } }