Java source code of 'jhplot.DProxy'

/**
 *    Copyright (C)  D2Melt project. The jHPLot package by S.Chekanov and Work.ORG
 *    All rights reserved.
 *
 *    This program is free software; you can redistribute it and/or modify it under the terms
 *    of the GNU General Public License as published by the Free Software Foundation; either
 *    version 3 of the License, or any later version.
 *
 *    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *    See the GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along with this program;
 *    if not, see .
 *
 *    Additional permission under GNU GPL version 3 section 7:
 *    If you have received this program as a library with written permission from the D2Melt team,
 *    you can link or combine this library with your non-GPL project to convey the resulting work.
 *    In this case, this library should be considered as released under the terms of
 *    GNU Lesser public license (see ),
 *    provided you include this license notice and a URL through which recipients can access the
 *    Corresponding Source.
 **/
package jhplot;
import hep.aida.*;
import java.io.Serializable;
import java.util.*;
import jhplot.gui.HelpBrowser;

/**
 * A proxy for all DataMelt objects. This does not save graphical options since designed for interchange between different programs. 
 * 
 */

public class DProxy implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	private String title;

        private Double[] D1;

        private Double[][] D2;

	private String type = "p1d";

	private String[] names;


          public DProxy() {
               title="";
               type = "p1d";
            };


/**
         * Create a proxy for histogram. 
         * 
         * @param h input histogram 
         *             
         */
          public DProxy(H1D h) {
             int ibins = h.getBins() + 2;
             D2 = new Double[ibins-2][7];
             names = new String[] {"lowEdge", "upperEdge","binHeight", "binError", "binEntries", "binMean", "binRms" };
             title=h.getTitle();
             type="h1d";
             for (int i=0; i < ibins-2; i++) {
                  D2[i][0]=h.binLowerEdge(i);
                  D2[i][1]=h.binUpperEdge(i);
                  D2[i][2]=h.binHeight(i);
                  D2[i][3]=h.binError(i);
                  D2[i][4]=(double)h.binEntries(i);
                  D2[i][5]=h.binMean(i);
                  D2[i][6]=h.binRms(i);
            }
            D1 = new Double[9];

            double xb=1;
            if (!h.isFixedBinning()) xb=0;
            D1[0]=xb;
            D1[1]=(double)h.getBins(); 
            D1[2]=h.mean();
            D1[3]=h.rms();
            D1[4]=(double)h.entries();
            D1[5]=h.getMin();
            D1[6]=h.getMax();
            D1[7]=h.getOverflowlowHeight();
            D1[8]=h.getUnderflowHeight();
        
          }


     /**
	 * Create a proxy for D2 of DMelt.
	 * 
	 * @param P1D
         *            hh 
	 */

	public DProxy(P1D hh) {

		title = hh.getTitle();
                this.type="p1d";

                D1 = new Double[2];
                D1[0]=(double)hh.dimension();
                D1[1]=(double)hh.size();

		if (hh.dimension() == 2) {
			names = new String[] {"x", "y" };
			D2 = new Double[hh.size()][hh.dimension()];
			int nrows=hh.size();
			int ncols=names.length;
			for (int i = 0; i