org.eclipse.birt.chart.engine_3.7.2.v20120213

16:41:26.179 INFO  jd.cli.Main - Decompiling org.eclipse.birt.chart.engine_3.7.2.v20120213.jar
package org.eclipse.birt.chart.aggregate;

import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.ULocale;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.Date;
import java.util.ResourceBundle;
import org.eclipse.birt.chart.engine.i18n.Messages;

public abstract class AggregateFunctionAdapter
  implements IAggregateFunction
{
  private int iDataType = 0;
  private ULocale lcl = null;
  
  public void accumulate(Object oValue)
    throws IllegalArgumentException
  {
    detectTypeChange(oValue);
  }
  
  public Object getAggregatedValue()
  {
    return null;
  }
  
  public void initialize()
  {
    iDataType = 0;
  }
  
  private final void detectTypeChange(Object oValue)
    throws IllegalArgumentException
  {
    if (iDataType == 0)
    {
      if (oValue == null) {
        return;
      }
      if ((oValue instanceof Number)) {
        iDataType = 4;
      } else if ((oValue instanceof BigDecimal)) {
        iDataType = 5;
      } else if ((oValue instanceof Date)) {
        iDataType = 2;
      } else if ((oValue instanceof Calendar)) {
        iDataType = 3;
      } else if ((oValue instanceof String)) {
        iDataType = 6;
      } else {
        iDataType = 7;
      }
    }
    else
    {
      int iExistingType = iDataType;
      if (oValue == null)
      {
        iDataType = 0;
        return;
      }
      if ((oValue instanceof Number)) {
        iDataType = 4;
      } else if ((oValue instanceof BigDecimal)) {
        iDataType = 5;
      } else if ((oValue instanceof Date)) {
        iDataType = 2;
      } else if ((oValue instanceof Calendar)) {
        iDataType = 3;
      } else if ((oValue instanceof String)) {
        iDataType = 6;
      } else {
        iDataType = 7;
      }
      if (iExistingType != iDataType) {
        throw new IllegalArgumentException(MessageFormat.format(Messages.getResourceBundle(lcl)
          .getString("exception.mixed.data.types"), 
          new Object[] {
          getClass().getName() }));
      }
    }
  }
  
  public final void setLocale(ULocale lcl)
  {
    this.lcl = lcl;
  }
  
  protected final ULocale getLocale()
  {
    return lcl == null ? ULocale.getDefault() : lcl;
  }
  
  protected final int getDataType()
  {
    return iDataType;
  }
  
  public String[] getDisplayParameters()
  {
    return new String[0];
  }
  
  public int getParametersCount()
  {
    return 0;
  }
  
  public int getType()
  {
    return 0;
  }
  
  public int getBIRTDataType()
  {
    return -1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.aggregate.AggregateFunctionAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.aggregate;

public abstract interface IAggregateFunction
{
  public static final int SUMMARY_AGGR = 0;
  public static final int RUNNING_AGGR = 1;
  public static final int UNKNOWN = 0;
  public static final int NULL = 1;
  public static final int DATE = 2;
  public static final int CALENDAR = 3;
  public static final int NUMBER = 4;
  public static final int BIGDECIMAL = 5;
  public static final int TEXT = 6;
  public static final int CUSTOM = 7;
  
  public abstract void accumulate(Object paramObject)
    throws IllegalArgumentException;
  
  public abstract Object getAggregatedValue();
  
  public abstract void initialize();
  
  public abstract int getParametersCount();
  
  public abstract String[] getDisplayParameters();
  
  public abstract int getType();
  
  public abstract int getBIRTDataType();
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.aggregate.IAggregateFunction
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.api;

import org.eclipse.birt.chart.datafeed.IDataSetProcessor;
import org.eclipse.birt.chart.device.IDeviceRenderer;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.factory.Generator;
import org.eclipse.birt.chart.factory.IGenerator;
import org.eclipse.birt.chart.model.Serializer;
import org.eclipse.birt.chart.model.impl.SerializerImpl;
import org.eclipse.birt.chart.util.PluginSettings;
import org.eclipse.birt.core.framework.PlatformConfig;

public class ChartEngine
{
  private PluginSettings ps = null;
  private static ChartEngine ce = null;
  
  private ChartEngine(PluginSettings ps)
  {
    this.ps = ps;
  }
  
  public static ChartEngine instance(PlatformConfig config)
  {
    if (ce == null) {
      synchronized (ChartEngine.class)
      {
        if (ce == null)
        {
          PluginSettings ps = PluginSettings.instance(config);
          ce = new ChartEngine(ps);
        }
      }
    }
    return ce;
  }
  
  public static ChartEngine instance()
  {
    return instance(null);
  }
  
  /**
   * @deprecated
   */
  public Serializer getSerializer()
  {
    return SerializerImpl.instance();
  }
  
  public IGenerator getGenerator()
  {
    return Generator.instance();
  }
  
  public IDeviceRenderer getRenderer(String deviceID)
    throws ChartException
  {
    return ps.getDevice(deviceID);
  }
  
  public final IDataSetProcessor getDataSetProcessor(Class cSeries)
    throws ChartException
  {
    return ps.getDataSetProcessor(cSeries);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.api.ChartEngine
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

import org.eclipse.birt.chart.device.IDisplayServer;
import org.eclipse.birt.chart.device.ITextMetrics;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.model.component.Label;

public class BIRTChartComputation
  implements IChartComputation
{
  public double computeFontHeight(IDisplayServer xs, Label la)
    throws ChartException
  {
    return Methods.computeFontHeight(xs, la);
  }
  
  public ITextMetrics getTextMetrics(IDisplayServer xs, Label la, double wrapping)
  {
    ITextMetrics itm = xs.getTextMetrics(la);
    itm.reuse(la, wrapping);
    return itm;
  }
  
  public BoundingBox computeLabelSize(IDisplayServer xs, Label la, double dWrapping, Double fontHeight)
    throws ChartException
  {
    return Methods.computeLabelSize(xs, la, dWrapping, fontHeight);
  }
  
  public BoundingBox computeBox(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY)
    throws ChartException
  {
    try
    {
      return Methods.computeBox(xs, iLabelLocation, la, dX, dY);
    }
    catch (IllegalArgumentException uiex)
    {
      throw new ChartException("org.eclipse.birt.chart.engine", 
        11, 
        uiex);
    }
  }
  
  public RotatedRectangle computePolygon(IDisplayServer xs, int iLabelLocation, Label la, double dX, double dY, Double fontHeight)
    throws ChartException
  {
    try
    {
      return Methods.computePolygon(xs, 
        iLabelLocation, 
        la, 
        dX, 
        dY, 
        fontHeight);
    }
    catch (IllegalArgumentException uiex)
    {
      throw new ChartException("org.eclipse.birt.chart.engine", 
        11, 
        uiex);
    }
  }
  
  public double computeWidth(IDisplayServer xs, Label la)
    throws ChartException
  {
    return Methods.computeWidth(xs, la);
  }
  
  public double computeHeight(IDisplayServer xs, Label la)
    throws ChartException
  {
    return Methods.computeHeight(xs, la);
  }
  
  public void dispose() {}
  
  public void applyWrapping(IDisplayServer xs, Label la, double dWrapping)
    throws ChartException
  {
    ITextMetrics itm = xs.getTextMetrics(la);
    itm.reuse(la, dWrapping);
    itm.dispose();
  }
  
  public void recycleTextMetrics(ITextMetrics itm)
  {
    if (itm != null) {
      itm.dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.BIRTChartComputation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

public final class BoundingBox
  implements Cloneable
{
  private double dX;
  private double dY;
  private double dWidth;
  private double dHeight;
  private double dHotPoint;
  
  public BoundingBox(int _iLabelLocation, double _dX, double _dY, double _dWidth, double _dHeight, double _dHotPoint)
  {
    dX = _dX;
    dY = _dY;
    dWidth = _dWidth;
    dHeight = _dHeight;
    dHotPoint = _dHotPoint;
  }
  
  public BoundingBox clone()
  {
    return new BoundingBox(0, dX, dY, dWidth, dHeight, dHotPoint);
  }
  
  public final double getHotPoint()
  {
    return dHotPoint;
  }
  
  public final double getTop()
  {
    return dY;
  }
  
  public final double getLeft()
  {
    return dX;
  }
  
  public final double getWidth()
  {
    return dWidth;
  }
  
  public final double getHeight()
  {
    return dHeight;
  }
  
  public final void setLeft(double _dX)
  {
    dX = _dX;
  }
  
  public final void setTop(double _dY)
  {
    dY = _dY;
  }
  
  public final void scale(double dScale)
  {
    dX *= dScale;
    dY *= dScale;
    dWidth *= dScale;
    dHeight *= dScale;
    dHotPoint *= dScale;
  }
  
  public int hashCode()
  {
    int result = 1;
    
    long temp = Double.doubleToLongBits(dHeight);
    result = 31 * result + (int)(temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(dHotPoint);
    result = 31 * result + (int)(temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(dWidth);
    result = 31 * result + (int)(temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(dX);
    result = 31 * result + (int)(temp ^ temp >>> 32);
    temp = Double.doubleToLongBits(dY);
    result = 31 * result + (int)(temp ^ temp >>> 32);
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    BoundingBox other = (BoundingBox)obj;
    if (Double.doubleToLongBits(dHeight) != Double.doubleToLongBits(dHeight)) {
      return false;
    }
    if (Double.doubleToLongBits(dHotPoint) != Double.doubleToLongBits(dHotPoint)) {
      return false;
    }
    if (Double.doubleToLongBits(dWidth) != Double.doubleToLongBits(dWidth)) {
      return false;
    }
    if (Double.doubleToLongBits(dX) != Double.doubleToLongBits(dX)) {
      return false;
    }
    if (Double.doubleToLongBits(dY) != Double.doubleToLongBits(dY)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.BoundingBox
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

public class ChartComputationFactory
  implements IChartComputationFactory
{
  private static IChartComputationFactory factory = new ChartComputationFactory();
  
  public static void initInstance(IChartComputationFactory tFactory)
  {
    factory = tFactory;
  }
  
  public static IChartComputationFactory instance()
  {
    return factory;
  }
  
  public IGObjectFactory createGObjectFactory()
  {
    return new GObjectFactory();
  }
  
  public IChartComputation createChartComputation()
  {
    return new BIRTChartComputation();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.ChartComputationFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

import com.ibm.icu.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.birt.chart.datafeed.IDataPointEntry;
import org.eclipse.birt.chart.engine.i18n.Messages;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.factory.RunTimeContext;
import org.eclipse.birt.chart.log.ILogger;
import org.eclipse.birt.chart.log.Logger;
import org.eclipse.birt.chart.model.attribute.DataPoint;
import org.eclipse.birt.chart.model.attribute.DataPointComponent;
import org.eclipse.birt.chart.model.attribute.DataPointComponentType;
import org.eclipse.birt.chart.model.attribute.FormatSpecifier;
import org.eclipse.birt.chart.model.attribute.Location;
import org.eclipse.birt.chart.model.attribute.Location3D;
import org.eclipse.birt.chart.model.attribute.Size;
import org.eclipse.birt.chart.model.attribute.impl.SizeImpl;
import org.eclipse.birt.chart.model.data.NumberDataElement;
import org.eclipse.birt.chart.util.CDateTime;
import org.eclipse.emf.common.util.EList;

public final class DataPointHints
{
  private boolean isVirtual = false;
  private final RunTimeContext rtc;
  private Object oBaseValue;
  private Object oOrthogonalValue;
  private Double oStackedOrthogonalValue;
  private Object oSeriesValue;
  private Object oPercentileOrthogonalValue;
  private Map<String, Object> userValueMap;
  private int index;
  private final Location lo;
  private final double[] dSize;
  private final DataPoint dp;
  private boolean bOutside = false;
  private final FormatSpecifier fsBase;
  private final FormatSpecifier fsOrthogonal;
  private final FormatSpecifier fsSeries;
  private final FormatSpecifier fsPercentile;
  private static ILogger logger = Logger.getLogger("org.eclipse.birt.chart.engine/computation");
  
  public DataPointHints(Object _oBaseValue, Object _oOrthogonalValue, Object _oSeriesValue, Object _oPercentileValue, DataPoint _dp, FormatSpecifier _fsBase, FormatSpecifier _fsOrthogonal, FormatSpecifier _fsSeries, FormatSpecifier _fsPercentile, int _idx, Location _lo, double _dSize, RunTimeContext _rtc)
    throws ChartException
  {
    dp = _dp;
    oBaseValue = _oBaseValue;
    oOrthogonalValue = _oOrthogonalValue;
    oSeriesValue = ((_oSeriesValue instanceof String) ? _rtc.externalizedMessage((String)_oSeriesValue) : 
      _oSeriesValue);
    oPercentileOrthogonalValue = _oPercentileValue;
    
    fsBase = _fsBase;
    fsOrthogonal = _fsOrthogonal;
    fsSeries = _fsSeries;
    fsPercentile = _fsPercentile;
    
    index = _idx;
    lo = _lo;
    rtc = _rtc;
    
    dSize = new double[2];
    dSize[0] = _dSize;
  }
  
  public DataPointHints(Object _oBaseValue, Object _oOrthogonalValue, Object _oSeriesValue, Object _oPercentileValue, DataPoint _dp, FormatSpecifier _fsBase, FormatSpecifier _fsOrthogonal, FormatSpecifier _fsSeries, FormatSpecifier _fsPercentile, int _idx, Location _lo, double[] _dSize, RunTimeContext _rtc)
    throws ChartException
  {
    this(_oBaseValue, _oOrthogonalValue, _oSeriesValue, _oPercentileValue, _dp, _fsBase, _fsOrthogonal, _fsSeries, _fsPercentile, _idx, _lo, 0.0D, _rtc);
    
    dSize[0] = _dSize[0];
    dSize[1] = _dSize[1];
  }
  
  public DataPointHints getVirtualCopy()
    throws ChartException
  {
    DataPointHints dph = new DataPointHints(oBaseValue, 
      oOrthogonalValue, 
      oSeriesValue, 
      oPercentileOrthogonalValue, 
      dp, 
      fsBase, 
      fsOrthogonal, 
      fsSeries, 
      fsPercentile, 
      index, 
      lo, 
      dSize, 
      rtc);
    
    isVirtual = true;
    userValueMap = userValueMap;
    
    return dph;
  }
  
  public void accumulate(Object _oBaseValue, Object _oOrthogonalValue, Object _oSeriesValue, Object _oPercentileOrthogonalValue)
  {
    if ((oBaseValue instanceof Number))
    {
      if ((_oBaseValue instanceof Number)) {
        oBaseValue = new Double(((Number)oBaseValue).doubleValue() + 
          ((Number)_oBaseValue).doubleValue());
      } else if ((_oBaseValue instanceof NumberDataElement)) {
        oBaseValue = new Double(((Number)oBaseValue).doubleValue() + 
          ((NumberDataElement)_oBaseValue).getValue());
      }
    }
    else if ((oBaseValue instanceof NumberDataElement)) {
      if ((_oBaseValue instanceof Number)) {
        ((NumberDataElement)oBaseValue).setValue(((NumberDataElement)oBaseValue).getValue() + 
          ((Number)_oBaseValue).doubleValue());
      } else if ((_oBaseValue instanceof NumberDataElement)) {
        ((NumberDataElement)oBaseValue).setValue(((NumberDataElement)oBaseValue).getValue() + 
          ((NumberDataElement)_oBaseValue).getValue());
      }
    }
    if ((oOrthogonalValue instanceof Number))
    {
      if ((_oOrthogonalValue instanceof Number)) {
        oOrthogonalValue = new Double(((Number)oOrthogonalValue).doubleValue() + 
          ((Number)_oOrthogonalValue).doubleValue());
      } else if ((_oOrthogonalValue instanceof NumberDataElement)) {
        oOrthogonalValue = new Double(((Number)oOrthogonalValue).doubleValue() + 
          ((NumberDataElement)_oOrthogonalValue).getValue());
      }
    }
    else if ((oOrthogonalValue instanceof NumberDataElement)) {
      if ((_oOrthogonalValue instanceof Number)) {
        ((NumberDataElement)oOrthogonalValue).setValue(((NumberDataElement)oOrthogonalValue).getValue() + 
          ((Number)_oOrthogonalValue).doubleValue());
      } else if ((_oOrthogonalValue instanceof NumberDataElement)) {
        ((NumberDataElement)oOrthogonalValue).setValue(((NumberDataElement)oOrthogonalValue).getValue() + 
          ((NumberDataElement)_oOrthogonalValue).getValue());
      }
    }
    if ((oSeriesValue instanceof Number))
    {
      if ((_oSeriesValue instanceof Number)) {
        oSeriesValue = new Double(((Number)oSeriesValue).doubleValue() + 
          ((Number)_oSeriesValue).doubleValue());
      } else if ((_oSeriesValue instanceof NumberDataElement)) {
        oSeriesValue = new Double(((Number)oSeriesValue).doubleValue() + 
          ((NumberDataElement)_oSeriesValue).getValue());
      }
    }
    else if ((oSeriesValue instanceof NumberDataElement)) {
      if ((_oSeriesValue instanceof Number)) {
        ((NumberDataElement)oSeriesValue).setValue(((NumberDataElement)oSeriesValue).getValue() + 
          ((Number)_oSeriesValue).doubleValue());
      } else if ((_oSeriesValue instanceof NumberDataElement)) {
        ((NumberDataElement)oSeriesValue).setValue(((NumberDataElement)oSeriesValue).getValue() + 
          ((NumberDataElement)_oSeriesValue).getValue());
      }
    }
    if ((oPercentileOrthogonalValue instanceof Number))
    {
      if ((_oPercentileOrthogonalValue instanceof Number)) {
        oPercentileOrthogonalValue = new Double(((Number)oPercentileOrthogonalValue).doubleValue() + 
          ((Number)_oPercentileOrthogonalValue).doubleValue());
      } else if ((_oPercentileOrthogonalValue instanceof NumberDataElement)) {
        oPercentileOrthogonalValue = new Double(((Number)oPercentileOrthogonalValue).doubleValue() + 
          ((NumberDataElement)_oPercentileOrthogonalValue).getValue());
      }
    }
    else if ((oPercentileOrthogonalValue instanceof NumberDataElement)) {
      if ((_oPercentileOrthogonalValue instanceof Number)) {
        ((NumberDataElement)oPercentileOrthogonalValue).setValue(((NumberDataElement)oPercentileOrthogonalValue).getValue() + 
          ((Number)_oPercentileOrthogonalValue).doubleValue());
      } else if ((_oPercentileOrthogonalValue instanceof NumberDataElement)) {
        ((NumberDataElement)oPercentileOrthogonalValue).setValue(((NumberDataElement)oPercentileOrthogonalValue).getValue() + 
          ((NumberDataElement)_oPercentileOrthogonalValue).getValue());
      }
    }
  }
  
  public final Object getBaseValue()
  {
    return oBaseValue;
  }
  
  public final Object getOrthogonalValue()
  {
    return oOrthogonalValue;
  }
  
  public final void setOrthogonalValue(Object value)
  {
    oOrthogonalValue = value;
  }
  
  public final Double getStackOrthogonalValue()
  {
    return oStackedOrthogonalValue;
  }
  
  public final void setStackOrthogonalValue(Double stackOrthogonalValue)
  {
    oStackedOrthogonalValue = stackOrthogonalValue;
  }
  
  public final void markOutside()
  {
    bOutside = true;
  }
  
  public final boolean isOutside()
  {
    return bOutside;
  }
  
  public final Object getSeriesValue()
  {
    return oSeriesValue;
  }
  
  public final Object getPercentileOrthogonalValue()
  {
    return oPercentileOrthogonalValue;
  }
  
  public final Location getLocation()
  {
    return lo;
  }
  
  public final Location3D getLocation3D()
  {
    if ((lo instanceof Location3D)) {
      return (Location3D)lo;
    }
    return null;
  }
  
  public final int getIndex()
  {
    return index;
  }
  
  public final double getSize()
  {
    return dSize[0];
  }
  
  public final Size getSize2D()
  {
    return SizeImpl.create(dSize[0], dSize[1]);
  }
  
  public final Object getUserValue(String key)
  {
    if (userValueMap == null) {
      return null;
    }
    Object value = userValueMap.get(key);
    if ((value instanceof CDateTime)) {
      return ((CDateTime)value).getDateTime();
    }
    return value;
  }
  
  public final void setUserValue(String key, Object value)
  {
    if (userValueMap == null) {
      userValueMap = new HashMap();
    }
    userValueMap.put(key, value);
  }
  
  public final String getOrthogonalDisplayValue()
  {
    return getOrthogonalDisplayValue(fsOrthogonal);
  }
  
  public final String getBaseDisplayValue()
  {
    return getBaseDisplayValue(fsBase);
  }
  
  public final String getSeriesDisplayValue()
  {
    return getSeriesDisplayValue(fsSeries);
  }
  
  public final String getPercentileOrthogonalDisplayValue()
  {
    return getPercentileOrthogonalDisplayValue(fsPercentile);
  }
  
  private final String getBaseDisplayValue(FormatSpecifier fs)
  {
    if (oBaseValue == null) {
      return IConstants.NULL_STRING;
    }
    DecimalFormat df = null;
    if ((fs == null) && ((oBaseValue instanceof Number))) {
      df = new DecimalFormat(ValueFormatter.getNumericPattern((Number)oBaseValue));
    }
    try
    {
      return ValueFormatter.format(oBaseValue, fs, rtc.getULocale(), df);
    }
    catch (Exception localException)
    {
      logger.log(4, 
        Messages.getString("exception.parse.value.format.specifier", 
        new Object[] {
        oBaseValue, fs }, 
        
        rtc.getULocale()));
    }
    return IConstants.NULL_STRING;
  }
  
  private final String getOrthogonalDisplayValue(FormatSpecifier fs)
  {
    if (oOrthogonalValue == null) {
      return IConstants.NULL_STRING;
    }
    try
    {
      return ValueFormatter.format(oOrthogonalValue, 
        fs, 
        rtc.getULocale(), 
        null);
    }
    catch (Exception localException)
    {
      logger.log(4, 
        Messages.getString("exception.parse.value.format.specifier", 
        new Object[] {
        oOrthogonalValue, fs }, 
        
        rtc.getULocale()));
    }
    return String.valueOf(oOrthogonalValue);
  }
  
  private final String getSeriesDisplayValue(FormatSpecifier fs)
  {
    if (oSeriesValue == null) {
      return IConstants.NULL_STRING;
    }
    try
    {
      return ValueFormatter.format(oSeriesValue, 
        fs, 
        rtc.getULocale(), 
        null);
    }
    catch (Exception localException)
    {
      logger.log(4, 
        Messages.getString("exception.parse.value.format.specifier", 
        new Object[] {
        oSeriesValue, fs }, 
        
        rtc.getULocale()));
    }
    return IConstants.NULL_STRING;
  }
  
  private final String getPercentileOrthogonalDisplayValue(FormatSpecifier fs)
  {
    if (oPercentileOrthogonalValue == null) {
      return IConstants.NULL_STRING;
    }
    try
    {
      return ValueFormatter.format(oPercentileOrthogonalValue, 
        fs, 
        rtc.getULocale(), 
        null);
    }
    catch (Exception localException)
    {
      logger.log(4, 
        Messages.getString("exception.parse.value.format.specifier", 
        new Object[] {
        oPercentileOrthogonalValue, fs }, 
        
        rtc.getULocale()));
    }
    return String.valueOf(oPercentileOrthogonalValue);
  }
  
  public final String getDisplayValue()
  {
    StringBuffer sb = new StringBuffer();
    if (dp == null)
    {
      sb.append(getOrthogonalDisplayValue());
    }
    else
    {
      EList<DataPointComponent> el = dp.getComponents();
      if (dp.getPrefix() != null) {
        sb.append(dp.getPrefix());
      }
      for (int i = 0; i < el.size(); i++)
      {
        DataPointComponent dpc = (DataPointComponent)el.get(i);
        DataPointComponentType dpct = dpc.getType();
        if (dpct == DataPointComponentType.BASE_VALUE_LITERAL)
        {
          sb.append(getBaseDisplayValue());
        }
        else if (dpct == DataPointComponentType.ORTHOGONAL_VALUE_LITERAL)
        {
          String oType = dpc.getOrthogonalType();
          if (oType.length() == 0)
          {
            sb.append(getOrthogonalDisplayValue());
          }
          else
          {
            if (!(oOrthogonalValue instanceof IDataPointEntry)) {
              continue;
            }
            String str = ((IDataPointEntry)oOrthogonalValue).getFormattedString(oType, 
              dpc.getFormatSpecifier(), 
              rtc.getULocale());
            if (str == null) {
              continue;
            }
            sb.append(str);
          }
        }
        else if (dpct == DataPointComponentType.SERIES_VALUE_LITERAL)
        {
          sb.append(getSeriesDisplayValue());
        }
        else if (dpct == DataPointComponentType.PERCENTILE_ORTHOGONAL_VALUE_LITERAL)
        {
          sb.append(getPercentileOrthogonalDisplayValue());
        }
        if (i < el.size() - 1) {
          sb.append(dp.getSeparator());
        }
      }
      if (dp.getSuffix() != null) {
        sb.append(dp.getSuffix());
      }
    }
    return sb.toString();
  }
  
  public final String toString()
  {
    return getDisplayValue();
  }
  
  public final void setBaseValue(Object newBaseValue)
  {
    oBaseValue = newBaseValue;
  }
  
  public final void setIndex(int index)
  {
    this.index = index;
  }
  
  public boolean isVirtual()
  {
    return isVirtual;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.DataPointHints
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

import com.ibm.icu.util.Calendar;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import org.eclipse.birt.chart.engine.i18n.Messages;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.model.data.DataSet;
import org.eclipse.birt.chart.model.data.DateTimeDataSet;
import org.eclipse.birt.chart.model.data.NullDataSet;
import org.eclipse.birt.chart.model.data.NumberDataSet;
import org.eclipse.birt.chart.model.data.TextDataSet;
import org.eclipse.birt.chart.util.BigNumber;
import org.eclipse.birt.chart.util.CDateTime;

public final class DataSetIterator
  implements Iterator
{
  private double[] da = null;
  private Double[] dda = null;
  private Calendar[] ca = null;
  private long[] la = null;
  private String[] sa = null;
  private Collection co = null;
  private int iDataType = 0;
  private int iContentType = 0;
  private int iCursor = 0;
  private Iterator it = null;
  private int iRowCount = 0;
  private Calendar cReused = null;
  private Object[] oa = null;
  private boolean isReverse = false;
  private BigNumber[] cnda;
  private Number[] nda;
  
  public DataSetIterator(Double[] dda)
  {
    this.dda = dda;
    iDataType = 1;
    iContentType = 3;
    iRowCount = dda.length;
  }
  
  public DataSetIterator(String[] sa)
  {
    this.sa = sa;
    iDataType = 16;
    iContentType = 3;
    iRowCount = sa.length;
  }
  
  public DataSetIterator(Calendar[] ca)
    throws ChartException
  {
    this.ca = ca;
    iDataType = 8;
    iContentType = 3;
    iRowCount = ca.length;
    updateDateTimeValues();
  }
  
  public DataSetIterator(Object oContent, int iDataType)
    throws IllegalArgumentException, ChartException
  {
    if (((iDataType & 0x2) == 2) || 
      ((iDataType & 0x4) == 4)) {
      iDataType = 1;
    }
    this.iDataType = iDataType;
    if (iDataType == 1)
    {
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof double[]))
      {
        iContentType = 2;
        da = ((double[])oContent);
      }
      else if ((oContent instanceof Double[]))
      {
        iContentType = 3;
        dda = ((Double[])oContent);
      }
      else if ((oContent instanceof BigNumber[]))
      {
        iContentType = 4;
        cnda = ((BigNumber[])oContent);
      }
      else if ((oContent instanceof Number[]))
      {
        iContentType = 5;
        nda = ((Number[])oContent);
      }
    }
    else if (iDataType == 8)
    {
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof long[]))
      {
        iContentType = 2;
        la = ((long[])oContent);
        cReused = Calendar.getInstance();
      }
      else if ((oContent instanceof Calendar[]))
      {
        iContentType = 3;
        ca = ((Calendar[])oContent);
      }
      updateDateTimeValues();
    }
    else if (iDataType == 16)
    {
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof String[]))
      {
        iContentType = 3;
        sa = ((String[])oContent);
      }
    }
    else
    {
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof Object[]))
      {
        iContentType = 3;
        oa = ((Object[])oContent);
      }
      iDataType = 0;
    }
    if (iContentType == 0) {
      throw new IllegalArgumentException(MessageFormat.format(Messages.getResourceBundle()
        .getString("exception.process.content.type"), 
        new Object[] {
        oContent, Integer.valueOf(iDataType) }));
    }
    if (co != null) {
      it = co.iterator();
    }
    iRowCount = getRowCountInternal();
  }
  
  public DataSetIterator(DataSet ds)
    throws IllegalArgumentException, ChartException
  {
    Object oContent = ds.getValues();
    if ((ds instanceof NumberDataSet))
    {
      iDataType = 1;
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof double[]))
      {
        iContentType = 2;
        da = ((double[])oContent);
      }
      else if ((oContent instanceof Double[]))
      {
        iContentType = 3;
        dda = ((Double[])oContent);
      }
      else if ((oContent instanceof Number))
      {
        iContentType = 2;
        da = new double[] {
          ((Number)oContent).doubleValue() };
      }
      else if ((oContent instanceof BigNumber[]))
      {
        iContentType = 4;
        cnda = ((BigNumber[])oContent);
      }
      else if ((oContent instanceof Number[]))
      {
        iContentType = 5;
        nda = ((Number[])oContent);
      }
    }
    else if ((ds instanceof DateTimeDataSet))
    {
      iDataType = 8;
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof long[]))
      {
        iContentType = 2;
        la = ((long[])oContent);
        cReused = Calendar.getInstance();
      }
      else if ((oContent instanceof Calendar[]))
      {
        iContentType = 3;
        ca = ((Calendar[])oContent);
      }
      updateDateTimeValues();
    }
    else if ((ds instanceof TextDataSet))
    {
      iDataType = 16;
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof String[]))
      {
        iContentType = 3;
        sa = ((String[])oContent);
      }
    }
    else if ((ds instanceof NullDataSet))
    {
      iDataType = 64;
      iContentType = 3;
      oa = ((Object[])oContent);
    }
    else
    {
      iDataType = 64;
      if ((oContent instanceof Collection))
      {
        iContentType = 1;
        co = ((Collection)oContent);
      }
      else if ((oContent instanceof Object[]))
      {
        iContentType = 3;
        oa = ((Object[])oContent);
      }
      iDataType = 0;
    }
    if (iContentType == 0) {
      throw new IllegalArgumentException(MessageFormat.format(Messages.getResourceBundle()
        .getString("exception.process.content.dataset"), 
        new Object[] {
        oContent, ds }));
    }
    if (co != null) {
      it = co.iterator();
    }
    iRowCount = getRowCountInternal();
  }
  
  public final boolean isEmpty()
  {
    return iRowCount <= 0;
  }
  
  private final int getRowCountInternal()
  {
    if (iContentType == 1) {
      return co.size();
    }
    if (iDataType == 16) {
      return sa.length;
    }
    if (iDataType == 1)
    {
      if (iContentType == 2) {
        return da.length;
      }
      if (iContentType == 3) {
        return dda.length;
      }
      if (iContentType == 4) {
        return cnda.length;
      }
      if (iContentType == 5) {
        return nda.length;
      }
    }
    else if (iDataType == 8)
    {
      if (iContentType == 2) {
        return la.length;
      }
      if (iContentType == 3) {
        return ca.length;
      }
    }
    else
    {
      if (iDataType == 16) {
        return sa.length;
      }
      if (oa != null) {
        return oa.length;
      }
    }
    return -1;
  }
  
  public final double nextPrimitiveDouble()
  {
    return da[getIndex()];
  }
  
  public final Double nextDouble()
  {
    if (it != null)
    {
      iCursor += 1;
      return (Double)it.next();
    }
    return dda[getIndex()];
  }
  
  public final BigNumber nextBigNumber()
  {
    if (it != null)
    {
      iCursor += 1;
      return (BigNumber)it.next();
    }
    return cnda[getIndex()];
  }
  
  public final Number nextNumber()
  {
    if (it != null)
    {
      iCursor += 1;
      return (Number)it.next();
    }
    return nda[getIndex()];
  }
  
  public final Calendar nextDateTime()
  {
    if (it != null)
    {
      iCursor += 1;
      return (Calendar)it.next();
    }
    return ca[getIndex()];
  }
  
  public final String nextText()
  {
    if (it != null)
    {
      iCursor += 1;
      return (String)it.next();
    }
    return sa[getIndex()];
  }
  
  public final Object nextObject()
  {
    return oa[getIndex()];
  }
  
  public final Calendar nextPrimitiveDateTime()
  {
    cReused.setTimeInMillis(la[getIndex()]);
    return cReused;
  }
  
  public boolean hasNext()
  {
    if (it != null) {
      return it.hasNext();
    }
    return iCursor < iRowCount;
  }
  
  public final Object next()
  {
    if (iCursor >= iRowCount) {
      throw new RuntimeException(new ChartException("org.eclipse.birt.chart.engine", 
        15, 
        "exception.out.of.bounds", 
        Messages.getResourceBundle()));
    }
    if (it != null)
    {
      iCursor += 1;
      return it.next();
    }
    if (iDataType == 1)
    {
      if (iContentType == 3) {
        return nextDouble();
      }
      if (iContentType == 2) {
        return new Double(nextPrimitiveDouble());
      }
      if (iContentType == 4) {
        return nextBigNumber();
      }
      if (iContentType == 5) {
        return nextNumber();
      }
    }
    else if (iDataType == 8)
    {
      if (iContentType == 3) {
        return nextDateTime();
      }
      if (iContentType == 2) {
        return nextPrimitiveDateTime();
      }
    }
    else
    {
      if (iDataType == 16) {
        return nextText();
      }
      return nextObject();
    }
    return null;
  }
  
  public void remove() {}
  
  public int size()
  {
    return iRowCount;
  }
  
  public final void reset()
  {
    iCursor = 0;
    resetIterator();
  }
  
  public final Object first()
  {
    reset();
    return next();
  }
  
  public final Object last()
  {
    reset();
    Object o = null;
    while (hasNext()) {
      o = next();
    }
    return o;
  }
  
  public final void clear()
  {
    dda = null;
    ca = null;
    da = null;
    la = null;
    oa = null;
    sa = null;
    if (co != null) {
      co = null;
    }
    iContentType = 0;
    iDataType = 0;
    iRowCount = 0;
    iCursor = 0;
    cReused = null;
    it = null;
  }
  
  public final void notifyDataUpdate()
  {
    reset();
    iRowCount = getRowCountInternal();
  }
  
  final void updateDateTimeValues()
    throws ChartException
  {
    iRowCount = getRowCountInternal();
    
    CDateTime[] cdta = new CDateTime[size()];
    reset();
    int i = 0;
    while (hasNext())
    {
      Calendar cValue = (Calendar)next();
      cdta[(i++)] = (cValue == null ? null : new CDateTime(cValue));
    }
    clear();
    ca = cdta;
    iDataType = 8;
    iContentType = 3;
    iRowCount = ca.length;
  }
  
  public final int getDataType()
  {
    return iDataType;
  }
  
  public final int getIndex()
  {
    return isReverse ? iRowCount - 1 - iCursor++ : iCursor++;
  }
  
  public void reverse(boolean bReverse)
  {
    isReverse = bReverse;
    if (bReverse) {
      resetIterator();
    }
  }
  
  private void resetIterator()
  {
    if (co != null) {
      if (isReverse)
      {
        List list = new ArrayList(co.size());
        list.addAll(co);
        Collections.reverse(list);
        it = list.iterator();
      }
      else
      {
        it = co.iterator();
      }
    }
  }
  
  public int skip(int iCount)
  {
    int iSkipped = 0;
    while ((iCount-- > 0) && (hasNext()))
    {
      next();
      iSkipped++;
    }
    return iSkipped;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.DataSetIterator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

import org.eclipse.birt.chart.exception.ChartException;

public abstract interface EllipsisHelper$ITester
{
  public abstract double getWidth()
    throws ChartException;
  
  public abstract double getHeight()
    throws ChartException;
  
  public abstract boolean testLabelVisible(String paramString, Object paramObject)
    throws ChartException;
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.computation.EllipsisHelper.ITester
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.computation;

import org.eclipse.birt.chart.device.IDisplayServer;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.model.attribute.Text;
import org.eclipse.birt.chart.model.component.Label;

class EllipsisHelper$SimpleTester
  implements EllipsisHelper.ITester
{
  private final IChartComputation cComp;
  private final IDisplayServer xs;
  private final Label la;
  private final Double fontHeight;
  private BoundingBox bb = null;
  
  public EllipsisHelper$SimpleTester(IChartComputation cComp, IDisplayServer xs, Label la, Double fontHeight)
    throws ChartException
  {
    this.cComp = cComp;
    this.xs = xs;
    this.la = la;
    if (fontHeight != null) {
      this.fontHeight = fontHeight;
    } else {
      this.fontHeight = Double.valueOf(cComp.computeFontHeight(xs, la));
    }
  }
  
  private void computeSize(double dWrapping)
    throws ChartException
  {
    bb = cComp.computeLabelSize(xs, la, dWrapping, fontHeight);
  }
  
  private boolean testSize(LabelLimiter lblLimit)
  {
    return (bb.getWidth() <= lblLimit.getMaxWidth()) && (bb.getHeight() <= lblLimit.getMaxHeight());
  }
  
  public boolean testLabelVisible(String strNew, Object para)
    throws ChartException
  {
    LabelLimiter lbLimit = (LabelLimiter)para;
    la.getCaption().setValue(strNew);
    if (lbLimit.getMaxHeight() < fontHeight.doubleValue()) {
      return false;
    }
    computeSize(0.0D);
    if (testSize(lbLimit)) {
      return true;
    }
    if (lbLimit.getWrapping() > 0.0D)
    {
      computeSize(lbLimit.getWrapping());
      return testSize(lbLimit);
    }
    return false;
  }
  
  public double getHeight()
    throws
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd