Example usage for java.io File getAbsolutePath

List of usage examples for java.io File getAbsolutePath

Introduction

In this page you can find the example usage for java.io File getAbsolutePath.

Prototype

public String getAbsolutePath() 

Source Link

Document

Returns the absolute pathname string of this abstract pathname.

Usage

From source file:com.foudroyantfactotum.mod.fousarchive.utility.midi.FileSupporter.java

public static void main(String[] args) throws InterruptedException, IOException {
    for (int i = 0; i < noOfWorkers; ++i)
        pool.submit(new ConMidiDetailsPuller());

    final File sourceDir = new File(source);
    final File outputDir = new File(output);

    Logger.info(UserLogger.GENERAL, "source directory: " + sourceDir.getAbsolutePath());
    Logger.info(UserLogger.GENERAL, "output directory: " + outputDir.getAbsolutePath());
    Logger.info(UserLogger.GENERAL, "processing midi files using " + noOfWorkers + " cores");

    FileUtils.deleteDirectory(outputDir);
    FileUtils.touch(new File(outputDir + "/master.json.gz"));

    for (File sfile : sourceDir.listFiles()) {
        recFile(sfile, files);/*from w w w  .j  av  a 2 s.c o m*/
    }

    for (int i = 0; i < noOfWorkers; ++i)
        files.put(TERMINATOR);

    pool.shutdown();
    pool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);//just get all the work done first.

    try (final OutputStream fstream = new FileOutputStream(outputDir + "/master.json.gz")) {
        try (final GZIPOutputStream gzstream = new GZIPOutputStream(fstream)) {
            final OutputStreamWriter osw = new OutputStreamWriter(gzstream);

            osw.write(JSON.toJson(processedMidiFiles));
            osw.flush();
        }
    } catch (IOException e) {
        Logger.info(UserLogger.GENERAL, e.toString());
    }

    Logger.info(UserLogger.GENERAL, "Processed " + processedMidiFiles.size() + " midi files out of " + fileCount
            + " files. " + (fileCount - processedMidiFiles.size()) + " removed");
}

From source file:alluxio.master.backcompat.BackwardsCompatibilityJournalGenerator.java

/**
 * Generates journal files to be used by the backwards compatibility test. The files are named
 * based on the current version defined in ProjectConstants.VERSION. Run this with each release,
 * and commit the created journal and snapshot into the git repository.
 *
 * @param args no args expected//from   ww  w .ja v a 2 s .  c  o m
 */
public static void main(String[] args) throws Exception {
    BackwardsCompatibilityJournalGenerator generator = new BackwardsCompatibilityJournalGenerator();
    new JCommander(generator, args);
    if (!LoginUser.get().getName().equals("root")) {
        System.err.printf("Journals must be generated as root so that they can be replayed by root%n");
        System.exit(-1);
    }
    File journalDst = new File(generator.getOutputDirectory(),
            String.format("journal-%s", ProjectConstants.VERSION));
    if (journalDst.exists()) {
        System.err.printf("%s already exists, delete it first%n", journalDst.getAbsolutePath());
        System.exit(-1);
    }
    File backupDst = new File(generator.getOutputDirectory(),
            String.format("backup-%s", ProjectConstants.VERSION));
    if (backupDst.exists()) {
        System.err.printf("%s already exists, delete it first%n", backupDst.getAbsolutePath());
        System.exit(-1);
    }
    MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.BACKWARDS_COMPATIBILITY)
            .setClusterName("BackwardsCompatibility").setNumMasters(1).setNumWorkers(1).build();
    try {
        cluster.start();
        cluster.notifySuccess();
        cluster.waitForAllNodesRegistered(10 * Constants.SECOND_MS);
        for (TestOp op : OPS) {
            op.apply(cluster.getClients());
        }
        AlluxioURI backup = cluster.getMetaMasterClient()
                .backup(new File(generator.getOutputDirectory()).getAbsolutePath(), true).getBackupUri();
        FileUtils.moveFile(new File(backup.getPath()), backupDst);
        cluster.stopMasters();
        FileUtils.copyDirectory(new File(cluster.getJournalDir()), journalDst);
    } catch (Throwable t) {
        t.printStackTrace();
    } finally {
        cluster.destroy();
    }
    System.out.printf("Artifacts successfully generated at %s and %s%n", journalDst.getAbsolutePath(),
            backupDst.getAbsolutePath());
}

From source file:fr.cs.examples.frames.Frames3.java

public static void main(String[] args) {
    try {/* w  ww. j a  v a  2  s .co  m*/

        // configure Orekit and printing format
        Autoconfiguration.configureOrekit();

        // Initial state definition :
        // ==========================

        // Date
        // ****
        AbsoluteDate initialDate = new AbsoluteDate(new DateComponents(1970, 04, 07), TimeComponents.H00,
                TimeScalesFactory.getUTC());

        // Orbit
        // *****
        // The Sun is in the orbital plane for raan ~ 202
        double mu = 3.986004415e+14; // gravitation coefficient
        Frame eme2000 = FramesFactory.getEME2000(); // inertial frame
        Orbit orbit = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.),
                FastMath.toRadians(220.), FastMath.toRadians(5.300), PositionAngle.MEAN, eme2000, initialDate,
                mu);

        // Attitude laws
        // *************

        // Earth
        Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
        BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
                Constants.WGS84_EARTH_FLATTENING, earthFrame);

        // Target pointing attitude provider over satellite nadir at date, without yaw compensation
        NadirPointing nadirLaw = new NadirPointing(eme2000, earth);

        // Target pointing attitude provider with yaw compensation
        final PVCoordinatesProvider sun = CelestialBodyFactory.getSun();
        YawSteering yawSteeringLaw = new YawSteering(eme2000, nadirLaw, sun, Vector3D.MINUS_I);

        // Propagator : Eckstein-Hechler analytic propagator
        Propagator propagator = new EcksteinHechlerPropagator(orbit, yawSteeringLaw,
                Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS, Constants.EIGEN5C_EARTH_MU,
                Constants.EIGEN5C_EARTH_C20, Constants.EIGEN5C_EARTH_C30, Constants.EIGEN5C_EARTH_C40,
                Constants.EIGEN5C_EARTH_C50, Constants.EIGEN5C_EARTH_C60);

        // Let's write the results in a file in order to draw some plots.
        propagator.setMasterMode(10, new OrekitFixedStepHandler() {

            PrintStream out = null;

            public void init(SpacecraftState s0, AbsoluteDate t) throws PropagationException {
                try {
                    File file = new File(System.getProperty("user.home"), "XYZ.dat");
                    System.out.println("Results written to file: " + file.getAbsolutePath());
                    out = new PrintStream(file);
                    out.println("#time X Y Z Wx Wy Wz");
                } catch (IOException ioe) {
                    throw new PropagationException(ioe, LocalizedFormats.SIMPLE_MESSAGE,
                            ioe.getLocalizedMessage());
                }
            }

            public void handleStep(SpacecraftState currentState, boolean isLast) throws PropagationException {
                try {

                    // get the transform from orbit/attitude reference frame to spacecraft frame
                    Transform inertToSpacecraft = currentState.toTransform();

                    // get the position of the Sun in orbit/attitude reference frame
                    Vector3D sunInert = sun.getPVCoordinates(currentState.getDate(), currentState.getFrame())
                            .getPosition();

                    // convert Sun position to spacecraft frame
                    Vector3D sunSat = inertToSpacecraft.transformPosition(sunInert);

                    // and the spacecraft rotational rate also
                    Vector3D spin = inertToSpacecraft.getRotationRate();

                    // Lets calculate the reduced coordinates
                    double sunX = sunSat.getX() / sunSat.getNorm();
                    double sunY = sunSat.getY() / sunSat.getNorm();
                    double sunZ = sunSat.getZ() / sunSat.getNorm();

                    out.format(Locale.US, "%s %12.3f %12.3f %12.3f %12.7f %12.7f %12.7f%n",
                            currentState.getDate(), sunX, sunY, sunZ, spin.getX(), spin.getY(), spin.getZ());

                    if (isLast) {
                        out.close();
                    }
                } catch (OrekitException oe) {
                    throw new PropagationException(oe);
                }
            }

        });

        System.out.println("Running...");
        propagator.propagate(initialDate.shiftedBy(6000));

    } catch (OrekitException oe) {
        System.err.println(oe.getMessage());
    }
}

From source file:com.wouterbreukink.onedrive.Main.java

public static void main(String[] args) throws Exception {

    // Parse command line args
    try {//from  www.j a  v a 2s .c  o  m
        CommandLineOpts.initialise(args);
    } catch (ParseException ex) {
        log.error("Unable to parse command line arguments - " + ex.getMessage());
        CommandLineOpts.printHelp();
        return;
    }

    if (getCommandLineOpts().help()) {
        CommandLineOpts.printHelp();
        return;
    }

    if (getCommandLineOpts().version()) {
        String version = getCommandLineOpts().getClass().getPackage().getImplementationVersion();
        log.info("onedrive-java-client version " + (version != null ? version : "DEVELOPMENT"));
        return;
    }

    // Initialise a log file (if set)
    if (getCommandLineOpts().getLogFile() != null) {
        String logFileName = LogUtils.addFileLogger(getCommandLineOpts().getLogFile());
        log.info(String.format("Writing log output to %s", logFileName));
    }

    if (getCommandLineOpts().isAuthorise()) {
        AuthorisationProvider.FACTORY.printAuthInstructions();
        return;
    }

    if (getCommandLineOpts().getLocalPath() == null || getCommandLineOpts().getRemotePath() == null
            || getCommandLineOpts().getDirection() == null) {
        log.error("Must specify --local, --remote and --direction");
        CommandLineOpts.printHelp();
        return;
    }

    // Initialise the OneDrive authorisation
    AuthorisationProvider authoriser;
    try {
        authoriser = AuthorisationProvider.FACTORY.create(getCommandLineOpts().getKeyFile());
        authoriser.getAccessToken();
    } catch (OneDriveAPIException ex) {
        log.error("Unable to authorise client: " + ex.getMessage());
        log.error("Re-run the application with --authorise");
        return;
    }

    // Initialise the providers
    OneDriveProvider api;
    FileSystemProvider fileSystem;
    if (getCommandLineOpts().isDryRun()) {
        log.warn("This is a dry run - no changes will be made");
        api = OneDriveProvider.FACTORY.readOnlyApi(authoriser);
        fileSystem = FileSystemProvider.FACTORY.readOnlyProvider();
    } else {
        api = OneDriveProvider.FACTORY.readWriteApi(authoriser);
        fileSystem = FileSystemProvider.FACTORY.readWriteProvider();
    }

    // Report on progress
    TaskReporter reporter = new TaskReporter();

    // Get the primary drive
    Drive primary = api.getDefaultDrive();

    // Report quotas
    log.info(String.format("Using drive with id '%s' (%s). Usage %s of %s (%.2f%%)", primary.getId(),
            primary.getDriveType(), readableFileSize(primary.getQuota().getUsed()),
            readableFileSize(primary.getQuota().getTotal()),
            ((double) primary.getQuota().getUsed() / primary.getQuota().getTotal()) * 100));

    // Check the given root folder
    OneDriveItem rootFolder = api.getPath(getCommandLineOpts().getRemotePath());

    if (!rootFolder.isDirectory()) {
        log.error(String.format("Specified root '%s' is not a folder", rootFolder.getFullName()));
        return;
    }

    File localRoot = new File(getCommandLineOpts().getLocalPath());

    log.info(String.format("Local folder '%s'", localRoot.getAbsolutePath()));
    log.info(String.format("Remote folder '<onedrive>%s'", rootFolder.getFullName()));

    // Start synchronisation operation at the root
    final TaskQueue queue = new TaskQueue();
    queue.add(new CheckTask(new Task.TaskOptions(queue, api, fileSystem, reporter), rootFolder, localRoot));

    // Get a bunch of threads going
    ExecutorService executorService = Executors.newFixedThreadPool(getCommandLineOpts().getThreads());

    for (int i = 0; i < getCommandLineOpts().getThreads(); i++) {
        executorService.submit(new Runnable() {
            @Override
            public void run() {
                try {
                    //noinspection InfiniteLoopStatement
                    while (true) {
                        Task taskToRun = null;
                        try {
                            taskToRun = queue.take();
                            taskToRun.run();
                        } finally {
                            if (taskToRun != null) {
                                queue.done(taskToRun);
                            }
                        }
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }
        });
    }

    queue.waitForCompletion();
    log.info("Synchronisation complete");
    reporter.report();
}

From source file:com.kelveden.rastajax.cli.Runner.java

public static void main(String[] args) throws CliExecutionException {

    if (args.length == 0) {
        System.out.println("Usage: rastajax <war file> [<comma-separated packages]");
        return;/* w  ww .java2s .  c  o  m*/
    }

    final File warFile = args.length > 0 ? new File(args[0]) : findWar();
    final String packages = args.length > 1 ? args[1] : "com,org,net";

    LOGGER.info("Loading war from " + warFile.getAbsolutePath());

    final File workingDirectory = ensureWorkingDirectory();
    extractWarFile(warFile, workingDirectory);

    final List<URL> urls = getClasspathURLs(workingDirectory);

    final Set<FlatResource> representation = loadRepresentation(urls, packages);

    for (FlatResource f : representation) {
        printInfo("");
        printInfo(ANSI_GREEN + f.getUriTemplate() + ANSI_RESET);
        for (FlatResourceMethod m : f.getResourceMethods()) {
            writeResourceMethod(m);
        }
    }
}

From source file:com.sangupta.nutz.PerformanceTestSuite.java

public static void main(String[] args) throws Exception {
    File dir = new File("src/test/resources/markdown");
    File[] files = dir.listFiles();

    for (File file : files) {
        if (file.getName().endsWith(".text")) {
            final String markup = FileUtils.readFileToString(file);

            String html = file.getAbsolutePath();
            html = html.replace(".text", ".html");
            html = FileUtils.readFileToString(new File(html));

            TestData testData = new TestData(markup, html);
            tests.add(testData);//from  w  w w.ja  v  a 2  s .c om
        }
    }

    TestResults nutz = runTests(new TestExecutor() {

        private MarkdownProcessor processor = new MarkdownProcessor();

        @Override
        public String convertMarkup(String markup) throws Exception {
            return processor.toHtml(markup);
        }

    });

    TestResults txtmark = runTests(new TestExecutor() {

        @Override
        public String convertMarkup(String markup) throws Exception {
            return Processor.process(markup);
        }

    });

    TestResults pegdown = runTests(new TestExecutor() {

        private PegDownProcessor processor = new PegDownProcessor();

        @Override
        public String convertMarkup(String markup) throws Exception {
            return processor.markdownToHtml(markup);
        }

    });

    System.out.println("\n\n\n\n\n");
    System.out.println("Nutz: " + nutz);
    System.out.println("Pegdown: " + pegdown);
    System.out.println("TextMark: " + txtmark);
}

From source file:com.act.lcms.v2.TraceIndexAnalyzer.java

public static void main(String[] args) throws Exception {
    Options opts = new Options();
    for (Option.Builder b : OPTION_BUILDERS) {
        opts.addOption(b.build());// w w w .j  a va2 s .  c om
    }

    CommandLine cl = null;
    try {
        CommandLineParser parser = new DefaultParser();
        cl = parser.parse(opts, args);
    } catch (ParseException e) {
        System.err.format("Argument parsing failed: %s\n", e.getMessage());
        HELP_FORMATTER.printHelp(TraceIndexExtractor.class.getCanonicalName(), HELP_MESSAGE, opts, null, true);
        System.exit(1);
    }

    if (cl.hasOption("help")) {
        HELP_FORMATTER.printHelp(TraceIndexExtractor.class.getCanonicalName(), HELP_MESSAGE, opts, null, true);
        return;
    }

    File rocksDBFile = new File(cl.getOptionValue(OPTION_INDEX_PATH));
    if (!rocksDBFile.exists()) {
        System.err.format("Index file at %s does not exist, nothing to analyze", rocksDBFile.getAbsolutePath());
        HELP_FORMATTER.printHelp(TraceIndexExtractor.class.getCanonicalName(), HELP_MESSAGE, opts, null, true);
        System.exit(1);
    }

    LOGGER.info("Starting analysis");

    TraceIndexAnalyzer analyzer = new TraceIndexAnalyzer();
    analyzer.runExtraction(rocksDBFile, new File(cl.getOptionValue(OPTION_OUTPUT_PATH)));

    LOGGER.info("Done");
}

From source file:SystemFileTree.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);

    RGB color = shell.getBackground().getRGB();
    Label separator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    Label locationLb = new Label(shell, SWT.NONE);
    locationLb.setText("Location:");
    Composite locationComp = new Composite(shell, SWT.EMBEDDED);
    Label separator2 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    final Composite comp = new Composite(shell, SWT.NONE);
    final Tree fileTree = new Tree(comp, SWT.SINGLE | SWT.BORDER);
    Sash sash = new Sash(comp, SWT.VERTICAL);
    Composite tableComp = new Composite(comp, SWT.EMBEDDED);
    Label separator3 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    Composite statusComp = new Composite(shell, SWT.EMBEDDED);

    java.awt.Frame locationFrame = SWT_AWT.new_Frame(locationComp);
    final java.awt.TextField locationText = new java.awt.TextField();
    locationFrame.add(locationText);//from  w  w  w.  jav  a 2s  .  co  m

    java.awt.Frame statusFrame = SWT_AWT.new_Frame(statusComp);
    statusFrame.setBackground(new java.awt.Color(color.red, color.green, color.blue));
    final java.awt.Label statusLabel = new java.awt.Label();
    statusFrame.add(statusLabel);
    statusLabel.setText("Select a file");

    sash.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            if (e.detail == SWT.DRAG)
                return;
            GridData data = (GridData) fileTree.getLayoutData();
            Rectangle trim = fileTree.computeTrim(0, 0, 0, 0);
            data.widthHint = e.x - trim.width;
            comp.layout();
        }
    });

    File[] roots = File.listRoots();
    for (int i = 0; i < roots.length; i++) {
        File file = roots[i];
        TreeItem treeItem = new TreeItem(fileTree, SWT.NONE);
        treeItem.setText(file.getAbsolutePath());
        treeItem.setData(file);
        new TreeItem(treeItem, SWT.NONE);
    }
    fileTree.addListener(SWT.Expand, new Listener() {
        public void handleEvent(Event e) {
            TreeItem item = (TreeItem) e.item;
            if (item == null)
                return;
            if (item.getItemCount() == 1) {
                TreeItem firstItem = item.getItems()[0];
                if (firstItem.getData() != null)
                    return;
                firstItem.dispose();
            } else {
                return;
            }
            File root = (File) item.getData();
            File[] files = root.listFiles();
            if (files == null)
                return;
            for (int i = 0; i < files.length; i++) {
                File file = files[i];
                if (file.isDirectory()) {
                    TreeItem treeItem = new TreeItem(item, SWT.NONE);
                    treeItem.setText(file.getName());
                    treeItem.setData(file);
                    new TreeItem(treeItem, SWT.NONE);
                }
            }
        }
    });
    fileTree.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            TreeItem item = (TreeItem) e.item;
            if (item == null)
                return;
            final File root = (File) item.getData();
            statusLabel.setText(root.getAbsolutePath());
            locationText.setText(root.getAbsolutePath());
        }
    });

    GridLayout layout = new GridLayout(4, false);
    layout.marginWidth = layout.marginHeight = 0;
    layout.horizontalSpacing = layout.verticalSpacing = 1;
    shell.setLayout(layout);
    GridData data;
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    separator1.setLayoutData(data);
    data = new GridData();
    data.horizontalSpan = 1;
    data.horizontalIndent = 10;
    locationLb.setLayoutData(data);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.heightHint = locationText.getPreferredSize().height;
    locationComp.setLayoutData(data);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    separator2.setLayoutData(data);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 4;
    comp.setLayoutData(data);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    separator3.setLayoutData(data);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 4;
    data.heightHint = statusLabel.getPreferredSize().height;
    statusComp.setLayoutData(data);

    layout = new GridLayout(3, false);
    layout.marginWidth = layout.marginHeight = 0;
    layout.horizontalSpacing = layout.verticalSpacing = 1;
    comp.setLayout(layout);
    data = new GridData(GridData.FILL_VERTICAL);
    data.widthHint = 200;
    fileTree.setLayoutData(data);
    data = new GridData(GridData.FILL_VERTICAL);
    sash.setLayoutData(data);
    data = new GridData(GridData.FILL_BOTH);
    tableComp.setLayoutData(data);

    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:com.jaeksoft.searchlib.parser.ExternalParser.java

