emma

ntException("loadFactor not in (0.0, 1.0] range: " + loadFactor);
    }
    if (initialCapacity == 0) {
      initialCapacity = 1;
    }
    m_loadFactor = (loadFactor > 1.0D ? 1.0F : loadFactor);
    m_sizeThreshold = ((int)(initialCapacity * loadFactor));
    m_buckets = new Entry[initialCapacity];
  }
  
  public String toString()
  {
    StringBuffer s = new StringBuffer();
    debugDump(s);
    
    return s.toString();
  }
  
  public int size()
  {
    return m_size;
  }
  
  public boolean contains(int key)
  {
    Entry[] buckets = m_buckets;
    int bucketIndex = (key & 0x7FFFFFFF) % buckets.length;
    for (Entry entry = buckets[bucketIndex]; entry != null; entry = m_next) {
      if (key == m_key) {
        return true;
      }
    }
    return false;
  }
  
  public int[] values()
  {
    if (m_size == 0) {
      return IConstants.EMPTY_INT_ARRAY;
    }
    int[] result = new int[m_size];
    int scan = 0;
    for (int b = 0; b < m_buckets.length; b++) {
      for (Entry entry = m_buckets[b]; entry != null; entry = m_next) {
        result[(scan++)] = m_key;
      }
    }
    return result;
  }
  
  public void values(int[] target, int offset)
  {
    if (m_size != 0)
    {
      int scan = offset;
      for (int b = 0; b < m_buckets.length; b++) {
        for (Entry entry = m_buckets[b]; entry != null; entry = m_next) {
          target[(scan++)] = m_key;
        }
      }
    }
  }
  
  public boolean add(int key)
  {
    Entry currentKeyEntry = null;
    
    int bucketIndex = (key & 0x7FFFFFFF) % m_buckets.length;
    
    Entry[] buckets = m_buckets;
    for (Entry entry = buckets[bucketIndex]; entry != null; entry = m_next) {
      if (key == m_key)
      {
        currentKeyEntry = entry;
        break;
      }
    }
    if (currentKeyEntry == null)
    {
      if (m_size >= m_sizeThreshold) {
        rehash();
      }
      buckets = m_buckets;
      bucketIndex = (key & 0x7FFFFFFF) % buckets.length;
      Entry bucketListHead = buckets[bucketIndex];
      Entry newEntry = new Entry(key, bucketListHead);
      buckets[bucketIndex] = newEntry;
      
      m_size += 1;
      
      return true;
    }
    return false;
  }
  
  void debugDump(StringBuffer out)
  {
    if (out != null)
    {
      out.append(super.toString());out.append(EOL);
      out.append("size = " + m_size + ", bucket table size = " + m_buckets.length + ", load factor = " + m_loadFactor + EOL);
      out.append("size threshold = " + m_sizeThreshold + EOL);
    }
  }
  
  private static final class Entry
  {
    final int m_key;
    Entry m_next;
    
    Entry(int key, Entry next)
    {
      m_key = key;
      m_next = next;
    }
  }
  
  private void rehash()
  {
    Entry[] buckets = m_buckets;
    
    int newBucketCount = (m_buckets.length << 1) + 1;
    Entry[] newBuckets = new Entry[newBucketCount];
    Entry entry;
    for (int b = 0; b < buckets.length; b++) {
      for (entry = buckets[b]; entry != null;)
      {
        Entry next = m_next;
        int entryKey = m_key;
        
        int newBucketIndex = (entryKey & 0x7FFFFFFF) % newBucketCount;
        
        Entry bucketListHead = newBuckets[newBucketIndex];
        m_next = bucketListHead;
        newBuckets[newBucketIndex] = entry;
        
        entry = next;
      }
    }
    m_sizeThreshold = ((int)(newBucketCount * m_loadFactor));
    m_buckets = newBuckets;
  }
  
  private static final String EOL = System.getProperty("line.separator", "\n");
}

