jcommon-1.0.12

Relative(name, context);
    if (url == null) {
      return null;
    }
    try
    {
      return url.openStream();
    }
    catch (IOException e) {}
    return null;
  }
  
  public static Object loadAndInstantiate(String className, Class source)
  {
    try
    {
      ClassLoader loader = getClassLoader(source);
      Class c = loader.loadClass(className);
      return c.newInstance();
    }
    catch (Exception e) {}
    return null;
  }
  
  public static Object loadAndInstantiate(String className, Class source, Class type)
  {
    try
    {
      ClassLoader loader = getClassLoader(source);
      Class c = loader.loadClass(className);
      if (type.isAssignableFrom(c)) {
        return c.newInstance();
      }
    }
    catch (Exception e)
    {
      return null;
    }
    return null;
  }
  
  public static boolean isJDK14()
  {
    ClassLoader loader = getClassLoader(ObjectUtilities.class);
    if (loader != null) {
      try
      {
        loader.loadClass("java.util.RandomAccess");
        return true;
      }
      catch (ClassNotFoundException e)
      {
        return false;
      }
      catch (Exception e) {}
    }
    try
    {
      String version = System.getProperty("java.vm.specification.version");
      if (version == null) {
        return false;
      }
      String[] versions = parseVersions(version);
      String[] target = { "1", "4" };
      return ArrayUtilities.compareVersionArrays(versions, target) >= 0;
    }
    catch (Exception e) {}
    return false;
  }
  
  private static String[] parseVersions(String version)
  {
    if (version == null) {
      return new String[0];
    }
    ArrayList versions = new ArrayList();
    StringTokenizer strtok = new StringTokenizer(version, ".");
    while (strtok.hasMoreTokens()) {
      versions.add(strtok.nextToken());
    }
    return (String[])versions.toArray(new String[versions.size()]);
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.ObjectUtilities
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Paint;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.jfree.io.SerialUtilities;

public class PaintList
  extends AbstractObjectList
{
  public Paint getPaint(int index)
  {
    return (Paint)get(index);
  }
  
  public void setPaint(int index, Paint paint)
  {
    set(index, paint);
  }
  
  public boolean equals(Object obj)
  {
    if (obj == null) {
      return false;
    }
    if (obj == this) {
      return true;
    }
    if ((obj instanceof PaintList))
    {
      PaintList that = (PaintList)obj;
      int listSize = size();
      for (int i = 0; i < listSize; i++) {
        if (!PaintUtilities.equal(getPaint(i), that.getPaint(i))) {
          return false;
        }
      }
    }
    return true;
  }
  
  public int hashCode()
  {
    return super.hashCode();
  }
  
  private void writeObject(ObjectOutputStream stream)
    throws IOException
  {
    stream.defaultWriteObject();
    int count = size();
    stream.writeInt(count);
    for (int i = 0; i < count; i++)
    {
      Paint paint = getPaint(i);
      if (paint != null)
      {
        stream.writeInt(i);
        SerialUtilities.writePaint(paint, stream);
      }
      else
      {
        stream.writeInt(-1);
      }
    }
  }
  
  private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException
  {
    stream.defaultReadObject();
    int count = stream.readInt();
    for (int i = 0; i < count; i++)
    {
      int index = stream.readInt();
      if (index != -1) {
        setPaint(index, SerialUtilities.readPaint(stream));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.PaintList
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Paint;
import java.awt.geom.Point2D;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class PaintUtilities
{
  public static boolean equal(Paint p1, Paint p2)
  {
    if (p1 == null) {
      return p2 == null;
    }
    if (p2 == null) {
      return false;
    }
    boolean result = false;
    if (((p1 instanceof GradientPaint)) && ((p2 instanceof GradientPaint)))
    {
      GradientPaint gp1 = (GradientPaint)p1;
      GradientPaint gp2 = (GradientPaint)p2;
      result = (gp1.getColor1().equals(gp2.getColor1())) && (gp1.getColor2().equals(gp2.getColor2())) && (gp1.getPoint1().equals(gp2.getPoint1())) && (gp1.getPoint2().equals(gp2.getPoint2())) && (gp1.isCyclic() == gp2.isCyclic()) && (gp1.getTransparency() == gp1.getTransparency());
    }
    else
    {
      result = p1.equals(p2);
    }
    return result;
  }
  
  public static String colorToString(Color c)
  {
    try
    {
      Field[] fields = Color.class.getFields();
      for (int i = 0; i < fields.length; i++)
      {
        Field f = fields[i];
        if ((Modifier.isPublic(f.getModifiers())) && (Modifier.isFinal(f.getModifiers())) && (Modifier.isStatic(f.getModifiers())))
        {
          String name = f.getName();
          Object oColor = f.get(null);
          if (((oColor instanceof Color)) && 
            (c.equals(oColor))) {
            return name;
          }
        }
      }
    }
    catch (Exception e) {}
    String color = Integer.toHexString(c.getRGB() & 0xFFFFFF);
    StringBuffer retval = new StringBuffer(7);
    retval.append("#");
    
    int fillUp = 6 - color.length();
    for (int i = 0; i < fillUp; i++) {
      retval.append("0");
    }
    retval.append(color);
    return retval.toString();
  }
  
  public static Color stringToColor(String value)
  {
    if (value == null) {
      return Color.black;
    }
    try
    {
      return Color.decode(value);
    }
    catch (NumberFormatException nfe)
    {
      try
      {
        Field f = Color.class.getField(value);
        
        return (Color)f.get(null);
      }
      catch (Exception ce)
      {
        Log.info("No such Color : " + value);
      }
    }
    return Color.black;
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.PaintUtilities
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.PrintStream;
import java.io.Serializable;

public class PrintStreamLogTarget
  implements LogTarget, Serializable
{
  private static final long serialVersionUID = 6510564403264504688L;
  private PrintStream printStream;
  
  public PrintStreamLogTarget()
  {
    this(System.out);
  }
  
  public PrintStreamLogTarget(PrintStream printStream)
  {
    if (printStream == null) {
      throw new NullPointerException();
    }
    this.printStream = printStream;
  }
  
  public void log(int level, Object message)
  {
    if (level > 3) {
      level = 3;
    }
    printStream.print(LEVELS[level]);
    printStream.println(message);
    if (level < 3) {
      System.out.flush();
    }
  }
  
  public void log(int level, Object message, Exception e)
  {
    if (level > 3) {
      level = 3;
    }
    printStream.print(LEVELS[level]);
    printStream.println(message);
    e.printStackTrace(printStream);
    if (level < 3) {
      System.out.flush();
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.PrintStreamLogTarget
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

public abstract interface PublicCloneable
  extends Cloneable
{
  public abstract Object clone()
    throws CloneNotSupportedException;
}

/* Location:
 * Qualified Name:     org.jfree.util.PublicCloneable
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.util.Iterator;

public class ReadOnlyIterator
  implements Iterator
{
  private Iterator base;
  
  public ReadOnlyIterator(Iterator it)
  {
    if (it == null) {
      throw new NullPointerException("Base iterator is null.");
    }
    base = it;
  }
  
  public boolean hasNext()
  {
    return base.hasNext();
  }
  
  public Object next()
  {
    return base.next();
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.ReadOnlyIterator
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.lang.reflect.Field;
import java.net.URL;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.KeyStroke;

public class ResourceBundleSupport
{
  private ResourceBundle resources;
  private TreeMap cache;
  private TreeSet lookupPath;
  private String resourceBase;
  private Locale locale;
  
  public ResourceBundleSupport(Locale locale, String baseName)
  {
    this(locale, ResourceBundle.getBundle(baseName, locale), baseName);
  }
  
  protected ResourceBundleSupport(Locale locale, ResourceBundle resourceBundle, String baseName)
  {
    if (locale == null) {
      throw new NullPointerException("Locale must not be null");
    }
    if (resourceBundle == null) {
      throw new NullPointerException("Resources must not be null");
    }
    if (baseName == null) {
      throw new NullPointerException("BaseName must not be null");
    }
    this.locale = locale;
    resources = resourceBundle;
    resourceBase = baseName;
    cache = new TreeMap();
    lookupPath = new TreeSet();
  }
  
  public ResourceBundleSupport(Locale locale, ResourceBundle resourceBundle)
  {
    this(locale, resourceBundle, resourceBundle.toString());
  }
  
  public ResourceBundleSupport(String baseName)
  {
    this(Locale.getDefault(), ResourceBundle.getBundle(baseName), baseName);
  }
  
  protected ResourceBundleSupport(ResourceBundle resourceBundle, String baseName)
  {
    this(Locale.getDefault(), resourceBundle, baseName);
  }
  
  public ResourceBundleSupport(ResourceBundle resourceBundle)
  {
    this(Locale.getDefault(), resourceBundle, resourceBundle.toString());
  }
  
  protected final String getResourceBase()
  {
    return resourceBase;
  }
  
  public synchronized String getString(String key)
  {
    String retval = (String)cache.get(key);
    if (retval != null) {
      return retval;
    }
    lookupPath.clear();
    return internalGetString(key);
  }
  
  protected String internalGetString(String key)
  {
    if (lookupPath.contains(key)) {
      throw new MissingResourceException("InfiniteLoop in resource lookup", getResourceBase(), lookupPath.toString());
    }
    String fromResBundle = resources.getString(key);
    if (fromResBundle.startsWith("@@"))
    {
      int idx = fromResBundle.indexOf('@', 2);
      if (idx == -1) {
        throw new MissingResourceException("Invalid format for global lookup key.", getResourceBase(), key);
      }
      try
      {
        ResourceBundle res = ResourceBundle.getBundle(fromResBundle.substring(2, idx));
        
        return res.getString(fromResBundle.substring(idx + 1));
      }
      catch (Exception e)
      {
        Log.error("Error during global lookup", e);
        throw new MissingResourceException("Error during global lookup", getResourceBase(), key);
      }
    }
    if (fromResBundle.startsWith("@"))
    {
      String newKey = fromResBundle.substring(1);
      lookupPath.add(key);
      String retval = internalGetString(newKey);
      
      cache.put(key, retval);
      return retval;
    }
    cache.put(key, fromResBundle);
    return fromResBundle;
  }
  
  public Icon getIcon(String key, boolean large)
  {
    String name = getString(key);
    return createIcon(name, true, large);
  }
  
  public Icon getIcon(String key)
  {
    String name = getString(key);
    return createIcon(name, false, false);
  }
  
  public Integer getMnemonic(String key)
  {
    String name = getString(key);
    return createMnemonic(name);
  }
  
  public Integer getOptionalMnemonic(String key)
  {
    String name = getString(key);
    if ((name != null) && (name.length() > 0)) {
      return createMnemonic(name);
    }
    return null;
  }
  
  public KeyStroke getKeyStroke(String key)
  {
    return getKeyStroke(key, getMenuKeyMask());
  }
  
  public KeyStroke getOptionalKeyStroke(String key)
  {
    return getOptionalKeyStroke(key, getMenuKeyMask());
  }
  
  public KeyStroke getKeyStroke(String key, int mask)
  {
    String name = getString(key);
    return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
  }
  
  public KeyStroke getOptionalKeyStroke(String key, int mask)
  {
    String name = getString(key);
    if ((name != null) && (name.length() > 0)) {
      return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
    }
    return null;
  }
  
  public JMenu createMenu(String keyPrefix)
  {
    JMenu retval = new JMenu();
    retval.setText(getString(keyPrefix + ".name"));
    retval.setMnemonic(getMnemonic(keyPrefix + ".mnemonic").intValue());
    return retval;
  }
  
  public URL getResourceURL(String key)
  {
    String name = getString(key);
    URL in = ObjectUtilities.getResource(name, ResourceBundleSupport.class);
    if (in == null) {
      Log.warn("Unable to find file in the class path: " + name + "; key=" + key);
    }
    return in;
  }
  
  private ImageIcon createIcon(String resourceName, boolean scale, boolean large)
  {
    URL in = ObjectUtilities.getResource(resourceName, ResourceBundleSupport.class);
    if (in == null)
    {
      Log.warn("Unable to find file in the class path: " + resourceName);
      return new ImageIcon(createTransparentImage(1, 1));
    }
    Image img = Toolkit.getDefaultToolkit().createImage(in);
    if (img == null)
    {
      Log.warn("Unable to instantiate the image: " + resourceName);
      return new ImageIcon(createTransparentImage(1, 1));
    }
    if (scale)
    {
      if (large) {
        return new ImageIcon(img.getScaledInstance(24, 24, 4));
      }
      return new ImageIcon(img.getScaledInstance(16, 16, 4));
    }
    return new ImageIcon(img);
  }
  
  private Integer createMnemonic(String keyString)
  {
    if (keyString == null) {
      throw new NullPointerException("Key is null.");
    }
    if (keyString.length() == 0) {
      throw new IllegalArgumentException("Key is empty.");
    }
    int character = keyString.charAt(0);
    if (keyString.startsWith("VK_")) {
      try
      {
        Field f = KeyEvent.class.getField(keyString);
        Integer keyCode = (Integer)f.get(null);
        character = keyCode.intValue();
      }
      catch (Exception nsfe) {}
    }
    return new Integer(character);
  }
  
  private int getMenuKeyMask()
  {
    try
    {
      return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    }
    catch (UnsupportedOperationException he) {}
    return 2;
  }
  
  private BufferedImage createTransparentImage(int width, int height)
  {
    BufferedImage img = new BufferedImage(width, height, 2);
    int[] data = img.getRGB(0, 0, width, height, null, 0, width);
    Arrays.fill(data, 0);
    img.setRGB(0, 0, width, height, data, 0, width);
    return img;
  }
  
  public Icon createTransparentIcon(int width, int height)
  {
    return new ImageIcon(createTransparentImage(width, height));
  }
  
  public String formatMessage(String key, Object parameter)
  {
    return formatMessage(key, new Object[] { parameter });
  }
  
  public String formatMessage(String key, Object par1, Object par2)
  {
    return formatMessage(key, new Object[] { par1, par2 });
  }
  
  public String formatMessage(String key, Object[] parameters)
  {
    MessageFormat format = new MessageFormat(getString(key));
    format.setLocale(getLocale());
    return format.format(parameters);
  }
  
  public Locale getLocale()
  {
    return locale;
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.ResourceBundleSupport
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class Rotation
  implements Serializable
{
  private static final long serialVersionUID = -4662815260201591676L;
  public static final Rotation CLOCKWISE = new Rotation("Rotation.CLOCKWISE", -1.0D);
  public static final Rotation ANTICLOCKWISE = new Rotation("Rotation.ANTICLOCKWISE", 1.0D);
  private String name;
  private double factor;
  
  private Rotation(String name, double factor)
  {
    this.name = name;
    this.factor = factor;
  }
  
  public String toString()
  {
    return name;
  }
  
  public double getFactor()
  {
    return factor;
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Rotation)) {
      return false;
    }
    Rotation rotation = (Rotation)o;
    if (factor != factor) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    long temp = Double.doubleToLongBits(factor);
    return (int)(temp ^ temp >>> 32);
  }
  
  private Object readResolve()
    throws ObjectStreamException
  {
    if (equals(CLOCKWISE)) {
      return CLOCKWISE;
    }
    if (equals(ANTICLOCKWISE)) {
      return ANTICLOCKWISE;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.Rotation
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Shape;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.jfree.io.SerialUtilities;

public class ShapeList
  extends AbstractObjectList
{
  public Shape getShape(int index)
  {
    return (Shape)get(index);
  }
  
  public void setShape(int index, Shape shape)
  {
    set(index, shape);
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
  
  public boolean equals(Object o)
  {
    if (o == null) {
      return false;
    }
    if (o == this) {
      return true;
    }
    if ((o instanceof ShapeList)) {
      return super.equals(o);
    }
    return false;
  }
  
  public int hashCode()
  {
    return super.hashCode();
  }
  
  private void writeObject(ObjectOutputStream stream)
    throws IOException
  {
    stream.defaultWriteObject();
    int count = size();
    stream.writeInt(count);
    for (int i = 0; i < count; i++)
    {
      Shape shape = getShape(i);
      if (shape != null)
      {
        stream.writeInt(i);
        SerialUtilities.writeShape(shape, stream);
      }
      else
      {
        stream.writeInt(-1);
      }
    }
  }
  
  private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException
  {
    stream.defaultReadObject();
    int count = stream.readInt();
    for (int i = 0; i < count; i++)
    {
      int index = stream.readInt();
      if (index != -1) {
        setShape(index, SerialUtilities.readShape(stream));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.ShapeList
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.awt.geom.Rectangle2D;
import java.util.Arrays;
import org.jfree.ui.RectangleAnchor;

public class ShapeUtilities
{
  public static Shape clone(Shape shape)
  {
    if ((shape instanceof Cloneable)) {
      try
      {
        return (Shape)ObjectUtilities.clone(shape);
      }
      catch (CloneNotSupportedException cnse) {}
    }
    Shape result = null;
    return result;
  }
  
  public static boolean equal(Shape s1, Shape s2)
  {
    if (((s1 instanceof Line2D)) && ((s2 instanceof Line2D))) {
      return equal((Line2D)s1, (Line2D)s2);
    }
    if (((s1 instanceof Ellipse2D)) && ((s2 instanceof Ellipse2D))) {
      return equal((Ellipse2D)s1, (Ellipse2D)s2);
    }
    if (((s1 instanceof Arc2D)) && ((s2 instanceof Arc2D))) {
      return equal((Arc2D)s1, (Arc2D)s2);
    }
    if (((s1 instanceof Polygon)) && ((s2 instanceof Polygon))) {
      return equal((Polygon)s1, (Polygon)s2);
    }
    if (((s1 instanceof GeneralPath)) && ((s2 instanceof GeneralPath))) {
      return equal((GeneralPath)s1, (GeneralPath)s2);
    }
    return ObjectUtilities.equal(s1, s2);
  }
  
  public static boolean equal(Line2D l1, Line2D l2)
  {
    if (l1 == null) {
      return l2 == null;
    }
    if (l2 == null) {
      return false;
    }
    if (!l1.getP1().equals(l2.getP1())) {
      return false;
    }
    if (!l1.getP2().equals(l2.getP2())) {
      return false;
    }
    return true;
  }
  
  public static boolean equal(Ellipse2D e1, Ellipse2D e2)
  {
    if (e1 == null) {
      return e2 == null;
    }
    if (e2 == null) {
      return false;
    }
    if (!e1.getFrame().equals(e2.getFrame())) {
      return false;
    }
    return true;
  }
  
  public static boolean equal(Arc2D a1, Arc2D a2)
  {
    if (a1 == null) {
      return a2 == null;
    }
    if (a2 == null) {
      return false;
    }
    if (!a1.getFrame().equals(a2.getFrame())) {
      return false;
    }
    if (a1.getAngleStart() != a2.getAngleStart()) {
      return false;
    }
    if (a1.getAngleExtent() != a2.getAngleExtent()) {
      return false;
    }
    if (a1.getArcType() != a2.getArcType()) {
      return false;
    }
    return true;
  }
  
  public static boolean equal(Polygon p1, Polygon p2)
  {
    if (p1 == null) {
      return p2 == null;
    }
    if (p2 == null) {
      return false;
    }
    if (npoints != npoints) {
      return false;
    }
    if (!Arrays.equals(xpoints, xpoints)) {
      return false;
    }
    if (!Arrays.equals(ypoints, ypoints)) {
      return false;
    }
    return true;
  }
  
  public static boolean equal(GeneralPath p1, GeneralPath p2)
  {
    if (p1 == null) {
      return p2 == null;
    }
    if (p2 == null) {
      return false;
    }
    if (p1.getWindingRule() != p2.getWindingRule()) {
      return false;
    }
    PathIterator iterator1 = p1.getPathIterator(null);
    PathIterator iterator2 = p1.getPathIterator(null);
    double[] d1 = new double[6];
    double[] d2 = new double[6];
    boolean done = (iterator1.isDone()) && (iterator2.isDone());
    while (!done)
    {
      if (iterator1.isDone() != iterator2.isDone()) {
        return false;
      }
      int seg1 = iterator1.currentSegment(d1);
      int seg2 = iterator2.currentSegment(d2);
      if (seg1 != seg2) {
        return false;
      }
      if (!Arrays.equals(d1, d2)) {
        return false;
      }
      iterator1.next();
      iterator2.next();
      done = (iterator1.isDone()) && (iterator2.isDone());
    }
    return true;
  }
  
  public static Shape createTranslatedShape(Shape shape, double transX, double transY)
  {
    if (shape == null) {
      throw new IllegalArgumentException("Null 'shape' argument.");
    }
    AffineTransform transform = AffineTransform.getTranslateInstance(transX, transY);
    
    return transform.createTransformedShape(shape);
  }
  
  public static Shape createTranslatedShape(Shape shape, RectangleAnchor anchor, double locationX, double locationY)
  {
    if (shape == null) {
      throw new IllegalArgumentException("Null 'shape' argument.");
    }
    if (anchor == null) {
      throw new IllegalArgumentException("Null 'anchor' argument.");
    }
    Point2D anchorPoint = RectangleAnchor.coordinates(shape.getBounds2D(), anchor);
    
    AffineTransform transform = AffineTransform.getTranslateInstance(locationX - anchorPoint.getX(), locationY - anchorPoint.getY());
    
    return transform.createTransformedShape(shape);
  }
  
  public static Shape rotateShape(Shape base, double angle, float x, float y)
  {
    if (base == null) {
      return null;
    }
    AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y);
    
    Shape result = rotate.createTransformedShape(base);
    return result;
  }
  
  public static void drawRotatedShape(Graphics2D g2, Shape shape, double angle, float x, float y)
  {
    AffineTransform saved = g2.getTransform();
    AffineTransform rotate = AffineTransform.getRotateInstance(angle, x, y);
    
    g2.transform(rotate);
    g2.draw(shape);
    g2.setTransform(saved);
  }
  
  private static final float SQRT2 = (float)Math.pow(2.0D, 0.5D);
  
  public static Shape createDiagonalCross(float l, float t)
  {
    GeneralPath p0 = new GeneralPath();
    p0.moveTo(-l - t, -l + t);
    p0.lineTo(-l + t, -l - t);
    p0.lineTo(0.0F, -t * SQRT2);
    p0.lineTo(l - t, -l - t);
    p0.lineTo(l + t, -l + t);
    p0.lineTo(t * SQRT2, 0.0F);
    p0.lineTo(l + t, l - t);
    p0.lineTo(l - t, l + t);
    p0.lineTo(0.0F, t * SQRT2);
    p0.lineTo(-l + t, l + t);
    p0.lineTo(-l - t, l - t);
    p0.lineTo(-t * SQRT2, 0.0F);
    p0.closePath();
    return p0;
  }
  
  public static Shape createRegularCross(float l, float t)
  {
    GeneralPath p0 = new GeneralPath();
    p0.moveTo(-l, t);
    p0.lineTo(-t, t);
    p0.lineTo(-t, l);
    p0.lineTo(t, l);
    p0.lineTo(t, t);
    p0.lineTo(l, t);
    p0.lineTo(l, -t);
    p0.lineTo(t, -t);
    p0.lineTo(t, -l);
    p0.lineTo(-t, -l);
    p0.lineTo(-t, -t);
    p0.lineTo(-l, -t);
    p0.closePath();
    return p0;
  }
  
  public static Shape createDiamond(float s)
  {
    GeneralPath p0 = new GeneralPath();
    p0.moveTo(0.0F, -s);
    p0.lineTo(s, 0.0F);
    p0.lineTo(0.0F, s);
    p0.lineTo(-s, 0.0F);
    p0.closePath();
    return p0;
  }
  
  public static Shape createUpTriangle(float s)
  {
    GeneralPath p0 = new GeneralPath();
    p0.moveTo(0.0F, -s);
    p0.lineTo(s, s);
    p0.lineTo(-s, s);
    p0.closePath();
    return p0;
  }
  
  public static Shape createDownTriangle(float s)
  {
    GeneralPath p0 = new GeneralPath();
    p0.moveTo(0.0F, s);
    p0.lineTo(s, -s);
    p0.lineTo(-s, -s);
    p0.closePath();
    return p0;
  }
  
  public static Shape createLineRegion(Line2D line, float width)
  {
    GeneralPath result = new GeneralPath();
    float x1 = (float)line.getX1();
    float x2 = (float)line.getX2();
    float y1 = (float)line.getY1();
    float y2 = (float)line.getY2();
    if (x2 - x1 != 0.0D)
    {
      double theta = Math.atan((y2 - y1) / (x2 - x1));
      float dx = (float)Math.sin(theta) * width;
      float dy = (float)Math.cos(theta) * width;
      result.moveTo(x1 - dx, y1 + dy);
      result.lineTo(x1 + dx, y1 - dy);
      result.lineTo(x2 + dx, y2 - dy);
      result.lineTo(x2 - dx, y2 + dy);
      result.closePath();
    }
    else
    {
      result.moveTo(x1 - width / 2.0F, y1);
      result.lineTo(x1 + width / 2.0F, y1);
      result.lineTo(x2 + width / 2.0F, y2);
      result.lineTo(x2 - width / 2.0F, y2);
      result.closePath();
    }
    return result;
  }
  
  public static Point2D getPointInRectangle(double x, double y, Rectangle2D area)
  {
    x = Math.max(area.getMinX(), Math.min(x, area.getMaxX()));
    y = Math.max(area.getMinY(), Math.min(y, area.getMaxY()));
    return new Point2D.Double(x, y);
  }
  
  public static boolean contains(Rectangle2D rect1, Rectangle2D rect2)
  {
    double x0 = rect1.getX();
    double y0 = rect1.getY();
    double x = rect2.getX();
    double y = rect2.getY();
    double w = rect2.getWidth();
    double h = rect2.getHeight();
    
    return (x >= x0) && (y >= y0) && (x + w <= x0 + rect1.getWidth()) && (y + h <= y0 + rect1.getHeight());
  }
  
  public static boolean intersects(Rectangle2D rect1, Rectangle2D rect2)
  {
    double x0 = rect1.getX();
    double y0 = rect1.getY();
    
    double x = rect2.getX();
    double width = rect2.getWidth();
    double y = rect2.getY();
    double height = rect2.getHeight();
    return (x + width >= x0) && (y + height >= y0) && (x <= x0 + rect1.getWidth()) && (y <= y0 + rect1.getHeight());
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.ShapeUtilities
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

public class SortedConfigurationWriter
{
  private static final int ESCAPE_KEY = 0;
  private static final int ESCAPE_VALUE = 1;
  private static final int ESCAPE_COMMENT = 2;
  private static final String END_OF_LINE = ;
  
  protected String getDescription(String key)
  {
    return null;
  }
  
  public void save(String filename, Configuration config)
    throws IOException
  {
    save(new File(filename), config);
  }
  
  public void save(File file, Configuration config)
    throws IOException
  {
    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
    
    save(out, config);
    out.close();
  }
  
  public void save(OutputStream outStream, Configuration config)
    throws IOException
  {
    ArrayList names = new ArrayList();
    
    Iterator defaults = config.findPropertyKeys("");
    while (defaults.hasNext())
    {
      String key = (String)defaults.next();
      names.add(key);
    }
    Collections.sort(names);
    
    OutputStreamWriter out = new OutputStreamWriter(outStream, "iso-8859-1");
    for (int i = 0; i < names.size(); i++)
    {
      String key = (String)names.get(i);
      String value = config.getConfigProperty(key);
      
      String description = getDescription(key);
      if (description != null) {
        writeDescription(description, out);
      }
      saveConvert(key, 0, out);
      out.write("=");
      saveConvert(value, 1, out);
      out.write(END_OF_LINE);
    }
    out.flush();
  }
  
  private void writeDescription(String text, Writer writer)
    throws IOException
  {
    if (text.length() == 0) {
      return;
    }
    writer.write("# ");
    writer.write(END_OF_LINE);
    LineBreakIterator iterator = new LineBreakIterator(text);
    while (iterator.hasNext())
    {
      writer.write("# ");
      saveConvert((String)iterator.next(), 2, writer);
      writer.write(END_OF_LINE);
    }
  }
  
  private void saveConvert(String text, int escapeMode, Writer writer)
    throws IOException
  {
    char[] string = text.toCharArray();
    for (int x = 0; x < string.length; x++)
    {
      char aChar = string[x];
      switch (aChar)
      {
      case ' ': 
        if ((escapeMode != 2) && ((x == 0) || (escapeMode == 0))) {
          writer.write(92);
        }
        writer.write(32);
        break;
      case '\\': 
        writer.write(92);
        writer.write(92);
        break;
      case '\t': 
        if (escapeMode == 2)
        {
          writer.write(aChar);
        }
        else
        {
          writer.write(92);
          writer.write(116);
        }
        break;
      case '\n': 
        writer.write(92);
        writer.write(110);
        break;
      case '\r': 
        writer.write(92);
        writer.write(114);
        break;
      case '\f': 
        if (escapeMode == 2)
        {
          writer.write(aChar);
        }
        else
        {
          writer.write(92);
          writer.write(102);
        }
        break;
      case '!': 
      case '"': 
      case '#': 
      case ':': 
      case '=': 
        if (escapeMode == 2)
        {
          writer.write(aChar);
        }
        else
        {
          writer.write(92);
          writer.write(aChar);
        }
        break;
      default: 
        if ((aChar < ' ') || (aChar > '~'))
        {
          writer.write(92);
          writer.write(117);
          writer.write(HEX_CHARS[(aChar >> '\f' & 0xF)]);
          writer.write(HEX_CHARS[(aChar >> '\b' & 0xF)]);
          writer.write(HEX_CHARS[(aChar >> '\004' & 0xF)]);
          writer.write(HEX_CHARS[(aChar & 0xF)]);
        }
        else
        {
          writer.write(aChar);
        }
        break;
      }
    }
  }
  
  private static final char[] HEX_CHARS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
}

/* Location:
 * Qualified Name:     org.jfree.util.SortedConfigurationWriter
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class SortOrder
  implements Serializable
{
  private static final long serialVersionUID = -2124469847758108312L;
  public static final SortOrder ASCENDING = new SortOrder("SortOrder.ASCENDING");
  public static final SortOrder DESCENDING = new SortOrder("SortOrder.DESCENDING");
  private String name;
  
  private SortOrder(String name)
  {
    this.name = name;
  }
  
  public String toString()
  {
    return name;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof SortOrder)) {
      return false;
    }
    SortOrder that = (SortOrder)obj;
    if (!name.equals(that.toString())) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return name.hashCode();
  }
  
  private Object readResolve()
    throws ObjectStreamException
  {
    if (equals(ASCENDING)) {
      return ASCENDING;
    }
    if (equals(DESCENDING)) {
      return DESCENDING;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.SortOrder
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.PrintStream;
import java.io.PrintWriter;

public abstract class StackableException
  extends Exception
{
  private Exception parent;
  
  public StackableException() {}
  
  public StackableException(String message, Exception ex)
  {
    super(message);
    parent = ex;
  }
  
  public StackableException(String message)
  {
    super(message);
  }
  
  public Exception getParent()
  {
    return parent;
  }
  
  public void printStackTrace(PrintStream stream)
  {
    super.printStackTrace(stream);
    if (getParent() != null)
    {
      stream.println("ParentException: ");
      getParent().printStackTrace(stream);
    }
  }
  
  public void printStackTrace(PrintWriter writer)
  {
    super.printStackTrace(writer);
    if (getParent() != null)
    {
      writer.println("ParentException: ");
      getParent().printStackTrace(writer);
    }
  }
  
  public void printStackTrace()
  {
    synchronized (System.err)
    {
      printStackTrace(System.err);
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.StackableException
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.PrintStream;
import java.io.PrintWriter;

public class StackableRuntimeException
  extends RuntimeException
{
  private Exception parent;
  
  public StackableRuntimeException() {}
  
  public StackableRuntimeException(String message, Exception ex)
  {
    super(message);
    parent = ex;
  }
  
  public StackableRuntimeException(String message)
  {
    super(message);
  }
  
  public Exception getParent()
  {
    return parent;
  }
  
  public void printStackTrace(PrintStream stream)
  {
    super.printStackTrace(stream);
    if (getParent() != null)
    {
      stream.println("ParentException: ");
      getParent().printStackTrace(stream);
    }
  }
  
  public void printStackTrace(PrintWriter writer)
  {
    super.printStackTrace(writer);
    if (getParent() != null)
    {
      writer.println("ParentException: ");
      getParent().printStackTrace(writer);
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.StackableRuntimeException
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

public class StringUtils
{
  public static boolean startsWithIgnoreCase(String base, String start)
  {
    if (base.length() < start.length()) {
      return false;
    }
    return base.regionMatches(true, 0, start, 0, start.length());
  }
  
  public static boolean endsWithIgnoreCase(String base, String end)
  {
    if (base.length() < end.length()) {
      return false;
    }
    return base.regionMatches(true, base.length() - end.length(), end, 0, end.length());
  }
  
  public static String getLineSeparator()
  {
    try
    {
      return System.getProperty("line.separator", "\n");
    }
    catch (Exception e) {}
    return "\n";
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.StringUtils
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.awt.Stroke;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.jfree.io.SerialUtilities;

public class StrokeList
  extends AbstractObjectList
{
  public Stroke getStroke(int index)
  {
    return (Stroke)get(index);
  }
  
  public void setStroke(int index, Stroke stroke)
  {
    set(index, stroke);
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
  
  public boolean equals(Object o)
  {
    if (o == null) {
      return false;
    }
    if (o == this) {
      return true;
    }
    if ((o instanceof StrokeList)) {
      return super.equals(o);
    }
    return false;
  }
  
  public int hashCode()
  {
    return super.hashCode();
  }
  
  private void writeObject(ObjectOutputStream stream)
    throws IOException
  {
    stream.defaultWriteObject();
    int count = size();
    stream.writeInt(count);
    for (int i = 0; i < count; i++)
    {
      Stroke stroke = getStroke(i);
      if (stroke != null)
      {
        stream.writeInt(i);
        SerialUtilities.writeStroke(stroke, stream);
      }
      else
      {
        stream.writeInt(-1);
      }
    }
  }
  
  private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException
  {
    stream.defaultReadObject();
    int count = stream.readInt();
    for (int i = 0; i < count; i++)
    {
      int index = stream.readInt();
      if (index != -1) {
        setStroke(index, SerialUtilities.readStroke(stream));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.StrokeList
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class TableOrder
  implements Serializable
{
  private static final long serialVersionUID = 525193294068177057L;
  public static final TableOrder BY_ROW = new TableOrder("TableOrder.BY_ROW");
  public static final TableOrder BY_COLUMN = new TableOrder("TableOrder.BY_COLUMN");
  private String name;
  
  private TableOrder(String name)
  {
    this.name = name;
  }
  
  public String toString()
  {
    return name;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof TableOrder)) {
      return false;
    }
    TableOrder that = (TableOrder)obj;
    if (!name.equals(name)) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return name.hashCode();
  }
  
  private Object readResolve()
    throws ObjectStreamException
  {
    if (equals(BY_ROW)) {
      return BY_ROW;
    }
    if (equals(BY_COLUMN)) {
      return BY_COLUMN;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.jfree.util.TableOrder
 * Java Class Version: 1.3 (47.0)
 * JD-Core Version:    0.7.1
 */
package org.jfree.util;

import java.io.ObjectStreamException;
import java.io.Serializable;

public final class UnitType
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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