public final static void main(String[] args) {
    Results results = null;/*  w  ww. j  av a2s.com*/
    try {
        File fileParserConfig = new File(FILE_PARSER_CONFIG);
        if (!fileParserConfig.exists())
            throw new FileNotFoundException(fileParserConfig.getAbsolutePath());
        XPathParser xpp = new XPathParser(fileParserConfig);
        Parser parser = (Parser) ParserFactory.create(null, xpp, xpp.getNode("/parser"));
        if (parser == null)
            throw new SearchLibException("Parser not found");
        File fileParserCommand = new File(FILE_PARSER_COMMAND);
        if (!fileParserCommand.exists())
            throw new FileNotFoundException(fileParserCommand.getAbsolutePath());
        Command command = JsonUtils.getObject(fileParserCommand, Command.class);
        if (command == null)
            throw new SearchLibException("Not parsing command found");
        StartStopListener.OPENSEARCHSERVER_DATA_FILE = new File(command.opensearchserver_data_path);
        IndexDocument indexSourceDocument = command.sourceDocument == null ? null
                : DocumentUpdate.getIndexDocument(command.sourceDocument);
        StreamLimiterFile streamLimiterFile = new StreamLimiterFile(parser.getSizeLimit(),
                new File(command.filePath), command.originalURL);
        parser.doParserContent(indexSourceDocument, streamLimiterFile, command.lang);
        results = parser.getExternalResults();
    } catch (Exception e) {
        results = new Results(e);
    } finally {
        File fileParserResults = new File(FILE_PARSER_RESULTS);
        if (fileParserResults.exists())
            fileParserResults.delete();
        try {
            JsonUtils.jsonToFile(results, fileParserResults);
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    System.exit(0);
}

From source file:com.github.christofluyten.experiment.MeasureGendreau.java

/**
 * @param args/*from w w  w. j a  v  a 2  s .  c  o  m*/
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    final List<Gendreau06Scenario> scns = new ArrayList<>(
            Gendreau06Parser.parser().addDirectory("files/gendreau2006/requests").parse());

    Collections.sort(scns, new Comparator<Gendreau06Scenario>() {
        @Override
        public int compare(Gendreau06Scenario o1, Gendreau06Scenario o2) {
            final int compare = o1.getProblemClass().getId().compareTo(o2.getProblemClass().getId());
            if (compare == 0) {
                return o1.getProblemInstanceId().compareTo(o2.getProblemInstanceId());
            }
            return compare;
        }
    });

    final List<Map<Property, Object>> propsList = new ArrayList<>();
    for (final Gendreau06Scenario scen : scns) {
        final StatisticalSummary urgency = Metrics.measureUrgency(scen);
        final Multiset<Class<?>> counts = Metrics.getEventTypeCounts(scen);

        final long scenarioLength = scen.getProblemClass().duration * 60000;
        final double dyn = Metrics.measureDynamism(scen, scenarioLength);

        final ImmutableMap<Property, Object> prop = ImmutableMap.<Property, Object>builder()
                .put(Property.PROBLEM_CLASS, scen.getProblemClass().getId())
                .put(Property.INSTANCE_ID, scen.getProblemInstanceId()).put(Property.DYNAMISM, dyn)
                .put(Property.URGENCY_MEAN, urgency.getMean() / 60000d)
                .put(Property.URGENCY_SD, urgency.getStandardDeviation() / 60000d)
                .put(Property.NUM_ORDERS, counts.count(AddParcelEvent.class))
                .put(Property.NUM_VEHICLES, counts.count(AddVehicleEvent.class))
                .putAll(MAP.get(scen.getProblemInstanceId() + scen.getProblemClass().getId())).build();

        propsList.add(prop);
    }

    final File targetFile = new File(PROPS_FILE);
    write(propsList, targetFile, asList(Property.values()));
    System.out.println("Results written to " + targetFile.getAbsolutePath());
}