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

org.jgrapht.io.AbstractBaseExporter Maven / Gradle / Ivy

There is a newer version: 1.5.2
Show newest version
/*
 * (C) Copyright 2017-2017, by Dimitrios Michail and Contributors.
 *
 * JGraphT : a free Java graph-theory library
 *
 * This program and the accompanying materials are dual-licensed under
 * either
 *
 * (a) the terms of the GNU Lesser General Public License version 2.1
 * as published by the Free Software Foundation, or (at your option) any
 * later version.
 *
 * or (per the licensee's choosing)
 *
 * (b) the terms of the Eclipse Public License v1.0 as published by
 * the Eclipse Foundation.
 */
package org.jgrapht.io;

import java.util.*;

/**
 * Base implementation for a graph exporter.
 *
 * @param  the graph vertex type
 * @param  the graph edge type
 *
 * @author Dimitrios Michail
 * @since March 2017
 */
abstract class AbstractBaseExporter
{
    /**
     * Provides an identifier for a vertex.
     */
    protected ComponentNameProvider vertexIDProvider;

    /**
     * Provides an identifier for an edge.
     */
    protected ComponentNameProvider edgeIDProvider;

    /**
     * Constructor
     *
     * @param vertexIDProvider the vertex id provider. Must not be null.
     */
    public AbstractBaseExporter(ComponentNameProvider vertexIDProvider)
    {
        this(vertexIDProvider, null);
    }

    /**
     * Constructor
     *
     * @param vertexIDProvider the vertex id provider. Must not be null.
     * @param edgeIDProvider the edge id provider
     */
    public AbstractBaseExporter(
        ComponentNameProvider vertexIDProvider, ComponentNameProvider edgeIDProvider)
    {
        this.vertexIDProvider =
            Objects.requireNonNull(vertexIDProvider, "Vertex id provider cannot be null");
        this.edgeIDProvider = edgeIDProvider;
    }

    /**
     * Get the vertex id provider
     *
     * @return the vertex id provider
     */
    public ComponentNameProvider getVertexIDProvider()
    {
        return vertexIDProvider;
    }

    /**
     * Set the vertex id provider
     *
     * @param vertexIDProvider the new vertex id provider. Must not be null.
     */
    public void setVertexIDProvider(ComponentNameProvider vertexIDProvider)
    {
        this.vertexIDProvider =
            Objects.requireNonNull(vertexIDProvider, "Vertex id provider cannot be null");
    }

    /**
     * Get the edge id provider
     *
     * @return The edge provider
     */
    public ComponentNameProvider getEdgeIDProvider()
    {
        return edgeIDProvider;
    }

    /**
     * Set the edge id provider.
     *
     * @param edgeIDProvider the new edge id provider. Must not be null.
     */
    public void setEdgeIDProvider(ComponentNameProvider edgeIDProvider)
    {
        this.edgeIDProvider = edgeIDProvider;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy