jcommon-1.0.12

1.length; i++)
    {
      if ((array1[i] == null) && 
        (array2[i] != null)) {
        return false;
      }
      if ((array2[i] == null) && 
        (array1[i] != null)) {
        return false;
      }
      if (array1[i] != array2[i]) {
        return false;
      }
    }
    return true;
  }
  
  public static boolean equal(float[][] array1, float[][] array2)
  {
    if (array1 == null) {
      return array2 == null;
    }
    if (array2 == null) {
      return false;
    }
    if (array1.length != array2.length) {
      return false;
    }
    for (int i = 0; i < array1.length; i++) {
      if (!Arrays.equals(array1[i], array2[i])) {
        return false;
      }
    }
    return true;
  }
  
  public static boolean hasDuplicateItems(Object[] array)
  {
    for (int i = 0; i < array.length; i++) {
      for (int j = 0; j < i; j++)
      {
        Object o1 = array[i];
        Object o2 = array[j];
        if ((o1 != null) && (o2 != null) && 
          (o1.equals(o2))) {
          return true;
        }
      }
    }
    return false;
  }
  
  public static int compareVersionArrays(Comparable[] a1, Comparable[] a2)
  {
    int length = Math.min(a1.length, a2.length);
    for (int i = 0; i < length; i++)
    {
      Comparable o1 = a1[i];
      Comparable o2 = a2[i];
      if ((o1 != null) || (o2 != null))
      {
        if (o1 == null) {
          return 1;
        }
        if (o2 == null) {
          return -1;
        }
        int retval = o1.compareTo(o2);
        if (retval != 0) {
          return retval;
        }
      }
    }
    return 0;
  }
}

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

import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.Map;

public class AttributedStringUtilities
{
  public static boolean equal(AttributedString s1, AttributedString s2)
  {
    if (s1 == null) {
      return s2 == null;
    }
    if (s2 == null) {
      return false;
    }
    AttributedCharacterIterator it1 = s1.getIterator();
    AttributedCharacterIterator it2 = s2.getIterator();
    char c1 = it1.first();
    char c2 = it2.first();
    int start = 0;
    while (c1 != 65535)
    {
      int limit1 = it1.getRunLimit();
      int limit2 = it2.getRunLimit();
      if (limit1 != limit2) {
        return false;
      }
      Map m1 = it1.getAttributes();
      Map m2 = it2.getAttributes();
      if (!m1.equals(m2)) {
        return false;
      }
      for (int i = start; i < limit1; i++)
      {
        if (c1 != c2) {
          return false;
        }
        c1 = it1.next();
        c2 = it2.next();
      }
      start = limit1;
    }
    return c2 == 65535;
  }
}

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

public class BooleanList
  extends AbstractObjectList
{
  private static final long serialVersionUID = -8543170333219422042L;
  
  public Boolean getBoolean(int index)
  {
    return (Boolean)get(index);
  }
  
  public void setBoolean(int index, Boolean b)
  {
    set(index, b);
  }
  
  public boolean equals(Object o)
  {
    if ((o instanceof BooleanList)) {
      return super.equals(o);
    }
    return false;
  }
  
  public int hashCode()
  {
    return super.hashCode();
  }
}

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

public class BooleanUtilities
{
  public static Boolean valueOf(boolean b)
  {
    return b ? Boolean.TRUE : Boolean.FALSE;
  }
}

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

import java.io.Serializable;
import java.util.Comparator;

public class ClassComparator
  implements Comparator, Serializable
{
  private static final long serialVersionUID = -5225335361837391120L;
  
  public int compare(Object o1, Object o2)
  {
    Class c1 = (Class)o1;
    Class c2 = (Class)o2;
    if (c1.equals(o2)) {
      return 0;
    }
    if (c1.isAssignableFrom(c2)) {
      return -1;
    }
    if (!c2.isAssignableFrom(c2)) {
      throw new IllegalArgumentException("The classes share no relation");
    }
    return 1;
  }
  
  public boolean isComparable(Class c1, Class c2)
  {
    return (c1.isAssignableFrom(c2)) || (c2.isAssignableFrom(c1));
  }
}

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

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Iterator;

public abstract interface Configuration
  extends Serializable, Cloneable
{
  public abstract String getConfigProperty(String paramString);
  
  public abstract String getConfigProperty(String paramString1, String paramString2);
  
  public abstract Iterator findPropertyKeys(String paramString);
  
  public abstract Enumeration getConfigProperties();
  
  public abstract Object clone()
    throws CloneNotSupportedException;
}

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

import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.jfree.base.config.ModifiableConfiguration;

public class DefaultConfiguration
  extends Properties
  implements ModifiableConfiguration
{
  public String getConfigProperty(String key)
  {
    return getProperty(key);
  }
  
  public String getConfigProperty(String key, String defaultValue)
  {
    return getProperty(key, defaultValue);
  }
  
  public Iterator findPropertyKeys(String prefix)
  {
    TreeSet collector = new TreeSet();
    Enumeration enum1 = keys();
    while (enum1.hasMoreElements())
    {
      String key = (String)enum1.nextElement();
      if (key.startsWith(prefix)) {
        if (!collector.contains(key)) {
          collector.add(key);
        }
      }
    }
    return Collections.unmodifiableSet(collector).iterator();
  }
  
  public Enumeration getConfigProperties()
  {
    return keys();
  }
  
  public void setConfigProperty(String key, String value)
  {
    if (value == null) {
      remove(key);
    } else {
      setProperty(key, value);
    }
  }
}

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

public abstract interface ExtendedConfiguration
  extends Configuration
{
  public abstract boolean isPropertySet(String paramString);
  
  public abstract int getIntProperty(String paramString);
  
  public abstract int getIntProperty(String paramString, int paramInt);
  
  public abstract boolean getBoolProperty(String paramString);
  
  public abstract boolean getBoolProperty(String paramString, boolean paramBoolean);
}

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

import java.util.Enumeration;
import java.util.Iterator;

public class ExtendedConfigurationWrapper
  implements ExtendedConfiguration
{
  private Configuration parent;
  
  public ExtendedConfigurationWrapper(Configuration parent)
  {
    if (parent == null) {
      throw new NullPointerException("Parent given must not be null");
    }
    this.parent = parent;
  }
  
  public boolean getBoolProperty(String name)
  {
    return getBoolProperty(name, false);
  }
  
  public boolean getBoolProperty(String name, boolean defaultValue)
  {
    return "true".equals(parent.getConfigProperty(name, String.valueOf(defaultValue)));
  }
  
  public int getIntProperty(String name)
  {
    return getIntProperty(name, 0);
  }
  
  public int getIntProperty(String name, int defaultValue)
  {
    String retval = parent.getConfigProperty(name);
    if (retval == null) {
      return defaultValue;
    }
    try
    {
      return Integer.parseInt(retval);
    }
    catch (Exception e) {}
    return defaultValue;
  }
  
  public boolean isPropertySet(String name)
  {
    return parent.getConfigProperty(name) != null;
  }
  
  public Iterator findPropertyKeys(String prefix)
  {
    return parent.findPropertyKeys(prefix);
  }
  
  public String getConfigProperty(String key)
  {
    return parent.getConfigProperty(key);
  }
  
  public String getConfigProperty(String key, String defaultValue)
  {
    return parent.getConfigProperty(key, defaultValue);
  }
  
  public Enumeration getConfigProperties()
  {
    return parent.getConfigProperties();
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    ExtendedConfigurationWrapper wrapper = (ExtendedConfigurationWrapper)super.clone();
    parent = ((Configuration)parent.clone());
    return parent;
  }
}

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

import java.io.Serializable;
import java.util.Arrays;
import java.util.EmptyStackException;

public final class FastStack
  implements Serializable, Cloneable
{
  private Object[] contents;
  private int size;
  private int initialSize;
  
  public FastStack()
  {
    initialSize = 10;
  }
  
  public FastStack(int size)
  {
    initialSize = Math.max(1, size);
  }
  
  public boolean isEmpty()
  {
    return size == 0;
  }
  
  public int size()
  {
    return size;
  }
  
  public void push(Object o)
  {
    if (contents == null)
    {
      contents = new Object[initialSize];
      contents[0] = o;
      size = 1;
      return;
    }
    int oldSize = size;
    size += 1;
    if (contents.length == size)
    {
      Object[] newContents = new Object[size + initialSize];
      System.arraycopy(contents, 0, newContents, 0, size);
      contents = newContents;
    }
    contents[oldSize] = o;
  }
  
  public Object peek()
  {
    if (size == 0) {
      throw new EmptyStackException();
    }
    return contents[(size - 1)];
  }
  
  public Object pop()
  {
    if (size == 0) {
      throw new EmptyStackException();
    }
    size -= 1;
    Object retval = contents[size];
    contents[size] = null;
    return retval;
  }
  
  public Object clone()
  {
    try
    {
      FastStack stack = (FastStack)super.clone();
      if (contents != null) {
        contents = ((Object[])contents.clone());
      }
      return stack;
    }
    catch (CloneNotSupportedException cne)
    {
      throw new IllegalStateException("Clone not supported? Why?");
    }
  }
  
  public void clear()
  {
    size = 0;
    if (contents != null) {
      Arrays.fill(contents, null);
    }
  }
  
  public Object get(int index)
  {
    if (index >= size) {
      throw new IndexOutOfBoundsException();
    }
    return contents[index];
  }
}

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

