Search in sources :

Example 1 with ImportEdgesProcess

use of org.gephi.io.importer.plugin.file.spreadsheet.process.ImportEdgesProcess in project gephi by gephi.

the class AbstractImporterSpreadsheet method execute.

@Override
public boolean execute(ContainerLoader container) {
    this.container = container;
    this.report = new Report();
    this.container.setTimeRepresentation(generalConfig.getTimeRepresentation());
    this.container.setTimeZone(generalConfig.getTimeZone());
    try (SheetParser parser = createParser()) {
        switch(getMode()) {
            case NODES_TABLE:
                importer = new ImportNodesProcess(generalConfig, parser, container, progressTicket);
                break;
            case EDGES_TABLE:
                importer = new ImportEdgesProcess(generalConfig, parser, container, progressTicket);
                break;
            case ADJACENCY_LIST:
                importer = new ImportAdjacencyListProcess(generalConfig, container, progressTicket, parser);
                break;
            case MATRIX:
                importer = new ImportMatrixProcess(generalConfig, container, progressTicket, parser);
                break;
            default:
                throw new IllegalArgumentException("Unknown mode " + getMode());
        }
        importer.execute();
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    } finally {
        if (importer != null) {
            report.append(importer.getReport());
            importer = null;
        }
    }
    return !cancel;
}
Also used : ImportMatrixProcess(org.gephi.io.importer.plugin.file.spreadsheet.process.ImportMatrixProcess) Report(org.gephi.io.importer.api.Report) ImportAdjacencyListProcess(org.gephi.io.importer.plugin.file.spreadsheet.process.ImportAdjacencyListProcess) ImportNodesProcess(org.gephi.io.importer.plugin.file.spreadsheet.process.ImportNodesProcess) ImportEdgesProcess(org.gephi.io.importer.plugin.file.spreadsheet.process.ImportEdgesProcess) SheetParser(org.gephi.io.importer.plugin.file.spreadsheet.sheet.SheetParser) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Report (org.gephi.io.importer.api.Report)1 ImportAdjacencyListProcess (org.gephi.io.importer.plugin.file.spreadsheet.process.ImportAdjacencyListProcess)1 ImportEdgesProcess (org.gephi.io.importer.plugin.file.spreadsheet.process.ImportEdgesProcess)1 ImportMatrixProcess (org.gephi.io.importer.plugin.file.spreadsheet.process.ImportMatrixProcess)1 ImportNodesProcess (org.gephi.io.importer.plugin.file.spreadsheet.process.ImportNodesProcess)1 SheetParser (org.gephi.io.importer.plugin.file.spreadsheet.sheet.SheetParser)1