// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition          
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 
// =========================================================================

// Copyright 2000-2002, FreeHEP.
package hep.graphics.heprep;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;


import org.freehep.util.Factory;
/**
 * HepRepFactory interface.
 *
 * @author Mark Donszelmann
 */
public abstract class HepRepFactory {


    /**
     * Name of the interface for factory for HepRep.
     */
    public static final String factoryName = "hep.graphics.heprep.HepRepFactory";

    /**
     * Properties filename to find out what factory to load for HepRep.
     */
    public static final String propertyFile = "heprep.properties";

    /**
     * Default HepRep factory classname.
     */
    public static final String defaultFactoryName = "hep.graphics.heprep.xml.XMLHepRepFactory";

    /**
     * Creates a heprep factory based on the content of heprep.properties file. If not found
     * the default HepRepFactory is created.
     *
     * @return HepRepFactory.
     */
    public static HepRepFactory create()
           throws ClassNotFoundException, IllegalAccessException, InstantiationException {

        String name = Factory.findFactory(factoryName, propertyFile, defaultFactoryName);
        Class clazz = Class.forName(name);
        HepRepFactory factory = (HepRepFactory)clazz.newInstance();
        return factory;
    }
    /**
     * Creates a HepRepReader from a stream.
     *
     * @param in input stream.
     */
    public abstract HepRepReader createHepRepReader(InputStream in) throws IOException;

    /**
     * Creates a HepRepReader from a file name.
     *
     * @param inputFileName file name.
     */
    public abstract HepRepReader createHepRepReader(String inputFileName) throws IOException;

    /**
     * Creates a HepRepWriter.
     *
     * @param out output stream.
     * @param randomAccess create a writer in a format that will allow random access (may be ignored).
     * @param compress create a writer that uses compression (may be ignored).
     */
    public abstract HepRepWriter createHepRepWriter(OutputStream out, boolean randomAccess, boolean compress) throws IOException;

    /**
     * Creates a HepRepPoint.
     *
     * @param instance to add the point to.
     * @param x x coordinate of point.
     * @param y y coordinate of point.
     * @param z z coordinate of point.
     */
    public abstract HepRepPoint createHepRepPoint(HepRepInstance instance, double x, double y, double z);

    /**
     * Creates a HepRepInstance.
     *
     * @parent to add the instance to.
     * @type type the associated type.
     */
    public abstract HepRepInstance createHepRepInstance(HepRepInstance parent, HepRepType type);

    /**
     * Creates a HepRepInstance.
     *
     * @parent to add the instance to.
     * @type type the associated type.
     */
    public abstract HepRepInstance createHepRepInstance(HepRepInstanceTree parent, HepRepType type);

    /**
     * Creates a HepRepTreeID.
     *
     * @param name of the treeID.
     * @param version of the treeID.
     */
    public HepRepTreeID createHepRepTreeID(String name, String version) {
        return createHepRepTreeID(name, version, "top-level");
    }
    /**
     * Creates a HepRepTreeID.
     *
     * @param name of the treeID.
     * @param version of the treeID.
     * @param qualifier of the treeID.
     */
    public abstract HepRepTreeID createHepRepTreeID(String name, String version, String qualifier);

    /**
     * Creates a HepRepAction.
     *
     * @param name of the action.
     * @param expression of the action.
     */
    public abstract HepRepAction createHepRepAction(String name, String expression);

    /**
     * Creates a HepRepInstanceTree.
     * <p>
     * The tree needs to be added to the HepRep.
     *
     * @param name of the instancetree.
     * @param version of the instancetree.
     * @param typeTree associated typetree.
     */
    public abstract HepRepInstanceTree createHepRepInstanceTree(String name, String version, HepRepTreeID typeTree);

    /**
     * Creates a HepRepType.
     *
     * @param parent to add this type to.
     * @param name of the type to create.
     */
    public abstract HepRepType createHepRepType(HepRepTypeTree parent, String name);

    /**
     * Creates a HepRepType.
     *
     * @param parent to add this type to.
     * @param name of the type to create.
     */
    public abstract HepRepType createHepRepType(HepRepType parent, String name);

    /**
     * Creates a HepRepTypeTree.
     * <p>
     * The tree needs to be added to the HepRep.
     *
     * @param treeID to name the tree being created.
     */
    public abstract HepRepTypeTree createHepRepTypeTree(HepRepTreeID treeID);

    /**
     * Creates a HepRep.
     *
     */
    public abstract HepRep createHepRep();
} // class or interface