class HashNMap$1 {}

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

import java.util.Iterator;
import java.util.NoSuchElementException;

final class HashNMap$EmptyIterator
  implements Iterator
{
  HashNMap$EmptyIterator(HashNMap.1 x0)
  {
    this();
  }
  
  public boolean hasNext()
  {
    return false;
  }
  
  public Object next()
  {
    throw new NoSuchElementException("This iterator is empty.");
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException("This iterator is empty, no remove supported.");
  }
  
  private HashNMap$EmptyIterator() {}
}

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

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;

public class HashNMap
  implements Serializable, Cloneable
{
  private static final long serialVersionUID = -670924844536074826L;
  
  private static final class EmptyIterator
    implements Iterator
  {
    EmptyIterator(HashNMap.1 x0)
    {
      this();
    }
    
    public boolean hasNext()
    {
      return false;
    }
    
    public Object next()
    {
      throw new NoSuchElementException("This iterator is empty.");
    }
    
    public void remove()
    {
      throw new UnsupportedOperationException("This iterator is empty, no remove supported.");
    }
    
    private EmptyIterator() {}
  }
  
  private static final Iterator EMPTY_ITERATOR = new EmptyIterator(null);
  private HashMap table;
  private static final Object[] EMPTY_ARRAY = new Object[0];
  
  public HashNMap()
  {
    table = new HashMap();
  }
  
  protected List createList()
  {
    return new ArrayList();
  }
  
  public boolean put(Object key, Object val)
  {
    List v = (List)table.get(key);
    if (v == null)
    {
      List newList = createList();
      newList.add(val);
      table.put(key, newList);
      return true;
    }
    v.clear();
    return v.add(val);
  }
  
  public boolean add(Object key, Object val)
  {
    List v = (List)table.get(key);
    if (v == null)
    {
      put(key, val);
      return true;
    }
    return v.add(val);
  }
  
  public Object getFirst(Object key)
  {
    return get(key, 0);
  }
  
  public Object get(Object key, int n)
  {
    List v = (List)table.get(key);
    if (v == null) {
      return null;
    }
    return v.get(n);
  }
  
  public Iterator getAll(Object key)
  {
    List v = (List)table.get(key);
    if (v == null) {
      return EMPTY_ITERATOR;
    }
    return v.iterator();
  }
  
  public Iterator keys()
  {
    return table.keySet().iterator();
  }
  
  public Set keySet()
  {
    return table.keySet();
  }
  
  public boolean remove(Object key, Object value)
  {
    List v = (List)table.get(key);
    if (v == null) {
      return false;
    }
    if (!v.remove(value)) {
      return false;
    }
    if (v.size() == 0) {
      table.remove(key);
    }
    return true;
  }
  
  public void removeAll(Object key)
  {
    table.remove(key);
  }
  
  public void clear()
  {
    table.clear();
  }
  
  public boolean containsKey(Object key)
  {
    return table.containsKey(key);
  }
  
  public boolean containsValue(Object value)
  {
    Iterator e = table.values().iterator();
    boolean found = false;
    while ((e.hasNext()) && (!found))
    {
      List v = (List)e.next();
      found = v.contains(value);
    }
    return found;
  }
  
  public boolean containsValue(Object key, Object value)
  {
    List v = (List)table.get(key);
    if (v == null) {
      return false;
    }
    return v.contains(value);
  }
  
  public boolean contains(Object value)
  {
    if (containsKey(value)) {
      return true;
    }
    return containsValue(value);
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    HashNMap map = (HashNMap)super.clone();
    table = new HashMap();
    Iterator iterator = keys();
    while (iterator.hasNext())
    {
      Object key = iterator.next();
      List list = (List)table.get(key);
      if (list != null) {
        table.put(key, ObjectUtilities.clone(list));
      }
    }
    return map;
  }
  
  public Object[] toArray(Object key, Object[] data)
  {
    if (key == null) {
      throw new NullPointerException("Key must not be null.");
    }
    List list = (List)table.get(key);
    if (list != null) {
      return list.toArray(data);
    }
    if (data.length > 0) {
      data[0] = null;
    }
    return data;
  }
  
  public Object[] toArray(Object key)
  {
    if (key == null) {
      throw new NullPointerException("Key must not be null.");
    }
    List list = (List)table.get(key);
    if (list != null) {
      return list.toArray();
    }
    return EMPTY_ARRAY;
  }
  
  public int getValueCount(Object key)
  {
    if (key == null) {
      throw new NullPointerException("Key must not be null.");
    }
    List list = (List)table.get(key);
    if (list != null) {
      return list.size();
    }
    return 0;
  }
}

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

