001    /* EVolve - an Extensible Software Visualization Framework
002     * Copyright (C) 2001-2002 Qin Wang
003     *
004     * This library is free software; you can redistribute it and/or
005     * modify it under the terms of the GNU Library General Public
006     * License as published by the Free Software Foundation; either
007     * version 2 of the License, or (at your option) any later version.
008     *
009     * This library is distributed in the hope that it will be useful,
010     * but WITHOUT ANY WARRANTY; without even the implied warranty of
011     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012     * Library General Public License for more details.
013     *
014     * You should have received a copy of the GNU Library General Public
015     * License along with this library; if not, write to the
016     * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017     * Boston, MA 02111-1307, USA.
018     */
019    
020    /*
021     * EVolve is distributed at http://www.sable.mcgill.ca/EVolve/
022     */
023    
024    package EVolve.visualization.VizFactory;
025    
026    import EVolve.visualization.XYViz.ValRefViz.HotSpotViz.PredictionViz;
027    import EVolve.visualization.*;
028    
029    import java.util.*;
030    
031    /**
032     * Factory of prediction visualization.
033     */
034    public class PredictionVizFactory extends VisualizationFactory {
035        protected ArrayList factoryList; // predictor factories
036    
037        /**
038         * Creates a prediction visualization factory.
039         */
040        public PredictionVizFactory() {
041            factoryList = new ArrayList();
042        }
043    
044        /**
045         * Adds a predictor factory.
046         *
047         * @param   factory the predictor factory
048         */
049        public void addPredictorFactory(PredictorFactory factory) {
050            factoryList.add(factory);
051        }
052    
053        public String getName() {
054            return "Prediction Visualization";
055        }
056    
057        public String getFactoryName() {
058            return "PredictionVizFactory";
059        }
060    
061        public VisualizationDefinition createDefinition() {
062            DimensionDefinition[] dimensionDefinition = new DimensionDefinition[3];
063            dimensionDefinition[0] = new DimensionDefinition("X-axis", "time");
064            dimensionDefinition[1] = new DimensionDefinition("Y-axis", "reference");
065            dimensionDefinition[2] = new DimensionDefinition("Prediction", "reference");
066            return new VisualizationDefinition(dimensionDefinition);
067        }
068    
069        public Visualization createVisualization() {
070            PredictorFactory[] factory = new PredictorFactory[factoryList.size()];
071            for (int i = 0; i < factory.length; i++) {
072                factory[i] = (PredictorFactory)(factoryList.get(i));
073            }
074            return new PredictionViz(factory);
075        }
076    }