/* Location:
 * Qualified Name:     com.vladium.util.IntSet
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public final class IntVector
  implements Cloneable
{
  private int[] m_values;
  private int m_size;
  private static final int COPY_THRESHOLD = 10;
  
  public IntVector()
  {
    this(5);
  }
  
  public IntVector(int initCapacity)
  {
    m_values = new int[initCapacity];
  }
  
  public int get(int index)
  {
    if (index > m_size - 1) {
      throw new IndexOutOfBoundsException("get[" + index + "] on vector of size " + m_size);
    }
    return m_values[index];
  }
  
  public int[] values()
  {
    if (m_size == 0) {
      return IConstants.EMPTY_INT_ARRAY;
    }
    int size = m_size;
    int[] result = new int[size];
    if (size < 10) {
      for (int i = 0; i < size; i++) {
        result[i] = m_values[i];
      }
    } else {
      System.arraycopy(m_values, 0, result, 0, size);
    }
    return result;
  }
  
  public int size()
  {
    return m_size;
  }
  
  public Object clone()
  {
    try
    {
      IntVector _clone = (IntVector)super.clone();
      if (m_size < 10)
      {
        m_values = new int[m_values.length];
        int[] _clone_values = m_values;
        for (int i = 0; i < m_size; i++) {
          _clone_values[i] = m_values[i];
        }
      }
      else
      {
        m_values = ((int[])m_values.clone());
      }
      return _clone;
    }
    catch (CloneNotSupportedException e)
    {
      throw new InternalError(e.toString());
    }
  }
  
  public String toString()
  {
    StringBuffer s = new StringBuffer(super.toString() + ", size " + m_size + ": ");
    for (int i = 0; i < m_size; i++)
    {
      if (i > 0) {
        s.append(", ");
      }
      s.append(m_values[i]);
    }
    return s.toString();
  }
  
  public int set(int index, int value)
  {
    if (index > m_size - 1) {
      throw new IndexOutOfBoundsException("get[" + index + "] on vector of size " + m_size);
    }
    int current_value = m_values[index];
    m_values[index] = value;
    
    return current_value;
  }
  
  public void add(int value)
  {
    int capacity = m_values.length;
    if (capacity == m_size)
    {
      int[] values = new int[1 + (capacity << 1)];
      if (capacity < 10) {
        for (int i = 0; i < capacity; i++) {
          values[i] = m_values[i];
        }
      } else {
        System.arraycopy(m_values, 0, values, 0, capacity);
      }
      m_values = values;
    }
    m_values[(m_size++)] = value;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.IntVector
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public abstract class IntegerFactory
{
  public static Integer getInteger(int value)
  {
    synchronized (s_values)
    {
      Object _result = s_values.get(value);
      if (_result == null)
      {
        Integer result = new Integer(value);
        s_values.put(value, result);
        
        return result;
      }
      return (Integer)_result;
    }
  }
  
  private static final IntObjectMap s_values = new IntObjectMap(16661);
}

/* Location:
 * Qualified Name:     com.vladium.util.IntegerFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

final class ObjectIntMap$Entry
{
  Object m_key;
  int m_value;
  Entry m_next;
  
  ObjectIntMap$Entry(Object key, int value, Entry next)
  {
    m_key = key;
    m_value = value;
    m_next = next;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.ObjectIntMap.Entry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

public final class ObjectIntMap
{
  private final float m_loadFactor;
  private Entry[] m_buckets;
  private int m_size;
  private int m_sizeThreshold;
  
  public ObjectIntMap()
  {
    this(11, 0.75F);
  }
  
  public ObjectIntMap(int initialCapacity)
  {
    this(initialCapacity, 0.75F);
  }
  
  public ObjectIntMap(int initialCapacity, float loadFactor)
  {
    if (initialCapacity < 0) {
      throw new IllegalArgumentException("negative input: initialCapacity [" + initialCapacity + "]");
    }
    if ((loadFactor <= 0.0D) || (loadFactor >= 1.000001D)) {
      throw new IllegalArgumentException("loadFactor not in (0.0, 1.0] range: " + loadFactor);
    }
    if (initialCapacity == 0) {
      initialCapacity = 1;
    }
    m_loadFactor = (loadFactor > 1.0D ? 1.0F : loadFactor);
    m_sizeThreshold = ((int)(initialCapacity * loadFactor));
    m_buckets = new Entry[initialCapacity];
  }
  
  public String toString()
  {
    StringBuffer s = new StringBuffer();
    debugDump(s);
    
    return s.toString();
  }
  
  public int size()
  {
    return m_size;
  }
  
  public boolean contains(Object key)
  {
    Entry[] buckets = m_buckets;
    int keyHash = key.hashCode();
    int bucketIndex = (keyHash & 0x7FFFFFFF) % buckets.length;
    for (Entry entry = buckets[bucketIndex]; entry != null; entry = m_next) {
      if ((keyHash == m_key.hashCode()) || (m_key.equals(key))) {
        return true;
      }
    }
    return false;
  }
  
  public boolean get(Object key, int[] out)
  {
    Entry[] buckets = m_buckets;
    int keyHash = key.hashCode();
    int bucketIndex = (keyHash & 0x7FFFFFFF) % buckets.length;
    for (Entry entry = buckets[bucketIndex]; entry != null; entry = m_next) {
      if ((keyHash == m_key.hashCode()) || (m_key.equals(key)))
      {
        out[0] = m_value;
        return true;
      }
    }
    return false;
  }
  
  public Object[] keys()
  {
    Object[] result = new Object[m_size];
    int scan = 0;
    for (int b = 0; b < m_buckets.length; b++) {
      for (Entry entry = m_buckets[b]; entry != null; entry = m_next) {
        result[(scan++)] = m_key;
      }
    }
    return result;
  }
  
  public void put(Object key, int value)
  {
    Entry currentKeyEntry = null;
    
    int keyHash = key.hashCode();
    int bucketIndex = (keyHash & 0x7FFFFFFF) % m_buckets.length;
    
    Entry[] buckets = m_buckets;
    for (Entry entry = buckets[bucketIndex]; entry != null; entry = m_next) {
      if ((keyHash == m_key.hashCode()) || (m_key.equals(key)))
      {
        currentKeyEntry = entry;
        break;
      }
    }
    if (currentKeyEntry != null)
    {
      m_value = value;
    }
    else
    {
      if (m_size >= m_sizeThreshold) {
        rehash();
      }
      buckets = m_buckets;
      bucketIndex = (keyHash & 0x7FFFFFFF) % buckets.length;
      Entry bucketListHead = buckets[bucketIndex];
      Entry newEntry = new Entry(key, value, bucketListHead);
      buckets[bucketIndex] = newEntry;
      
      m_size += 1;
    }
  }
  
  public void remove(Object key)
  {
    int keyHash = key.hashCode();
    int bucketIndex = (keyHash & 0x7FFFFFFF) % m_buckets.length;
    
    Entry[] buckets = m_buckets;
    Entry entry = buckets[bucketIndex];
    for (Entry prev = entry; entry != null;)
    {
      Entry next = m_next;
      if ((keyHash == m_key.hashCode()) || (m_key.equals(key)))
      {
        if (prev == entry) {
          buckets[bucketIndex] = next;
        } else {
          m_next = next;
        }
        m_size -= 1;
        break;
      }
      prev = entry;
      entry = next;
    }
  }
  
  void debugDump(StringBuffer out)
  {
    if (out != null)
    {
      out.append(super.toString());out.append(EOL);
      out.append("size = " + m_size + ", bucket table size = " + m_buckets.length + ", load factor = " + m_loadFactor + EOL);
      out.append("size threshold = " + m_sizeThreshold + EOL);
    }
  }
  
  private static final class Entry
  {
    Object m_key;
    int m_value;
    Entry m_next;
    
    Entry(Object key, int value, Entry next)
    {
      m_key = key;
      m_value = value;
      m_next = next;
    }
  }
  
  private void rehash()
  {
    Entry[] buckets = m_buckets;
    
    int newBucketCount = (m_buckets.length << 1) + 1;
    Entry[] newBuckets = new Entry[newBucketCount];
    Entry entry;
    for (int b = 0; b < buckets.length; b++) {
      for (entry = buckets[b]; entry != null;)
      {
        Entry next = m_next;
        int entryKeyHash = m_key.hashCode() & 0x7FFFFFFF;
        
        int newBucketIndex = entryKeyHash % newBucketCount;
        
        Entry bucketListHead = newBuckets[newBucketIndex];
        m_next = bucketListHead;
        newBuckets[newBucketIndex] = entry;
        
        entry = next;
      }
    }
    m_sizeThreshold = ((int)(newBucketCount * m_loadFactor));
    m_buckets = newBuckets;
  }
  
  private static final String EOL = System.getProperty("line.separator", "\n");
}

/* Location:
 * Qualified Name:     com.vladium.util.ObjectIntMap
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.File;
import java.util.Enumeration;
import java.util.Properties;

final class Property$FilePropertyLookup
  extends XProperties
{
  private final File m_src;
  private Properties m_contents;
  
  public String getProperty(String key)
  {
    faultContents();
    
    return m_contents.getProperty(key);
  }
  
  public Object get(Object key)
  {
    faultContents();
    
    return m_contents.get(key);
  }
  
  public Enumeration keys()
  {
    faultContents();
    
    return m_contents.keys();
  }
  
  Property$FilePropertyLookup(File src)
  {
    m_src = src;
  }
  
  private synchronized void faultContents()
  {
    Properties contents = m_contents;
    if ((contents == null) && (m_src != null)) {
      try
      {
        contents = Property.getPropertiesFromFile(m_src);
      }
      catch (RuntimeException re)
      {
        throw re;
      }
      catch (Exception e)
      {
        throw new RuntimeException("exception while processing properties file [" + m_src.getAbsolutePath() + "]: " + e);
      }
    }
    if (contents == null) {
      contents = new XProperties();
    }
    m_contents = contents;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Property.FilePropertyLookup
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Properties;

final class Property$SystemPropertyLookup
  extends XProperties
{
  private final String m_systemPrefix;
  
  public String getProperty(String key)
  {
    return (String)get(key);
  }
  
  public Object get(Object key)
  {
    if (!(key instanceof String)) {
      return null;
    }
    String result = (String)super.get(key);
    if (result != null) {
      return result;
    }
    if (m_systemPrefix != null)
    {
      result = Property.getSystemProperty(m_systemPrefix.concat((String)key), null);
      if (result != null) {
        return result;
      }
    }
    return result;
  }
  
  public synchronized Enumeration keys()
  {
    Hashtable _propertyNames = new Hashtable();
    if (m_systemPrefix != null) {
      try
      {
        int systemPrefixLength = m_systemPrefix.length();
        
        Enumeration e = System.getProperties().propertyNames();
        while (e.hasMoreElements())
        {
          String n = (String)e.nextElement();
          if (n.startsWith(m_systemPrefix))
          {
            String yn = n.substring(systemPrefixLength);
            
            _propertyNames.put(yn, yn);
          }
        }
      }
      catch (SecurityException ignore)
      {
        ignore.printStackTrace(System.out);
      }
    }
    return _propertyNames.keys();
  }
  
  Property$SystemPropertyLookup(String systemPrefix)
  {
    if ((systemPrefix != null) && (!systemPrefix.endsWith("."))) {
      systemPrefix = systemPrefix.concat(".");
    }
    m_systemPrefix = systemPrefix;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Property.SystemPropertyLookup
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

final class Property$SystemRedirectsLookup
  extends XProperties
{
  private final Map m_systemRedirects;
  
  public String getProperty(String key)
  {
    return (String)get(key);
  }
  
  public Object get(Object key)
  {
    if (!(key instanceof String)) {
      return null;
    }
    String result = (String)super.get(key);
    if (result != null) {
      return result;
    }
    if (m_systemRedirects != null)
    {
      String redirect = (String)m_systemRedirects.get(key);
      if (redirect != null)
      {
        result = Property.getSystemProperty(redirect, null);
        if (result != null) {
          return result;
        }
      }
    }
    return result;
  }
  
  public synchronized Enumeration keys()
  {
    Hashtable _propertyNames = new Hashtable();
    if (m_systemRedirects != null)
    {
      Iterator i = m_systemRedirects.keySet().iterator();
      while (i.hasNext())
      {
        Object key = i.next();
        if (key != null) {
          _propertyNames.put(key, key);
        }
      }
    }
    return _propertyNames.keys();
  }
  
  Property$SystemRedirectsLookup(Map systemRedirects)
  {
    m_systemRedirects = systemRedirects;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Property.SystemRedirectsLookup
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public abstract class Property
{
  private static String s_systemFingerprint;
  private static Properties s_systemProperties;
  private static Properties s_systemRedirects;
  
  public static boolean toBoolean(String value)
  {
    if (value == null) {
      return false;
    }
    return (value.startsWith("t")) || (value.startsWith("y"));
  }
  
  public static Properties combine(Properties overrides, Properties base)
  {
    if (base == null)
    {
      if (overrides == null) {
        return new XProperties();
      }
      return overrides;
    }
    if (overrides == null) {
      return base;
    }
    Properties result = new XProperties(base);
    for (Enumeration overrideNames = overrides.propertyNames(); overrideNames.hasMoreElements();)
    {
      String n = (String)overrideNames.nextElement();
      String v = overrides.getProperty(n);
      
      result.setProperty(n, v);
    }
    return result;
  }
  
  public static Properties getAppProperties(String namespace, ClassLoader loader)
  {
    if (namespace == null) {
      throw new IllegalArgumentException("null properties: appNameLC");
    }
    Properties appDefaults = getProperties(namespace + "_default.properties", loader);
    
    String fileName = getSystemProperty(namespace + ".properties");
    File file = fileName != null ? new File(fileName) : null;
    
    Properties systemFileOverrides = getLazyPropertiesFromFile(file);
    
    Properties systemOverrides = getSystemProperties(namespace);
    Properties resOverrides = getProperties(namespace + ".properties", loader);
    
    return combine(resOverrides, combine(systemOverrides, combine(systemFileOverrides, appDefaults)));
  }
  
  public static Properties getSystemProperties(String systemPrefix)
  {
    Properties result = s_systemProperties;
    if (result == null)
    {
      result = new SystemPropertyLookup(systemPrefix);
      
      s_systemProperties = result;
      return result;
    }
    return result;
  }
  
  public static Properties getSystemPropertyRedirects(Map systemRedirects)
  {
    Properties result = s_systemRedirects;
    if (result == null)
    {
      result = new SystemRedirectsLookup(systemRedirects);
      
      s_systemRedirects = result;
      return result;
    }
    return result;
  }
  
  public static String getSystemFingerprint()
  {
    if (s_systemFingerprint != null) {
      return s_systemFingerprint;
    }
    StringBuffer s = new StringBuffer();
    char delimiter = ':';
    
    s.append(getSystemProperty("java.vm.name", ""));
    s.append(':');
    s.append(getSystemProperty("java.vm.version", ""));
    s.append(':');
    s.append(getSystemProperty("java.vm.vendor", ""));
    s.append(':');
    s.append(getSystemProperty("os.name", ""));
    s.append(':');
    s.append(getSystemProperty("os.version", ""));
    s.append(':');
    s.append(getSystemProperty("os.arch", ""));
    
    s_systemFingerprint = s.toString();
    return s_systemFingerprint;
  }
  
  public static String getSystemProperty(String key)
  {
    try
    {
      return System.getProperty(key);
    }
    catch (SecurityException se) {}
    return null;
  }
  
  public static String getSystemProperty(String key, String def)
  {
    try
    {
      return System.getProperty(key, def);
    }
    catch (SecurityException se) {}
    return def;
  }
  
  public static Properties getProperties(String name)
  {
    Properties result = null;
    
    InputStream in = null;
    try
    {
      in = ResourceLoader.getResourceAsStream(name);
      if (in != null)
      {
        result = new XProperties();
        result.load(in);
      }
    }
    catch (Throwable t)
    {
      result = null;
    }
    finally
    {
      if (in != null) {
        try
        {
          in.close();
        }
        catch (Throwable ignore) {}
      }
      in = null;
    }
    return result;
  }
  
  public static Properties getProperties(String name, ClassLoader loader)
  {
    Properties result = null;
    
    InputStream in = null;
    try
    {
      in = ResourceLoader.getResourceAsStream(name, loader);
      if (in != null)
      {
        result = new XProperties();
        result.load(in);
      }
    }
    catch (Throwable t)
    {
      result = null;
    }
    finally
    {
      if (in != null) {
        try
        {
          in.close();
        }
        catch (Throwable ignore) {}
      }
      in = null;
    }
    return result;
  }
  
  public static Properties getPropertiesFromFile(File file)
    throws IOException
  {
    if (file == null) {
      throw new IllegalArgumentException("null input: file");
    }
    Properties result = null;
    
    InputStream in = null;
    try
    {
      in = new BufferedInputStream(new FileInputStream(file), 8192);
      
      result = new XProperties();
      result.load(in);
    }
    finally
    {
      if (in != null) {
        try
        {
          in.close();
        }
        catch (Throwable ignore) {}
      }
      in = null;
    }
    return result;
  }
  
  public static Properties getLazyPropertiesFromFile(File file)
  {
    return new FilePropertyLookup(file);
  }
  
  private static final class FilePropertyLookup
    extends XProperties
  {
    private final File m_src;
    private Properties m_contents;
    
    public String getProperty(String key)
    {
      faultContents();
      
      return m_contents.getProperty(key);
    }
    
    public Object get(Object key)
    {
      faultContents();
      
      return m_contents.get(key);
    }
    
    public Enumeration keys()
    {
      faultContents();
      
      return m_contents.keys();
    }
    
    FilePropertyLookup(File src)
    {
      m_src = src;
    }
    
    private synchronized void faultContents()
    {
      Properties contents = m_contents;
      if ((contents == null) && (m_src != null)) {
        try
        {
          contents = Property.getPropertiesFromFile(m_src);
        }
        catch (RuntimeException re)
        {
          throw re;
        }
        catch (Exception e)
        {
          throw new RuntimeException("exception while processing properties file [" + m_src.getAbsolutePath() + "]: " + e);
        }
      }
      if (contents == null) {
        contents = new XProperties();
      }
      m_contents = contents;
    }
  }
  
  private static final class SystemPropertyLookup
    extends XProperties
  {
    private final String m_systemPrefix;
    
    public String getProperty(String key)
    {
      return (String)get(key);
    }
    
    public Object get(Object key)
    {
      if (!(key instanceof String)) {
        return null;
      }
      String result = (String)super.get(key);
      if (result != null) {
        return result;
      }
      if (m_systemPrefix != null)
      {
        result = Property.getSystemProperty(m_systemPrefix.concat((String)key), null);
        if (result != null) {
          return result;
        }
      }
      return result;
    }
    
    public synchronized Enumeration keys()
    {
      Hashtable _propertyNames = new Hashtable();
      if (m_systemPrefix != null) {
        try
        {
          int systemPrefixLength = m_systemPrefix.length();
          
          Enumeration e = System.getProperties().propertyNames();
          while (e.hasMoreElements())
          {
            String n = (String)e.nextElement();
            if (n.startsWith(m_systemPrefix))
            {
              String yn = n.substring(systemPrefixLength);
              
              _propertyNames.put(yn, yn);
            }
          }
        }
        catch (SecurityException ignore)
        {
          ignore.printStackTrace(System.out);
        }
      }
      return _propertyNames.keys();
    }
    
    SystemPropertyLookup(String systemPrefix)
    {
      if ((systemPrefix != null) && (!systemPrefix.endsWith("."))) {
        systemPrefix = systemPrefix.concat(".");
      }
      m_systemPrefix = systemPrefix;
    }
  }
  
  private static final class SystemRedirectsLookup
    extends XProperties
  {
    private final Map m_systemRedirects;
    
    public String getProperty(String key)
    {
      return (String)get(key);
    }
    
    public Object get(Object key)
    {
      if (!(key instanceof String)) {
        return null;
      }
      String result = (String)super.get(key);
      if (result != null) {
        return result;
      }
      if (m_systemRedirects != null)
      {
        String redirect = (String)m_systemRedirects.get(key);
        if (redirect != null)
        {
          result = Property.getSystemProperty(redirect, null);
          if (result != null) {
            return result;
          }
        }
      }
      return result;
    }
    
    public synchronized Enumeration keys()
    {
      Hashtable _propertyNames = new Hashtable();
      if (m_systemRedirects != null)
      {
        Iterator i = m_systemRedirects.keySet().iterator();
        while (i.hasNext())
        {
          Object key = i.next();
          if (key != null) {
            _propertyNames.put(key, key);
          }
        }
      }
      return _propertyNames.keys();
    }
    
    SystemRedirectsLookup(Map systemRedirects)
    {
      m_systemRedirects = systemRedirects;
    }
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.Property
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;

public abstract class ResourceLoader
{
  public static Class loadClass(String name)
    throws ClassNotFoundException
  {
    Class caller = ClassLoaderResolver.getCallerClass(1);
    ClassLoader loader = ClassLoaderResolver.getClassLoader(caller);
    
    return Class.forName(name, false, loader);
  }
  
  public static URL getResource(String name)
  {
    Class caller = ClassLoaderResolver.getCallerClass(1);
    ClassLoader loader = ClassLoaderResolver.getClassLoader(caller);
    if (loader != null) {
      return loader.getResource(name);
    }
    return ClassLoader.getSystemResource(name);
  }
  
  public static InputStream getResourceAsStream(String name)
  {
    Class caller = ClassLoaderResolver.getCallerClass(1);
    ClassLoader loader = ClassLoaderResolver.getClassLoader(caller);
    if (loader != null) {
      return loader.getResourceAsStream(name);
    }
    return ClassLoader.getSystemResourceAsStream(name);
  }
  
  public static Enumeration getResources(String name)
    throws IOException
  {
    Class caller = ClassLoaderResolver.getCallerClass(1);
    ClassLoader loader = ClassLoaderResolver.getClassLoader(caller);
    if (loader != null) {
      return loader.getResources(name);
    }
    return ClassLoader.getSystemResources(name);
  }
  
  public static Class loadClass(String name, ClassLoader loader)
    throws ClassNotFoundException
  {
    return Class.forName(name, false, loader != null ? loader : ClassLoader.getSystemClassLoader());
  }
  
  public static URL getResource(String name, ClassLoader loader)
  {
    if (loader != null) {
      return loader.getResource(name);
    }
    return ClassLoader.getSystemResource(name);
  }
  
  public static InputStream getResourceAsStream(String name, ClassLoader loader)
  {
    if (loader != null) {
      return loader.getResourceAsStream(name);
    }
    return ClassLoader.getSystemResourceAsStream(name);
  }
  
  public static Enumeration getResources(String name, ClassLoader loader)
    throws IOException
  {
    if (loader != null) {
      return loader.getResources(name);
    }
    return ClassLoader.getSystemResources(name);
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.ResourceLoader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;

class SoftValueMap$IndexedSoftReference
  extends SoftReference
{
  int m_bucketIndex;
  
  SoftValueMap$IndexedSoftReference(Object referent, ReferenceQueue queue, int bucketIndex)
  {
    super(referent, queue);
    
    m_bucketIndex = bucketIndex;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.SoftValueMap.IndexedSoftReference
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.lang.ref.ReferenceQueue;

class SoftValueMap$SoftEntry
{
  SoftValueMap.IndexedSoftReference m_softValue;
  Object m_key;
  SoftEntry m_next;
  
  SoftValueMap$SoftEntry(ReferenceQueue valueReferenceQueue, Object key, Object value, SoftEntry next, int bucketIndex)
  {
    m_key = key;
    
    m_softValue = new SoftValueMap.IndexedSoftReference(value, valueReferenceQueue, bucketIndex);
    value = null;
    
    m_next = next;
  }
}

/* Location:
 * Qualified Name:     com.vladium.util.SoftValueMap.SoftEntry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.vladium.util;

import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

public final class SoftValueMap
  implements Map
{
  private final ReferenceQueue m_valueReferenceQueue;
  private final float m_loadFactor;
  private final int m_readClearCheckFrequency;
  private final int m_writeClearCheckFrequency;
  private SoftEntry[] m_buckets;
  private int m_size;
  private int m_sizeThreshold;
  private int m_readAccessCount;
  private int m_writeAccessCount;
  
  public SoftValueMap()
  {
    this(1, 1);
  }
  
  public SoftValueMap(int readClearCheckFrequency, int writeClearCheckFrequency)
  {
    this(11, 0.75F, readClearCheckFrequency, writeClearCheckFrequency);
  }
  
  public SoftValueMap(int initialCapacity, float loadFactor, int readClearCheckFrequency, int writeClearCheckFrequency)
  {
    if (initialCapacity < 0) {
      throw new IllegalArgumentException("negative input: initialCapacity [" + initialCapacity + "]");
    }
    if ((loadFactor <= 0.0D) || (loadFactor >= 1.000001D)) {
      throw new IllegalArgumentException("loadFactor not in (0.0, 1.0] range: " + loadFactor);
    }
    if (readClearCheckFrequency < 1) {
      throw new IllegalArgumentException("readClearCheckFrequency not in [1, +inf) range: " + readClearCheckFrequency);
    }
    if (writeClearCheckFrequency < 1) {
      throw new IllegalArgumentException("writeClearCheckFrequency not in [1, +inf) range: " + writeClearCheckFrequency);
    }
    if (initialCapacity == 0) {
      initialCapacity = 1;
    }
    m_valueReferenceQueue = new ReferenceQueue();
    
    m_loadFactor = loadFactor;
    m_sizeThreshold = ((int)(initialCapacity * loadFactor));
    
    m_readClearCheckFrequency = readClearCheckFrequency;
    m_writeClearCheckFrequency = writeClearCheckFrequency;
    
    m_buckets = new SoftEntry[initialCapacity];
  }
  
  public boolean equals(Object rhs)
  {
    throw new UnsupportedOperationException("not implemented: equals");
  }
  
  public int hashCode()
  {
    throw new UnsupportedOperationException("not implemented: hashCode");
  }
  
  public String toString()
  {
    StringBuffer s = new StringBuffer();
    debugDump(s);
    
    return s.toString();
  }
  
  public int size()
  {
    return m_size;
  }
  
  public boolean isEmpty()
  {
    return m_size == 0;
  }
  
  public Object get(Object key)
  {
    if (key == null) {
      throw new IllegalArgumentException("null input: key");
    }
    if (++m_readAccessCount % m_readClearCheckFrequency == 0) {
      removeClearedValues();
    }
    int keyHashCode = key.hashCode();
    SoftEntry[] buckets = m_buckets;
    int bucketIndex = (keyHashCode & 0x7FFFFFFF) % buckets.length;
    
    Object result = null;
    for (SoftEntry entry = buckets[bucketIndex]; entry != null; entry = m_next)
    {
      Object entryKey = m_key;
      if ((key == entryKey) || ((keyHashCode == entryKey.hashCode()) && (key.equals(entryKey))))
      {
        Reference ref = m_softValue;
        result = ref.get();
        if (result == null) {
          ref.enqueue();
        }
        return result;
      }
    }
    return null;
  }
  
  public Object put(Object key, Object value)
  {
    if (key == null) {
      throw new IllegalArgumentException("null input: key");
    }
    if (value == null) {
      throw new IllegalArgumentException("null input: value");
    }
    if (++m_writeAccessCount % m_writeClearCheckFrequency == 0) {
      removeClearedValues();
    }
    SoftEntry currentKeyEntry = null;
    
    int keyHashCode = key.hashCode();
    SoftEntry[] buckets = m_buckets;
    int bucketIndex = (keyHashCode & 0x7FFFFFFF) % buckets.length;
    for (SoftEntry entry = buckets[bucketIndex]; entry != null; entry = m_next)
    {
      Object entryKey = m_key;
      if ((key == entryKey) || ((keyHashCode == entryKey.hashCode()) && (key.equals(entryKey))))
      {
        currentKeyEntry = entry;
        break;
      }
    }
    if (currentKeyEntry != null)
    {
      IndexedSoftReference ref = m_softValue;
      Object currentKeyValue = ref.get();
      if (currentKeyValue == null) {
        m_bucketIndex = -1;
      }
      m_softValue = new IndexedSoftReference(value, m_valueReferenceQueue, bucketIndex);
      
      return currentKeyValue;
    }
    if (m_size >= m_sizeThreshold) {
      rehash();
    }
    buckets = m_buckets;
    bucketIndex = (keyHashCode & 0x7FFFFFFF) % buckets.length;
    SoftEntry bucketListHead = buckets[bucketIndex];
    SoftEntry newEntry = new SoftEntry(m_valueReferenceQueue, key, value, bucketListHead, bucketIndex);
    buckets[bucketIndex] = newEntry;
    
    m_size += 1;
    
    return null;
  }
  
  public Object remove(Object key)
  {
    if (key == null) {
      throw new IllegalArgumentException("null input: key");
    }
    if (++m_writeAccessCount % m_writeClearCheckFrequency == 0) {
      removeClearedValues();
    }
    int keyHashCode = key.hashCode();
    SoftEntry[] buckets = m_buckets;
    int bucketIndex = (keyHashCode & 0x7FFFFFFF) % buckets.length;
    
    Object result = null;
    
    SoftEntry entry = buckets[bucketIndex];
    for (SoftEntry prev = null; entry != null; entry = m_next)
    {
      Object entryKey = m_key;
      if ((entryKey == key) || ((keyHashCode == entryKey.hashCode()) && (key.equals(entryKey))))
      {
        if (prev == null) {
          buckets[bucketIndex] = m_next;
        } else {
          m_next = m_next;
        }
        IndexedSoftReference ref = m_softValue;
        result = ref.get();
        
        m_bucketIndex = -1;
        
        m_softValue = null;
        m_key = null;
        m_next = null;
        entry = null;
        
        m_size -= 1;
        break;
      }
      prev = entry;
    }
    return result;
  }
  
  public void clear()
  {
    SoftEntry[] buckets = m_buckets;
    
    int b = 0;
    for (int bLimit = buckets.length; b < bLimit; b++)
    {
      for (SoftEntry entry = buckets[b]; entry != null;)
      {
        SoftEntry next = m_next;
        
        m_softValue.m_bucketIndex = -1;
        
        m_softValue = null;
        m_next = null;
        m_key = null;
        
        entry = next;
      }
      buckets[b] = null;
    }
    m_size = 0;
    m_readAccessCount = 0;
    m_writeAccessCount = 0;
  }
  
  public boolean containsKey(Object key)
  {
    throw new UnsupportedOperationException("not implemented: containsKey");
  }
  
  public boolean containsValue(Object value)
  {
    throw new UnsupportedOperationException("not implemented: containsValue");
  }
  
  public void putAll(Map map)
  {
    throw new UnsupportedOperationException("not implemented: putAll");
  }
  
  public Set keySet()
  {
    throw new UnsupportedOperationException("not implemented: keySet");
  }
  
  public Set entrySet()
  {
    throw new UnsupportedOperationException("not implemented: entrySet");
  }
  
  public Collection values()
  {
    throw new UnsupportedOperationException("not implemented: values");
  }
  
  void debugDump(StringBuffer out)
  {
    if (out != null)
    {
      out.append(getClass().getName().concat("@").concat(Integer.toHexString(System.identityHashCode(this))));out.append(EOL);
      out.append("size = " + m_size + ", bucket table size = " + m_buckets.length + ", load factor = " + m_loadFactor + EOL);
      out.append("size threshold = " + m_sizeThreshold + ", get clear frequency = " + m_readClearCheckFrequency + ", put clear frequency = " + m_writeClearCheckFrequency + EOL);
      out.append("get count: " + m_readAccessCount + ", put count: " + m_writeAccessCount + EOL);
    }
  }
  
  static class IndexedSoftReference
    extends SoftReference
  {
    int m_bucketIndex;
    
    IndexedSoftReference(Object referent, ReferenceQueue queue, int bucketIndex)
    {
      super(queue);
      
      m_bucketIndex = bucketIndex;
    }
  }
  
  static class SoftEntry
  {
    SoftValueMap.IndexedSoftReference m_softValue;
    Object m_key;
    SoftEntry m_next;
    
    SoftEntry(ReferenceQueue valueReferenceQueue, Object key, Object value, SoftEntry next, int bucketIndex)
    {
      m_key = key;
      
      m_softValue = new SoftValueMap.IndexedSoftReference(value, valueReferenceQueue, bucketIndex);
      value = null;
      
      m_next = next;
    }
  }
  
  private void rehash()
  {
    SoftEntry[] buckets = m_buckets;
    
    int newBucketCount = (m_buckets.length << 1) + 1;
    SoftEntry[] newBuckets = new SoftEntry[newBucketCount];
    
    int newSize = 0;
    
    int b = 0;
    SoftEntry entry;
    for (int bLimit = buckets.length; b < bLimit; b++) {
      for (entry = buckets[b]; entry != null;)
      {
        SoftEntry next = m_next;
        
        IndexedSoftReference ref = m_softValue;
        
        Object entryValue = ref.get();
        if (entryValue != null)
        {
          int entryKeyHashCode = m_key.hashCode();
          int newBucketIndex = (entryKeyHashCode & 0x7FFFFFFF) % newBucketCount;
          
          SoftEntry bucketListHead = newBuckets[newBucketIndex];
          m_next = bucketListHead;
          newBuckets[newBucketIndex] = entry;
          
          m_bucketIndex = newBucketIndex;
          
          newSize++;
          
          entryValue = null;
        }
        else
        {
          m_bucketIndex = -1;
        }
        entry = next;
      }
    }
    m_size = newSize;
    m_sizeThreshold = ((int)(newBucketCount * m_loadFactor));
    m_buckets = newBuckets;
  }
  
  private void removeClearedValues()
  {
    int count = 0;
    Reference _ref;
    while ((_ref = m_valueReferenceQueue.poll()) != null)
    {
      int bucketIndex = m_bucketIndex;
      if (bucketIndex >= 0)
      {
        SoftEntry entry = m_buckets[bucketIndex];
        for (SoftEntry pre
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

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