import java.util.Iterator;

public class LineBreakIterator
  implements Iterator
{
  public static final int DONE = -1;
  private char[] text;
  private int position;
  
  public LineBreakIterator()
  {
    setText("");
  }
  
  public LineBreakIterator(String text)
  {
    setText(text);
  }
  
  public synchronized int nextPosition()
  {
    if (text == null) {
      return -1;
    }
    if (position == -1) {
      return -1;
    }
    int nChars = text.length;
    int nextChar = position;
    for (;;)
    {
      if (nextChar >= nChars)
      {
        position = -1;
        return -1;
      }
      boolean eol = false;
      char c = '\000';
      for (int i = nextChar; i < nChars; i++)
      {
        c = text[i];
        if ((c == '\n') || (c == '\r'))
        {
          eol = true;
          break;
        }
      }
      nextChar = i;
      if (eol)
      {
        nextChar++;
        if (c == '\r') {
          if ((nextChar < nChars) && (text[nextChar] == '\n')) {
            nextChar++;
          }
        }
        position = nextChar;
        return position;
      }
    }
  }
  
  public int nextWithEnd()
  {
    int pos = position;
    if (pos == -1) {
      return -1;
    }
    if (pos == text.length)
    {
      position = -1;
      return -1;
    }
    int retval = nextPosition();
    if (retval == -1) {
      return text.length;
    }
    return retval;
  }
  
  public String getText()
  {
    return new String(text);
  }
  
  public void setText(String text)
  {
    position = 0;
    this.text = text.toCharArray();
  }
  
  public boolean hasNext()
  {
    return position != -1;
  }
  
  public Object next()
  {
    if (position == -1) {
      return null;
    }
    int lastFound = position;
    int pos = nextWithEnd();
    if (pos == -1) {
      return new String(text, lastFound, text.length - lastFound);
    }
    if (pos > 0)
    {
      int end = lastFound;
      while ((pos > end) && ((text[(pos - 1)] == '\n') || (text[(pos - 1)] == '\r'))) {
        pos--;
      }
    }
    return new String(text, lastFound, pos - lastFound);
  }
  
  public void remove()
  {
    throw new UnsupportedOperationException("This iterator is read-only.");
  }
}

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

public class Log$SimpleMessage
{
  private String message;
  private Object[] param;
  
  public Log$SimpleMessage(String message, Object param1)
  {
    this.message = message;
    param = new Object[] { param1 };
  }
  
  public Log$SimpleMessage(String message, Object param1, Object param2)
  {
    this.message = message;
    param = new Object[] { param1, param2 };
  }
  
  public Log$SimpleMessage(String message, Object param1, Object param2, Object param3)
  {
    this.message = message;
    param = new Object[] { param1, param2, param3 };
  }
  
  public Log$SimpleMessage(String message, Object param1, Object param2, Object param3, Object param4)
  {
    this.message = message;
    param = new Object[] { param1, param2, param3, param4 };
  }
  
  public Log$SimpleMessage(String message, Object[] param)
  {
    this.message = message;
    this.param = param;
  }
  
