All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.erigir.wrench.drigo.DrigoResults Maven / Gradle / Ivy

There is a newer version: 2.2.16+16
Show newest version
package com.erigir.wrench.drigo;

import java.io.File;
import java.util.Map;
import java.util.TreeMap;

/**
 * Created by cweiss on 8/5/15.
 */
public class DrigoResults {
    public static final String APPLIED_KEY = "APPLIED";
    private DrigoConfiguration sourceConfiguration;
    private Map> metadata = new TreeMap<>();
    private long startTime = System.currentTimeMillis();
    private long endTime;

    public DrigoConfiguration getSourceConfiguration() {
        return sourceConfiguration;
    }

    public void setSourceConfiguration(DrigoConfiguration sourceConfiguration) {
        this.sourceConfiguration = sourceConfiguration;
    }

    public Map> getMetadata() {
        return metadata;
    }

    public void setMetadata(Map> metadata) {
        this.metadata = metadata;
    }


    public void addMetadata(File file, String name, String value) {
        Map data = metadata.get(file);
        if (data == null) {
            data = new TreeMap<>();
            metadata.put(file, data);
        }
        data.put(name, value);
    }

    public String fetchMetadata(File file, String key) {
        Map data = metadata.get(file);
        return (data == null) ? null : data.get(key);
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public long getElapsedTime() {
        return (endTime > 0) ? (endTime - startTime) : System.currentTimeMillis() - startTime;
    }

    public String toString() {
        return "[DrigoResults: " + metadata + " in " + getElapsedTime() + " ms]";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy