source: trunk/t3q/src/org/etsi/t3q/T3Q.java @ 7

Last change on this file since 7 was 7, checked in by phdmakk, 14 years ago
  • Property svn:mime-type set to text/plain
File size: 23.2 KB
Line 
1package org.etsi.t3q;
2
3import java.io.File;
4
5import java.util.ArrayList;
6import java.util.Comparator;
7import java.util.HashMap;
8import java.util.List;
9
10import org.apache.commons.cli.CommandLine;
11import org.apache.commons.cli.CommandLineParser;
12import org.apache.commons.cli.GnuParser;
13import org.apache.commons.cli.HelpFormatter;
14import org.apache.commons.cli.Option;
15import org.apache.commons.cli.ParseException;
16import org.etsi.t3q.config.QualityCheckProfile;
17import org.etsi.t3q.config.T3QConfig;
18import org.etsi.t3q.config.T3QOptionsHandler;
19import org.etsi.t3q.exceptions.TTCN3BehaviorException;
20import org.etsi.t3q.exceptions.TTCN3ParserException;
21import org.etsi.t3q.visitor.T3QVisitor;
22import org.etsi.common.InputInterface;
23import org.etsi.common.MiscTools;
24import org.etsi.common.configuration.ConfigTools;
25import org.etsi.common.exceptions.TerminationException;
26import org.etsi.common.logging.LoggingInterface.LogLevel;
27import org.etsi.common.logging.LoggingInterface.MessageClass;
28
29import antlr.MismatchedTokenException;
30import antlr.RecognitionException;
31import antlr.TokenStreamException;
32import de.ugoe.cs.swe.trex.core.analyzer.rfparser.LocationAST;
33import de.ugoe.cs.swe.trex.core.analyzer.rfparser.TTCN3Analyzer;
34import de.ugoe.cs.swe.trex.core.analyzer.rfparser.TTCN3AnalyzerFlyweightFactory;
35import de.ugoe.cs.swe.trex.core.analyzer.rfparser.TTCN3Parser;
36import de.ugoe.cs.swe.trex.core.formatter.TTCN3Formatter;
37
38public class T3Q {
39
40        private static String versionNumber = "v1.0.2";
41        //set during automated server builds
42        private static String buildStamp = "---BUILD_STAMP---";
43        public static QualityCheckProfile activeProfile = null;
44        private String configurationClassName = T3QConfig.class.getName();
45        private String configurationProfileClassName = QualityCheckProfile.class.getName();
46        private String configurationFilename;
47        private String selectedProfileName = null;
48        private static LogLevel logLevel = LogLevel.INFORMATION;
49       
50        private HashMap<String, String> argsMap = new HashMap<String, String>();
51        private ArrayList<String> inputPaths = new ArrayList<String>();
52        private String destinationPath = null;
53       
54        private HashMap<String, Integer> linesOfCodeMap = new HashMap<String, Integer>();
55        private int totalLoc = 0;
56
57        private boolean generateNewConfiguration = false;
58       
59        private boolean formattingEnabled = false;
60       
61
62        //TODO: statistics shall be ideally based on XSLT, meaning the output shall be transformed into XML
63        //TODO: also add exception checking for the profiles
64        public T3Q() {
65        }
66
67        // --------------------------------------------------------------------------
68
69        public void showHelp() {
70                System.out.println("\nHelp:");
71                // TODO: update help
72                // TODO: transfer to t3d as well
73                // System.out.println("  t3q[.bat] [options] (path | filename)+");
74                // System.out.println("");
75                // System.out.println("  Options (specify in any order): ");
76                // System.out.println("    --help - prints this screen");
77                // System.out
78                // .println("    --profile [profilename] - allows manual profile selection, overriding the selected default profile");
79                // // System.out.println("    --output [path] ");
80                // System.out.println("");
81
82                HelpFormatter formatter = new HelpFormatter();
83                formatter.setOptionComparator(new Comparator<Option>() {
84                       
85                        @Override
86                        public int compare(Option o1, Option o2) {
87                                if (o1.getId() > o2.getId()) {
88                                        return 1;
89                                } else {
90                                        return -1;
91                                }
92                        }
93                });
94//              formatter.setWidth(120);
95                formatter.setSyntaxPrefix("  Usage: ");
96                formatter.printHelp("t3q [options] (filename | path)+", "  Options: (in any order, config is required)",
97                                new T3QOptionsHandler().getOptions(), "");
98                System.out.println("");
99        }
100
101        // --------------------------------------------------------------------------
102        private void showDebugInfo(String[] args) {
103                if (getLogLevel().equals(LogLevel.DEBUG)) {
104                        System.out.println("==================ARGS:===================");
105                        for (int a = 0; a < args.length; a++) {
106                                System.out.println("   " + args[a]);
107                        }
108                        System.out.println("==================PROPERTIES:=============");
109                        for(Object key : System.getProperties().keySet()) {
110                                System.out.println("   "+key.toString() + " : "+System.getProperty(key.toString()));
111                        }
112                       
113                        System.out.println("==========================================");
114                }
115        }
116
117        // --------------------------------------------------------------------------
118//TODO: Revise and reorganize for reusability
119        public void run(String[] args) {
120                System.out.println("T3Q " + getVersionNumber());
121                System.out.println("Build " + getBuildStamp());
122                System.out.println("  TTCN-3 version supported: "
123                                + TTCN3Parser.getSupportedVersion());
124                System.out.println("==========================================");
125                try {
126                        if (handleCommandLineArguments(args) == false) {
127                                return;
128                        }
129                        showDebugInfo(args);
130                        if (selectedProfileName != null) {
131                                handleConfig(selectedProfileName);
132                        } else {
133                                handleConfig(null);
134                        }
135                } catch (TerminationException e) {
136                        // TODO: handle exception
137                        System.out.println("ERRORING OUT!");
138                }
139               
140                TTCN3Parser.disableStatementBlockCompatibilityMode();
141                TTCN3Parser.enableStatementBlockCompatibilityMode();
142
143                List<String> ttcn3Resources = new InputInterface(T3Q.activeProfile.getResourceExtensionsRegExp(), T3Q.activeProfile.getProjectExtension(),
144                                T3Q.activeProfile.isSettingRecursiveProcessing()).getInputFromParameterList(inputPaths);
145                ttcn3Resources = InputInterface.filterAbsoluteDuplicates(ttcn3Resources);
146               
147               
148                if (ttcn3Resources.isEmpty()) {
149                        // Terminate
150                        System.out.println("No ttcn3 files found!");
151                        showHelp();
152                        return;
153                }
154
155                long startTime = System.currentTimeMillis();
156                TTCN3Analyzer analyzer = null;
157
158                try {
159                        System.out.println("Parsing files...");
160                        for (int i = 0; i < ttcn3Resources.size(); i++) {
161                                String resourcePath = ttcn3Resources.get(i);
162                                analyzeFile(resourcePath);
163                                TTCN3AnalyzerFlyweightFactory analyzerFactory = TTCN3AnalyzerFlyweightFactory
164                                                .getInstance();
165                                analyzer = analyzerFactory.getTTCN3Analyzer(ttcn3Resources
166                                                .get(i));
167                                if (analyzer.getExceptions().size() > 0) {
168                                        String exceptionMessage = "Error while parsing file "
169                                                + analyzer.getFilename();
170                                        //TODO: adapt to T3D as well
171                                        String tree = "";
172                                        tree = LocationAST.dumpTree((LocationAST)analyzer.getParser().getAST(),1,tree);
173                                        if (getLogLevel().equals(LogLevel.DEBUG)) {
174                                                exceptionMessage+="\n" +
175                                                                "Parse-tree trace:\n" +
176                                                                tree;
177                                        }
178                                        if (T3Q.activeProfile.isSettingAbortOnError()) {
179                                                throw new TTCN3ParserException(exceptionMessage);
180                                        } else {
181                                                try {
182                                                        throw new TTCN3ParserException(exceptionMessage);
183                                                } catch (TTCN3ParserException e) {
184                                                        System.err.println(e.getLocalizedMessage());
185                                                        for (int i1 = 0; i1 < analyzer.getExceptions()
186                                                                        .size(); i1++) {
187                                                                System.err.println("Line "
188                                                                                + analyzer.getExceptions().get(i1)
189                                                                                                .getLine()
190                                                                                + ": "
191                                                                                + analyzer.getExceptions().get(i1)
192                                                                                                .getMessage());
193                                                        }
194                                                        // e.printStackTrace();
195                                                }
196                                        }
197                                }
198                        }
199                        long endTime = System.currentTimeMillis();
200                        long elapsed = endTime - startTime;
201                        double elapsedMinutes = ((double) elapsed) / 1000.0 / 60.0;
202                        System.out.println("Done parsing in " + elapsed + "ms ("
203                                        + MiscTools.doubleToString(elapsedMinutes) + " minutes).");
204
205                        if (T3Q.activeProfile.isStatShowLOC()) {
206                                System.out.println("Total lines of code parsed: " + totalLoc);
207                        }
208
209                        TTCN3AnalyzerFlyweightFactory analyzerFactory = TTCN3AnalyzerFlyweightFactory
210                                        .getInstance();
211
212                        System.out.println("Postprocessing...");
213                        startTime = System.currentTimeMillis();
214                        analyzerFactory.postProcess();
215                        endTime = System.currentTimeMillis();
216                        elapsed = endTime - startTime;
217                        elapsedMinutes = ((double) elapsed) / 1000.0 / 60.0;
218                        System.out.println("Done processing in " + elapsed + "ms ("
219                                        + MiscTools.doubleToString(elapsedMinutes) + " minutes).");
220                        startTime = System.currentTimeMillis();
221
222                        System.out.println("==========================================");
223                        //TODO: up to here mostly identical, make reusable
224                       
225                        //TODO: core functionality, encapsulate and extract
226                        for (int i = 0; i < ttcn3Resources.size(); i++) {
227                                analyzer = analyzerFactory.getTTCN3Analyzer(ttcn3Resources
228                                                .get(i));
229                                System.out.println("Analyzing: " + analyzer.getFilename());
230                                T3QVisitor visitor = new T3QVisitor();
231                                visitor.setFilename(analyzer.getFilename());
232                                visitor.acceptDFS((LocationAST) analyzer.getParser().getAST());
233                        }
234                        endTime = System.currentTimeMillis();
235                        elapsed = endTime - startTime;
236                        elapsedMinutes = ((double) elapsed) / 1000.0 / 60.0;
237                        System.out.println("Quality checks finished in " + elapsed + "ms ("
238                                        + MiscTools.doubleToString(elapsedMinutes) + " minutes).");
239
240                        //TODO: custom functionality
241                        analyzer = handleFormatter(ttcn3Resources, analyzer,
242                                        analyzerFactory);
243                        if (T3Q.activeProfile.isStatShowLOC()) {
244                                System.out
245                                                .println("Total lines of code processed: " + totalLoc);
246                        }
247                       
248                        if (T3Q.activeProfile.isStatShowSummary()) {
249                                System.out.println("Brief statistics summary of occurences in message classes:");
250                                for (MessageClass m : MessageClass.values()) {
251                                        System.out.println("\t" + m.getDescription() + " : "
252                                                        + m.getOccurenceCount());
253                                }
254                        }
255                       
256                } catch (TTCN3BehaviorException e) {
257                        System.err.println(e.getLocalizedMessage());
258                } catch (TTCN3ParserException e) {
259                        // Default setting where processing is terminated in the event of a
260                        // parsing error
261                        System.err.println(e.getLocalizedMessage());
262                        for (int i = 0; i < analyzer.getExceptions().size(); i++) {
263                                System.err.println("Line "
264                                                + analyzer.getExceptions().get(i).getLine() + ": "
265                                                + analyzer.getExceptions().get(i).getMessage());
266                        }
267                        // TODO: Isolate different steps and implement a recovery mechanism:
268
269                }
270
271        }
272
273       
274        //TODO: copy back output handling tricks from T3D
275        private TTCN3Analyzer handleFormatter(List<String> ttcn3Resources,
276                        TTCN3Analyzer analyzer,
277                        TTCN3AnalyzerFlyweightFactory analyzerFactory) {
278                long startTime;
279                long endTime;
280                long elapsed;
281                double elapsedMinutes;
282                if (this.isFormattingEnabled()) {
283                        // TODO: consider ways to avoid reparsing (performing the comment
284                        // collection during the first parse)
285                        System.out.println("==========================================");
286                        System.out.println("Formatting Code...");
287                        startTime = System.currentTimeMillis();
288
289                        TTCN3Formatter formatter = new TTCN3Formatter();
290
291                        for (int i = 0; i < ttcn3Resources.size(); i++) {
292                                analyzer = analyzerFactory.getTTCN3Analyzer(ttcn3Resources
293                                                .get(i));
294                                System.out.println("  Formatting file: "
295                                                + analyzer.getFilename());
296                                try {
297
298                                        String resourcePath = ttcn3Resources.get(i);
299
300                                        String source = MiscTools.readFile(resourcePath);
301
302                                        String formatted = formatter.formatTTCN3Source(source,
303                                                        T3Q.activeProfile.getFormattingParameters());
304
305                                        // calculate the target path for the current resource
306
307                                        // TODO: look into it and fix it -> is it not fixed now?
308                                        // reason is: absolute paths are difficult to handle
309                                        // String subPath = resourcePath;
310//                                      String subPath = "/" + new File(resourcePath).getName();
311                                       
312                                        String canonicalResourcePath = new File(resourcePath).getCanonicalPath();
313                                        String canonicalWorkingPath = new File(".").getCanonicalPath();
314                                                                               
315                                        String destinationSubPath = canonicalResourcePath;
316                                       
317                                        //TODO: make this subtraction optional and document the feature
318                                        //CF: Manuel's remark and my answer - it introduces a dependency on the working path which may not be easily understood and has at least be documented properly
319                                        if (canonicalResourcePath.startsWith(canonicalWorkingPath)){
320                                                destinationSubPath = canonicalResourcePath.substring(canonicalWorkingPath.length());
321                                        }
322
323                                        if (destinationSubPath.substring(0,3).endsWith(":\\")){
324                                                destinationSubPath=destinationSubPath.substring(2);
325                                        }
326                                       
327                                        String outputPathArg = new File(getDestinationPath()).getPath(); // also
328                                                                                                                                                // strips
329                                                                                                                                                // the
330                                                                                                                                                // slash
331                                                                                                                                                // if
332                                                                                                                                                // present
333                                        String outputPath = outputPathArg + destinationSubPath;
334
335                                       
336                                       
337//                                      System.out.println("****************************");
338//                                      System.out.println("ABSOLUTE: \t\t"+canonicalResourcePath);
339//                                      System.out.println("WORKING: \t\t"+canonicalWorkingPath);
340//                                      System.out.println("ResourcePath: \t\t"+resourcePath);
341//                                      System.out.println("SubPath: \t\t"+destinationSubPath);
342//                                      System.out.println("OutputPath: \t\t"+outputPath);
343//                                      System.out.println("****************************");
344//                                      System.out.println(formatted);
345//                                      System.out.println(outputPath);
346                                        MiscTools.writeFile(outputPath, formatted);
347                                        System.out.println("File \""+outputPath+"\" written successfully!");
348
349                                } catch (RecognitionException e1) {
350                                        System.err.println("Recognition exception:");
351                                        System.err.println(e1.getLocalizedMessage());
352                                } catch (TokenStreamException e) {
353                                        System.err.println("Token stream exception:");
354                                        e.printStackTrace();
355                                } catch (Exception e) {
356                                        System.err.println("Exception:");
357                                        e.printStackTrace();
358                                }
359
360                        }
361                        endTime = System.currentTimeMillis();
362                        elapsed = endTime - startTime;
363                        elapsedMinutes = ((double) elapsed) / 1000.0 / 60.0;
364                        System.out.println("Code formatting finished in " + elapsed
365                                        + "ms (" + MiscTools.doubleToString(elapsedMinutes) + " minutes).");
366
367                }
368                return analyzer;
369        }
370        //TODO: DUPLICATED IN T3D
371        private boolean handleCommandLineArguments(String[] args) throws TerminationException {
372                //parseCommandLineArguments(args);
373                CommandLine commandLine = parseCommandLineArguments(args);
374                if (commandLine == null) {
375                        return false;
376                }
377                String arguments[] = evaluateCommandLineOptions(commandLine);
378
379                if (commandLine.hasOption("help")) {
380                        showHelp();
381                        return false;
382                }
383
384                if (commandLine.hasOption("config") && arguments.length < 1) {
385                        System.out.println("ERROR: Missing input location(s)");
386                        showHelp();
387                        return false;
388                }
389
390                for (String arg : arguments) {
391                        //TODO: add validity checks
392                        inputPaths.add(arg);
393                }
394               
395                return true;
396        }
397
398        // --------------------------------------------------------------------------
399        //TODO: DUPLICATED IN T3D
400        private CommandLine parseCommandLineArguments(String[] args) {
401                CommandLineParser parser = new GnuParser();
402                T3QOptionsHandler optionsHandler = new T3QOptionsHandler();
403                CommandLine commandLine = null;
404                try {
405                        commandLine = parser.parse(optionsHandler.getOptions(), args);
406                } catch (ParseException e) {
407                        System.out.println("ERROR: " + e.getMessage() );
408                        showHelp();
409                }
410                return commandLine;
411        }
412       
413        // --------------------------------------------------------------------------
414        //TODO: DUPLICATED MOSTLY IN T3D
415        private String[] evaluateCommandLineOptions(CommandLine commandLine) throws TerminationException {
416                if (commandLine.hasOption("generate-config")) {
417                        this.setConfigurationFilename(commandLine.getOptionValue("generate-config"));
418                        this.setGenerateNewConfiguration(true);
419                } else if (commandLine.hasOption("config")) {
420                        this.setConfigurationFilename(commandLine.getOptionValue("config"));
421                } else {
422                        System.out.println("ERROR: No configuration file selected!");
423                        showHelp();
424                        throw new TerminationException("");
425                }
426               
427                if (commandLine.hasOption("profile")) {
428                        this.setSelectedProfileName(commandLine.getOptionValue("profile"));
429                }
430                if (commandLine.hasOption("format")){
431                        this.setFormattingEnabled(true);
432                }
433                if (commandLine.hasOption("verbosity")){
434                        this.selectLogLevel(commandLine.getOptionValue("verbosity"));
435                }
436                if (commandLine.hasOption("output-path")){
437                        this.setDestinationPath(commandLine.getOptionValue("output-path"));
438                }
439                return commandLine.getArgs();
440        }
441       
442        // --------------------------------------------------------------------------
443
444        //TODO: THIS SHALL BE DEPRECATED NOW
445//      private void parseCommandLineArguments(String[] args) {
446//              String key = "";
447//              String value = "";
448//              //targetPath = "";
449//
450//              boolean lastKey = false;
451//              for (int i = 0; i < args.length; i++) {
452//                      if (args[i].startsWith("--")) {
453//                              key = args[i].replaceAll("--", "").toLowerCase();
454//
455//                              if (lastKey) {
456//                                      argsMap.put(key, "true");
457//                                      key = null;
458//                                      value = null;
459//                                      lastKey = false;
460//                              }
461//
462//                              lastKey = true;
463//                      } else {
464//                              value = args[i];
465//                              if ((key != null) && (argsMap.get(key) == null)
466//                                              && (key.length() > 0)) {
467//                                      argsMap.put(key, value);
468//                                      key = null;
469//                                      value = null;
470//                              } else {
471//                                      inputPaths.add(value);
472//                              }
473//                              lastKey = false;
474//                      }
475//              }
476//
477//              if (key != null) {
478//                      if ((argsMap.get(key) == null) && (key.length() > 0)) {
479//                              argsMap.put(key, "true");
480//                      }
481//              }
482//      }
483 
484        // --------------------------------------------------------------------------
485        //TODO: DUPLICATED MOSTLY IN T3D
486        private void handleConfig(String specifiedProfile) throws TerminationException {
487                ConfigTools configTools = new ConfigTools(configurationClassName, configurationProfileClassName);
488                configTools.setToolVersion(getVersionNumber());
489               
490                try {
491                        if (isGenerateNewConfiguration()) {
492                                configTools.initializeNewDefaultConfig(getConfigurationFilename());
493                                System.exit(0);
494                        } else {
495                                configTools.loadConfig(getConfigurationFilename());
496                                activeProfile = (QualityCheckProfile) configTools.selectProfile(specifiedProfile);
497                                if (this.getDestinationPath()==null) {
498                                        setDestinationPath(T3Q.activeProfile.getPathFormattedOutputPath());
499                                }
500                        }
501                } catch (InstantiationException e) {
502                        throw new TerminationException("ERROR: Instantiation problems encountered while loading configuration profile. "+e.getMessage());
503                } catch (IllegalAccessException e) {
504                        throw new TerminationException("ERROR: Instantiation problems encountered while loading configuration profile. "+e.getMessage());
505                } catch (ClassNotFoundException e) {
506                        throw new TerminationException("ERROR: Instantiation problems encountered while loading configuration profile. "+e.getMessage());
507                }
508               
509                if (!isProfileVersionValid()) {
510                        System.out.println("\nERROR: Selected profile \"" + activeProfile.getProfileName()
511                                        + "\" has a mismatching or no version (required: \""+getVersionNumber()+"\").\n" +
512                                                        "  Consider upgrading the profile by transfering the relevant parts to an auto-generated profile or selecting a different profile.\n");
513                        throw new TerminationException("");
514                }
515        }
516        //TODO: DUPLICATED IN T3D
517        private boolean isProfileVersionValid() {
518                if (activeProfile.getProfileVersion() != null && activeProfile.getProfileVersion().equals(getVersionNumber())){
519                        return true;
520                } else {
521                        return false;
522                }
523        }
524        //TODO: DUPLICATED IN T3D
525        private void selectLogLevel(String logLevel) throws TerminationException{
526                boolean selected = false;
527                String possibleValues ="";
528                for (LogLevel l : LogLevel.values()){
529                        if (l.toString().equals(logLevel)){
530                                setLogLevel(l);
531                                selected = true;
532                                System.out.println("Selected log level \""+logLevel+"\"");
533                        }
534                        if (!l.toString().equals("FIXME") && !l.toString().equals("DEBUG"))
535                        possibleValues+=l.toString()+", ";
536                }
537                if (!selected){
538                        System.out.println("\nERROR: No valid log level provided! Possible values are (in ascending inclusive order): "+ possibleValues.substring(0,possibleValues.length()-2)+".");
539                        throw new TerminationException("");
540                }
541               
542        }
543       
544
545//      // --------------------------------------------------------------------------
546//      //TODO: should be obsolete now?
547//      List<String> findTTCN3Resources(String directory) {
548//              List<String> files = new LinkedList<String>();
549//
550//              File f = new File(directory);
551//
552//              File[] fileNames = f.listFiles(new FileFilter() {
553//                      public boolean accept(File pathname) {
554//                              if (pathname.getPath().endsWith(".ttcn3")
555//                                              || pathname.getPath().endsWith(".ttcn")
556//                                              || pathname.getPath().endsWith(".3mp"))
557//                                      return true;
558//                              return false;
559//                      }
560//              });
561//
562//              for (int i = 0; i < fileNames.length; i++) {
563//                      files.add(fileNames[i].getPath());
564//              }
565//
566//              File[] directories = f.listFiles(new FileFilter() {
567//                      public boolean accept(File pathname) {
568//                              if (pathname.isDirectory())
569//                                      return true;
570//                              return false;
571//                      }
572//              });
573//
574//              if (T3Q.activeProfile.isSettingRecursiveProcessing()) {
575//                      for (int i = 0; i < directories.length; i++) {
576//                              files.addAll(findTTCN3Resources(directories[i].getPath()));
577//                      }
578//              }
579//
580//              return files;
581//      }
582
583        // --------------------------------------------------------------------------
584        //TODO: DUPLICATE IN T3D
585        private TTCN3Analyzer analyzeFile(String filename) {
586                TTCN3AnalyzerFlyweightFactory analyzerFactory = TTCN3AnalyzerFlyweightFactory
587                                .getInstance();
588                analyzerFactory.setStandaloneUsage(true);
589                String code = MiscTools.readFile(filename);
590               
591                int loc = MiscTools.getLOC(filename);
592                linesOfCodeMap.put(filename, loc);
593                totalLoc += loc;
594
595                System.out.println("  Parsing file: " + filename + " (LOC: "
596                                + linesOfCodeMap.get(filename) + ") ...");
597                long startTime = System.currentTimeMillis();
598
599                TTCN3Analyzer analyzer = analyzerFactory.getTTCN3Analyzer(filename,
600                                code);
601                try {
602                        analyzer.analyze();
603                } catch (MismatchedTokenException e) {
604                        e.printStackTrace();
605                } catch (RecognitionException e) {
606                        e.printStackTrace();
607                } catch (TokenStreamException e) {
608                        e.printStackTrace();
609                } catch (Exception e) {
610                        e.printStackTrace();
611                }
612                long endTime = System.currentTimeMillis();
613                long elapsed = endTime - startTime;
614                double elapsedMinutes = ((double) elapsed) / 1000.0 / 60.0;
615
616                System.out.println("    ...done in " + elapsed + "ms ("
617                                + MiscTools.doubleToString(elapsedMinutes) + " minutes).");
618
619                return analyzer;
620        }
621
622        // --------------------------------------------------------------------------
623        //TODO: DUPLICATED IN T3D
624        public static void setVersionNumber(String versionNumber) {
625                T3Q.versionNumber = versionNumber;
626        }
627        //TODO: DUPLICATED IN T3D
628        public static String getVersionNumber() {
629                return versionNumber;
630        }
631
632        public static void main(String[] args) {
633                T3Q tool = new T3Q();
634                tool.run(args);
635        }
636        //TODO: DUPLICATED IN T3D
637        public void setConfigurationFilename(String configurationFilename) {
638                this.configurationFilename = configurationFilename;
639        }
640        //TODO: DUPLICATED IN T3D
641        public String getConfigurationFilename() {
642                return configurationFilename;
643        }
644        //TODO: DUPLICATED IN T3D
645        public static void setLogLevel(LogLevel logLevel) {
646                T3Q.logLevel = logLevel;
647        }
648        //TODO: DUPLICATED IN T3D
649        public static LogLevel getLogLevel() {
650                return logLevel;
651        }
652        //TODO: DUPLICATED IN T3D
653        public void setSelectedProfileName(String selectedProfileName) {
654                this.selectedProfileName = selectedProfileName;
655        }
656        //TODO: DUPLICATED IN T3D
657        public String getSelectedProfileName() {
658                return selectedProfileName;
659        }
660
661        public void setFormattingEnabled(boolean formattingEnabled) {
662                this.formattingEnabled = formattingEnabled;
663        }
664       
665        public boolean isFormattingEnabled() {
666                return formattingEnabled;
667        }
668
669        public void setGenerateNewConfiguration(boolean generateNewConfiguration) {
670                this.generateNewConfiguration = generateNewConfiguration;
671        }
672
673        public boolean isGenerateNewConfiguration() {
674                return generateNewConfiguration;
675        }
676
677        public void setDestinationPath(String destinationPath) {
678                this.destinationPath = destinationPath;
679        }
680
681        public String getDestinationPath() {
682                return destinationPath;
683        }
684
685        public static void setBuildStamp(String buildStamp) {
686                T3Q.buildStamp = buildStamp;
687        }
688
689        public static String getBuildStamp() {
690                return buildStamp;
691        }
692
693}
Note: See TracBrowser for help on using the repository browser.