package jas2.hep;

import hepjas.analysis.*;
import hepjas.analysis.partition.*;
import jas2.hist.*;
import java.util.*;
import java.awt.Color;

public class Partition2DAdapter extends PartitionAdapter
	implements Rebinnable2DHistogramData, HasStyle
{
	public Partition2DAdapter(Abstract2DPartition p)
	{
		super(p);
		m_partition = p;
	}
	public double[][][] rebin(int xbins, double xmin, double xmax, int ybins, double ymin, double ymax, boolean wantErrors, boolean hurry, boolean overflow)
	{
		double[][][] result;
		int size = 1;

		if (m_partition.isRebinnable()) 
		{
			m_partition.setXBinning(xbins,xmin,xmax);
			m_partition.setYBinning(ybins,ymin,ymax);
		}
		
		result = new double[size][][];
		result[0] = m_partition.getBins();
		return result;
	}
	public boolean isRebinnable()
	{
		return m_partition.isRebinnable();
	}
	public double getXMin()
	{
		return m_partition.getXMin();
	}
	public double getXMax()
	{
		return m_partition.getXMax();
	}
	public double getYMin()
	{
		return m_partition.getYMin();
	}
	public double getYMax()
	{
		return m_partition.getYMax();
	}
	public int getXBins()
	{
		return m_partition.getNumberOfXBins();
	}
	public int getYBins()
	{
		return m_partition.getNumberOfYBins();
	}
	public int getXAxisType()
	{
		return m_partition.getXAxisType();
	}
	public int getYAxisType()
	{
		return m_partition.getYAxisType();
	}
	public String[] getXAxisLabels()
	{
		return null;
	}
	public String[] getYAxisLabels()
	{
		return null;
	}
	public JASHistStyle getStyle()
	{
		Style s = m_partition.getStyle();
		if (s == null) return null;
		
		JASHist2DHistogramStyle hs = createStyle();
		
		if (s.get("histStyle")              != null) hs.setHistStyle        (((Integer) s.get("histStyle")).intValue());
		if (s.get("colorMapScheme")         != null) hs.setColorMapScheme   (((Integer) s.get("colorMapScheme")).intValue());
		if (s.get("shapeColor")             != null) hs.setShapeColor       ((Color) s.get("shapeColor"));
		if (s.get("overflowBinColor")       != null) hs.setOverflowBinColor ((Color) s.get("overflowBinColor"));
		if (s.get("startDataColor")         != null) hs.setStartDataColor   ((Color) s.get("startDataColor"));
		if (s.get("endDataColor")           != null) hs.setEndDataColor     ((Color) s.get("endDataColor"));
		if (s.get("showOverflow")           != null) hs.setShowOverflow     (((Boolean) s.get("showOverflow")).booleanValue());
		if (s.get("customOverlay")			!= null) hs.setCustomOverlay    ((CustomOverlay) s.get("customOverlay"));
		return hs;
	}
	protected JASHist2DHistogramStyle createStyle()
	{
		return new JASHist2DHistogramStyle();
	}
	private Abstract2DPartition m_partition;
}

 

Ads help maintain this website.