  public String toString()
  {
    StringBuffer b = new StringBuffer();
    b.append(message);
    if (param != null) {
      for (int i = 0; i < param.length; i++) {
        b.append(param[i]);
      }
    }
    return b.toString();
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class Log
{
  private int debuglevel;
  private LogTarget[] logTargets;
  private HashMap logContexts;
  private static Log singleton;
  
  public static class SimpleMessage
  {
    private String message;
    private Object[] param;
    
    public SimpleMessage(String message, Object param1)
    {
      this.message = message;
      param = new Object[] { param1 };
    }
    
    public SimpleMessage(String message, Object param1, Object param2)
    {
      this.message = message;
      param = new Object[] { param1, param2 };
    }
    
    public SimpleMessage(String message, Object param1, Object param2, Object param3)
    {
      this.message = message;
      param = new Object[] { param1, param2, param3 };
    }
    
    public SimpleMessage(String message, Object param1, Object param2, Object param3, Object param4)
    {
      this.message = message;
      param = new Object[] { param1, param2, param3, param4 };
    }
    
    public SimpleMessage(String message, Object[] param)
    {
      this.message = message;
      this.param = param;
    }
    
    public String toString()
    {
      StringBuffer b = new StringBuffer();
      b.append(message);
      if (param != null) {
        for (int i = 0; i < param.length; i++) {
          b.append(param[i]);
        }
      }
      return b.toString();
    }
  }
  
  protected Log()
  {
    logContexts = new HashMap();
    logTargets = new LogTarget[0];
    debuglevel = 100;
  }
  
  public static synchronized Log getInstance()
  {
    if (singleton == null) {
      singleton = new Log();
    }
    return singleton;
  }
  
  protected static synchronized void defineLog(Log log)
  {
    singleton = log;
  }
  
  public int getDebuglevel()
  {
    return debuglevel;
  }
  
  protected void setDebuglevel(int debuglevel)
  {
    this.debuglevel = debuglevel;
  }
  
  public synchronized void addTarget(LogTarget target)
  {
    if (target == null) {
      throw new NullPointerException();
    }
    LogTarget[] data = new LogTarget[logTargets.length + 1];
    System.arraycopy(logTargets, 0, data, 0, logTargets.length);
    data[logTargets.length] = target;
    logTargets = data;
  }
  
  public synchronized void removeTarget(LogTarget target)
  {
    if (target == null) {
      throw new NullPointerException();
    }
    ArrayList l = new ArrayList();
    l.addAll(Arrays.asList(logTargets));
    l.remove(target);
    
    LogTarget[] targets = new LogTarget[l.size()];
    logTargets = ((LogTarget[])l.toArray(targets));
  }
  
  public LogTarget[] getTargets()
  {
    return (LogTarget[])logTargets.clone();
  }
  
  public synchronized void replaceTargets(LogTarget target)
  {
    if (target == null) {
      throw new NullPointerException();
    }
    logTargets = new LogTarget[] { target };
  }
  
  public static void debug(Object message)
  {
    log(3, message);
  }
  
  public static void debug(Object message, Exception e)
  {
    log(3, message, e);
  }
  
  public static void info(Object message)
  {
    log(2, message);
  }
  
  public static void info(Object message, Exception e)
  {
    log(2, message, e);
  }
  
  public static void warn(Object message)
  {
    log(1, message);
  }
  
  public static void warn(Object message, Exception e)
  {
    log(1, message, e);
  }
  
  public static void error(Object message)
  {
    log(0, message);
  }
  
  public static void error(Object message, Exception e)
  {
    log(0, message, e);
  }
  
  protected void doLog(int level, Object message)
  {
    if (level > 3) {
      level = 3;
    }
    if (level <= debuglevel) {
      for (int i = 0; i < logTargets.length; i++)
      {
        LogTarget t = logTargets[i];
        t.log(level, message);
      }
    }
  }
  
  public static void log(int level, Object message)
  {
    getInstance().doLog(level, message);
  }
  
  public static void log(int level, Object message, Exception e)
  {
    getInstance().doLog(level, message, e);
  }
  
  protected void doLog(int level, Object message, Exception e)
  {
    if (level > 3) {
      level = 3;
    }
    if (level <= debuglevel) {
      for (int i = 0; i < logTargets.length; i++)
      {
        LogTarget t = logTargets[i];
        t.log(level, message, e);
      }
    }
  }
  
  public void init() {}
  
  public static boolean isDebugEnabled()
  {
    return getInstance().getDebuglevel() >= 3;
  }
  
  public static boolean isInfoEnabled()
  {
    return getInstance().getDebuglevel() >= 2;
  }
  
  public static boolean isWarningEnabled()
  {
    return getInstance().getDebuglevel() >= 1;
  }
  
  public static boolean isErrorEnabled()
  {
    return getInstance().getDebuglevel() >= 0;
  }
  
  public static LogContext createContext(Class context)
  {
    return createContext(context.getName());
  }
  
  public static LogContext createContext(String context)
  {
    return getInstance().internalCreateContext(context);
  }
  
  protected LogContext internalCreateContext(String context)
  {
    synchronized (this)
    {
      LogContext ctx = (LogContext)logContexts.get(context);
      if (ctx == null)
      {
        ctx = new LogContext(context);
        logContexts.put(context, ctx);
      }
      return ctx;
    }
  }
}

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

public class LogContext
{
  private String contextPrefix;
  
  public LogContext(String contextPrefix)
  {
    this.contextPrefix = contextPrefix;
  }
  
  public boolean isDebugEnabled()
  {
    return Log.isDebugEnabled();
  }
  
  public boolean isInfoEnabled()
  {
    return Log.isInfoEnabled();
  }
  
  public boolean isWarningEnabled()
  {
    return Log.isWarningEnabled();
  }
  
  public boolean isErrorEnabled()
  {
    return Log.isErrorEnabled();
  }
  
  public void debug(Object message)
  {
    log(3, message);
  }
  
  public void debug(Object message, Exception e)
  {
    log(3, message, e);
  }
  
  public void info(Object message)
  {
    log(2, message);
  }
  
  public void info(Object message, Exception e)
  {
    log(2, message, e);
  }
  
  public void warn(Object message)
  {
    log(1, message);
  }
  
  public void warn(Object message, Exception e)
  {
    log(1, message, e);
  }
  
  public void error(Object message)
  {
    log(0, message);
  }
  
  public void error(Object message, Exception e)
  {
    log(0, message, e);
  }
  
  public void log(int level, Object message)
  {
    if (contextPrefix != null) {
      Log.getInstance().doLog(level, new Log.SimpleMessage(contextPrefix, ":", message));
    } else {
      Log.getInstance().doLog(level, message);
    }
  }
  
  public void log(int level, Object message, Exception e)
  {
    if (contextPrefix != null) {
      Log.getInstance().doLog(level, new Log.SimpleMessage(contextPrefix, ":", message), e);
    } else {
      Log.getInstance().doLog(level, message, e);
    }
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (!(o instanceof LogContext)) {
      return false;
    }
    LogContext logContext = (LogContext)o;
    if (contextPrefix != null)
    {
      if (!contextPrefix.equals(contextPrefix)) {
        return false;
      }
    }
    else if (contextPrefix != null) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    return contextPrefix != null ? contextPrefix.hashCode() : 0;
  }
}

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

public abstract interface LogTarget
{
  public static final int ERROR = 0;
  public static final int WARN = 1;
  public static final int INFO = 2;
  public static final int DEBUG = 3;
  public static final String[] LEVELS = { "ERROR: ", "WARN:  ", "INFO:  ", "DEBUG: " };
  
  public abstract void log(int paramInt, Object paramObject);
  
  public abstract void log(int paramInt, Object paramObject, Exception paramException);
}

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

public class ObjectList
  extends AbstractObjectList
{
  public ObjectList() {}
  
  public ObjectList(int initialCapacity)
  {
    super(initialCapacity);
  }
  
  public Object get(int index)
  {
    return super.get(index);
  }
  
  public void set(int index, Object object)
  {
    super.set(index, object);
  }
  
  public int indexOf(Object object)
  {
    return super.indexOf(object);
  }
}

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

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Arrays;

public class ObjectTable
  implements Serializable
{
  private static final long serialVersionUID = -3968322452944912066L;
  private int rows;
  private int columns;
  private transient Object[][] data;
  private int rowIncrement;
  private int columnIncrement;
  
  public ObjectTable()
  {
    this(5, 5);
  }
  
  public ObjectTable(int increment)
  {
    this(increment, increment);
  }
  
  public ObjectTable(int rowIncrement, int colIncrement)
  {
    if (rowIncrement < 1) {
      throw new IllegalArgumentException("Increment must be positive.");
    }
    if (colIncrement < 1) {
      throw new IllegalArgumentException("Increment must be positive.");
    }
    rows = 0;
    columns = 0;
    this.rowIncrement = rowIncrement;
    columnIncrement = colIncrement;
    
    data = new Object[rowIncrement][];
  }
  
  public int getColumnIncrement()
  {
    return columnIncrement;
  }
  
  public int getRowIncrement()
  {
    return rowIncrement;
  }
  
  protected void ensureRowCapacity(int row)
  {
    if (row >= data.length)
    {
      Object[][] enlarged = new Object[row + rowIncrement][];
      System.arraycopy(data, 0, enlarged, 0, data.length);
      
      data = enlarged;
    }
  }
  
  public void ensureCapacity(int row, int column)
  {
    if (row < 0) {
      throw new IndexOutOfBoundsException("Row is invalid. " + row);
    }
    if (column < 0) {
      throw new IndexOutOfBoundsException("Column is invalid. " + column);
    }
    ensureRowCapacity(row);
    
    Object[] current = data[row];
    if (current == null)
    {
      Object[] enlarged = new Object[Math.max(column + 1, columnIncrement)];
      
      data[row] = enlarged;
    }
    else if (column >= current.length)
    {
      Object[] enlarged = new Object[column + columnIncrement];
      System.arraycopy(current, 0, enlarged, 0, current.length);
      data[row] = enlarged;
    }
  }
  
  public int getRowCount()
  {
    return rows;
  }
  
  public int getColumnCount()
  {
    return columns;
  }
  
  protected Object getObject(int row, int column)
  {
    if (row < data.length)
    {
      Object[] current = data[row];
      if (current == null) {
        return null;
      }
      if (column < current.length) {
        return current[column];
      }
    }
    return null;
  }
  
  protected void setObject(int row, int column, Object object)
  {
    ensureCapacity(row, column);
    
    data[row][column] = object;
    rows = Math.max(rows, row + 1);
    columns = Math.max(columns, column + 1);
  }
  
  public boolean equals(Object o)
  {
    if (o == null) {
      return false;
    }
    if (this == o) {
      return true;
    }
    if (!(o instanceof ObjectTable)) {
      return false;
    }
    ObjectTable ot = (ObjectTable)o;
    if (getRowCount() != ot.getRowCount()) {
      return false;
    }
    if (getColumnCount() != ot.getColumnCount()) {
      return false;
    }
    for (int r = 0; r < getRowCount(); r++) {
      for (int c = 0; c < getColumnCount(); c++) {
        if (!ObjectUtilities.equal(getObject(r, c), ot.getObject(r, c))) {
          return false;
        }
      }
    }
    return true;
  }
  
  public int hashCode()
  {
    int result = rows;
    result = 29 * result + columns;
    return result;
  }
  
  private void writeObject(ObjectOutputStream stream)
    throws IOException
  {
    stream.defaultWriteObject();
    int rowCount = data.length;
    stream.writeInt(rowCount);
    for (int r = 0; r < rowCount; r++)
    {
      Object[] column = data[r];
      stream.writeBoolean(column != null);
      if (column != null)
      {
        int columnCount = column.length;
        stream.writeInt(columnCount);
        for (int c = 0; c < columnCount; c++) {
          writeSerializedData(stream, column[c]);
        }
      }
    }
  }
  
  protected void writeSerializedData(ObjectOutputStream stream, Object o)
    throws IOException
  {
    stream.writeObject(o);
  }
  
  private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException
  {
    stream.defaultReadObject();
    int rowCount = stream.readInt();
    data = new Object[rowCount][];
    for (int r = 0; r < rowCount; r++)
    {
      boolean isNotNull = stream.readBoolean();
      if (isNotNull)
      {
        int columnCount = stream.readInt();
        Object[] column = new Object[columnCount];
        data[r] = column;
        for (int c = 0; c < columnCount; c++) {
          column[c] = readSerializedData(stream);
        }
      }
    }
  }
  
  protected Object readSerializedData(ObjectInputStream stream)
    throws ClassNotFoundException, IOException
  {
    return stream.readObject();
  }
  
  public void clear()
  {
    rows = 0;
    columns = 0;
    for (int i = 0; i < data.length; i++) {
      if (data[i] != null) {
        Arrays.fill(data[i], null);
      }
    }
  }
  
  protected void copyColumn(int oldColumn, int newColumn)
  {
    for (int i = 0; i < getRowCount(); i++) {
      setObject(i, newColumn, getObject(i, oldColumn));
    }
  }
  
  protected void copyRow(int oldRow, int newRow)
  {
    ensureCapacity(newRow, getColumnCount());
    Object[] oldRowStorage = data[oldRow];
    if (oldRowStorage == null)
    {
      Object[] newRowStorage = data[newRow];
      if (newRowStorage != null) {
        Arrays.fill(newRowStorage, null);
      }
    }
    else
    {
      data[newRow] = ((Object[])oldRowStorage.clone());
    }
  }
  
  protected void setData(Object[][] data, int colCount)
  {
    if (data == null) {
      throw new NullPointerException();
    }
    if (colCount < 0) {
      throw new IndexOutOfBoundsException();
    }
    this.data = data;
    rows = data.length;
    columns = colCount;
  }
  
  protected Object[][] getData()
  {
    return data;
  }
}

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

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.StringTokenizer;

public final class ObjectUtilities
{
  public static final String THREAD_CONTEXT = "ThreadContext";
  public static final String CLASS_CONTEXT = "ClassContext";
  private static String classLoaderSource = "ThreadContext";
  private static ClassLoader classLoader;
  
  public static String getClassLoaderSource()
  {
    return classLoaderSource;
  }
  
  public static void setClassLoaderSource(String classLoaderSource)
  {
    classLoaderSource = classLoaderSource;
  }
  
  public static boolean equal(Object o1, Object o2)
  {
    if (o1 == o2) {
      return true;
    }
    if (o1 != null) {
      return o1.equals(o2);
    }
    return false;
  }
  
  public static int hashCode(Object object)
  {
    int result = 0;
    if (object != null) {
      result = object.hashCode();
    }
    return result;
  }
  
  public static Object clone(Object object)
    throws CloneNotSupportedException
  {
    if (object == null) {
      throw new IllegalArgumentException("Null 'object' argument.");
    }
    if ((object instanceof PublicCloneable))
    {
      PublicCloneable pc = (PublicCloneable)object;
      return pc.clone();
    }
    try
    {
      Method method = object.getClass().getMethod("clone", (Class[])null);
      if (Modifier.isPublic(method.getModifiers())) {
        return method.invoke(object, (Object[])null);
      }
    }
    catch (NoSuchMethodException e)
    {
      Log.warn("Object without clone() method is impossible.");
    }
    catch (IllegalAccessException e)
    {
      Log.warn("Object.clone(): unable to call method.");
    }
    catch (InvocationTargetException e)
    {
      Log.warn("Object without clone() method is impossible.");
    }
    throw new CloneNotSupportedException("Failed to clone.");
  }
  
  public static Collection deepClone(Collection collection)
    throws CloneNotSupportedException
  {
    if (collection == null) {
      throw new IllegalArgumentException("Null 'collection' argument.");
    }
    Collection result = (Collection)clone(collection);
    
    result.clear();
    Iterator iterator = collection.iterator();
    while (iterator.hasNext())
    {
      Object item = iterator.next();
      if (item != null) {
        result.add(clone(item));
      } else {
        result.add(null);
      }
    }
    return result;
  }
  
  public static synchronized void setClassLoader(ClassLoader classLoader)
  {
    classLoader = classLoader;
  }
  
  public static ClassLoader getClassLoader()
  {
    return classLoader;
  }
  
  public static ClassLoader getClassLoader(Class c)
  {
    String localClassLoaderSource;
    synchronized (ObjectUtilities.class)
    {
      if (classLoader != null) {
        return classLoader;
      }
      localClassLoaderSource = classLoaderSource;
    }
    String localClassLoaderSource;
    if ("ThreadContext".equals(localClassLoaderSource))
    {
      ClassLoader threadLoader = Thread.currentThread().getContextClassLoader();
      if (threadLoader != null) {
        return threadLoader;
      }
    }
    ClassLoader applicationCL = c.getClassLoader();
    if (applicationCL == null) {
      return ClassLoader.getSystemClassLoader();
    }
    return applicationCL;
  }
  
  public static URL getResource(String name, Class c)
  {
    ClassLoader cl = getClassLoader(c);
    if (cl == null) {
      return null;
    }
    return cl.getResource(name);
  }
  
  public static URL getResourceRelative(String name, Class c)
  {
    ClassLoader cl = getClassLoader(c);
    String cname = convertName(name, c);
    if (cl == null) {
      return null;
    }
    return cl.getResource(cname);
  }
  
  private static String convertName(String name, Class c)
  {
    if (name.startsWith("/")) {
      return name.substring(1);
    }
    while (c.isArray()) {
      c = c.getComponentType();
    }
    String baseName = c.getName();
    int index = baseName.lastIndexOf('.');
    if (index == -1) {
      return name;
    }
    String pkgName = baseName.substring(0, index);
    return pkgName.replace('.', '/') + "/" + name;
  }
  
  public static InputStream getResourceAsStream(String name, Class context)
  {
    URL url = getResource(name, context);
    if (url == null) {
      return null;
    }
    try
    {
      return url.openStream();
    }
    catch (IOException e) {}
    return null;
  }
  
  public static InputStream getResourceRelativeAsStream(String name, Class context)
  {
    URL url = getResource
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-2019. Infinite Loop Ltd