More class library support for SPECjbb
authorjzhou <jzhou>
Sat, 12 Feb 2011 00:06:13 +0000 (00:06 +0000)
committerjzhou <jzhou>
Sat, 12 Feb 2011 00:06:13 +0000 (00:06 +0000)
46 files changed:
Robust/src/ClassLibrary/Enumeration.java
Robust/src/ClassLibrary/File.java
Robust/src/ClassLibrary/HashMap.java
Robust/src/ClassLibrary/MGC/Object.java
Robust/src/ClassLibrary/MGC/Runnable.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/Thread.java
Robust/src/ClassLibrary/MGC/gnu/ArrayList.java
Robust/src/ClassLibrary/MGC/gnu/BigDecimal.java
Robust/src/ClassLibrary/MGC/gnu/BigInteger.java
Robust/src/ClassLibrary/MGC/gnu/Boolean.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Calendar.java
Robust/src/ClassLibrary/MGC/gnu/Collections.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Date.java
Robust/src/ClassLibrary/MGC/gnu/Float.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Formatter.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/GregorianCalendar.java
Robust/src/ClassLibrary/MGC/gnu/Handler.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Level.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Locale.java
Robust/src/ClassLibrary/MGC/gnu/LogManager.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/LogRecord.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Logger.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Long.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/MPN.java
Robust/src/ClassLibrary/MGC/gnu/PrintStream.java
Robust/src/ClassLibrary/MGC/gnu/PrintWriter.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Properties.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Reader.java
Robust/src/ClassLibrary/MGC/gnu/Runtime.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Set.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Short.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/SimpleFormatter.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/SimpleTimeZone.java
Robust/src/ClassLibrary/MGC/gnu/StreamHandler.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/StringBuilder.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/Throwable.java
Robust/src/ClassLibrary/MGC/gnu/TimeZone.java
Robust/src/ClassLibrary/MGC/gnu/TreeMap.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/TreeMapIterator.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/TreeNode.java [new file with mode: 0644]
Robust/src/ClassLibrary/MGC/gnu/TreeSubMap.java [new file with mode: 0644]
Robust/src/ClassLibrary/Map.java [new file with mode: 0644]
Robust/src/ClassLibrary/Math.java
Robust/src/ClassLibrary/String.java
Robust/src/ClassLibrary/System.java
Robust/src/ClassLibrary/Vector.java

index 861196ea0f1b98e5ca4bd1f228a2e587e7c8413e..ac6124213663d341d0f53abf5434a557a7381436 100644 (file)
@@ -1,3 +1,12 @@
 public class Enumeration {
+  
+  public Enumeration(){}
 
+  public boolean hasMoreElements() {
+    return false;
+  }
+  
+  public Object nextElement() {
+    return null;
+  }
 }
index 87c3c5e126c44b6c5194c3804f87eb896260b332..a0de2367964bd3d7822567801ab60a405620fb2b 100644 (file)
@@ -1,5 +1,6 @@
 public class File {
   String path;
+  private static final char separator = '\n';
 
   public File(String path) {
     this.path=path;
index db028844a80aa36bad8a0228b02967e2147193f6..780159d9527fc3ffa1eb06a33006806912d06f90 100644 (file)
@@ -1,4 +1,4 @@
-public class HashMap {
+public class HashMap implements Map {
   HashEntry[] table;
   float loadFactor;
   int numItems;
@@ -56,8 +56,8 @@ public class HashMap {
   }
 
   /* 0=keys, 1=values */
-  public HashMapIterator iterator(int type) {
-    return new HashMapIterator(this, type);
+  public Iterator iterator(int type) {
+    return (Iterator)(new HashMapIterator(this, type));
   }
 
   Object remove(Object key) {
index 0fd6c15e94a951fe0207ce672572144fadfdf149..278d5c836e0fb67ff983fd45383d82412fbe7b9b 100644 (file)
@@ -34,5 +34,6 @@ public class Object {
     return false;
   }
   
-  //public final native Class getClass();
+  public final native void notify();
+  public final native void wait();
 }
diff --git a/Robust/src/ClassLibrary/MGC/Runnable.java b/Robust/src/ClassLibrary/MGC/Runnable.java
new file mode 100644 (file)
index 0000000..32c52b9
--- /dev/null
@@ -0,0 +1,62 @@
+/* Runnable -- interface for a method tied to an Object; often for Threads
+   Copyright (C) 1998, 1999, 2001, 2002, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang;
+
+/**
+ * Runnable is an interface you implement to indicate that your class can be
+ * executed as the main part of a Thread, among other places.  When you want
+ * an entry point to run a piece of code, implement this interface and
+ * override run.
+ *
+ * @author Paul Fisher
+ * @author Tom Tromey (tromey@cygnus.com)
+ * @see Thread
+ * @since 1.0
+ * @status updated to 1.4
+ */
+public interface Runnable
+{
+  /**
+   * This method will be called by whoever wishes to run your class
+   * implementing Runnable. Note that there are no restrictions on what
+   * you are allowed to do in the run method, except that you cannot
+   * throw a checked exception.
+   */
+  void run();
+}
index 50c5580f8f626db089f45c775e4c7eec5d45acbf..af67dbf7e8592b9670bec3a4126191a82c3ad60e 100644 (file)
@@ -1,5 +1,16 @@
-public class Thread {
+public class Thread implements Runnable {
   private boolean finished;
+  Runnable target;
+  
+  public Thread(){
+    finished = false;
+    target = null;
+  }
+  
+  public Thread(Runnable r) {
+    finished = false;
+    target = r;
+  }
 
   public void start() {
     nativeCreate();
@@ -20,6 +31,9 @@ public class Thread {
   public native static void sleep(long millis);
 
   public void run() {
+    if(target != null) {
+      target.run();
+    }
   }
 
   private native void nativeCreate();
index 4d17b61ff944d3d247c136dc72160e8d9e38ce77..607a40cc3786e340331cd4cb93373fb524f9934f 100644 (file)
@@ -85,6 +85,7 @@ import java.lang.reflect.Array;
 //  implements List<E>, RandomAccess, Cloneable, Serializable
 public class ArrayList
 {
+  protected transient int modCount;
   /**
    * Compatible with JDK 1.2
    */
@@ -241,27 +242,32 @@ public class ArrayList
         return i;
     return -1;
   }
+  
+  boolean equals(Object o1, Object o2)
+  {
+    return o1 == null ? o2 == null : o1.equals(o2);
+  }
 
   /**
    * Creates a shallow copy of this ArrayList (elements are not cloned).
    *
    * @return the cloned object
    */
-  public Object clone()
+  /*public Object clone()
   {
-    ArrayList/*<E>*/ clone = null;
-    //try
+    ArrayList<E> clone = null;
+    try
       {
-        //clone = (ArrayList<E>) super.clone();
-        clone = new ArrayList();
-        clone.data = /*(E[])*/ data.clone();
+        clone = (ArrayList<E>) super.clone();
+        //clone = new ArrayList();
+        clone.data = (E[]) data.clone();
       }
-    /*catch (CloneNotSupportedException e)
+    catch (CloneNotSupportedException e)
       {
         // Impossible to get here.
-      }*/
+      }
     return clone;
-  }
+  }*/
 
   /**
    * Returns an Object array containing all of the elements in this ArrayList.
@@ -394,7 +400,10 @@ public class ArrayList
       {
         modCount++;
         // Allow for garbage collection.
-        Arrays.fill(data, 0, size, null);
+        //Arrays.fill(data, 0, size, null);
+        for(int i = 0; i < size; i++) {
+          this.data[i] = null;
+        }
         size = 0;
       }
   }
index bc265e8d23715545240c1131f174d83010dea6cd..4e169ba1d106dff82afb7a3d2503aa27e1746c21 100644 (file)
@@ -361,10 +361,10 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
    * representation
    * @since 1.5
    */
-  public BigDecimal(char[] in)
+  /*public BigDecimal(char[] in)
   {
     this(in, 0, in.length);
-  }
+  }*/
   
   /**
    * Constructs a BigDecimal from a char subarray, accepting the same sequence
@@ -376,7 +376,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
    * BigDecimal representation.
    * @since 1.5
    */
-  public BigDecimal(char[] in, int offset, int len)
+  /*public BigDecimal(char[] in, int offset, int len)
   {
     //  start is the index into the char array where the significand starts
     int start = offset;
@@ -437,7 +437,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
           {
             // If dot != -1 then we've seen more than one decimal point.
             if (dot != -1)
-              throw new Error/*NumberFormatException*/("multiple `.'s in number");
+              throw new NumberFormatException("multiple `.'s in number");
             dot = point;
           }
         // Break when we reach the start of the exponent.
@@ -446,14 +446,14 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
         // Throw an exception if the character was not a decimal or an 
         // exponent and is not a digit.
         else if (!Character.isDigit(c))
-          throw new Error/*NumberFormatException*/("unrecognized character at " + point
+          throw new NumberFormatException("unrecognized character at " + point
                                           + ": " + c);
         ++point;
       }
 
     // val is a StringBuilder from which we'll create a BigInteger
     // which will be the unscaled value for this BigDecimal
-    CPStringBuilder val = new CPStringBuilder(point - start - 1);
+    String val = new CPStringBuilder(point - start - 1);
     if (dot != -1)
       {
         // If there was a decimal we must combine the two parts that 
@@ -470,12 +470,12 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
         scale = 0;
       }
     if (val.length() == 0)
-      throw new Error/*NumberFormatException*/("no digits seen");
+      throw new NumberFormatException("no digits seen");
 
     // Prepend a negative sign if necessary.
     if (negative)
       val.insert(0, '-');
-    intVal = new BigInteger(val.toString());
+    intVal = new BigInteger(val);
 
     // Now parse exponent.
     // If point < end that means we broke out of the previous loop when we
@@ -490,7 +490,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
         // Throw an exception if there were no digits found after the 'e'
         // or 'E'.
         if (point >= end)
-          throw new Error/*NumberFormatException*/("no exponent following e or E");
+          throw new NumberFormatException("no exponent following e or E");
 
         try
           {
@@ -499,12 +499,12 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
             // unscaledValue x Math.pow(10, -scale)
             scale -= Integer.parseInt(new String(in, point, end - point));
           }
-        catch (Error/*NumberFormatException*/ ex)
+        catch (NumberFormatException ex)
           {
-            throw new Error/*NumberFormatException*/("malformed exponent");
+            throw new NumberFormatException("malformed exponent");
           }
       }
-  }
+  }*/
   
   public BigDecimal (String num) //throws NumberFormatException 
   {
@@ -1354,7 +1354,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
     return toBigInteger().longValue();
   }
 
-  public float floatValue() 
+  /*public float floatValue() 
   {
     return Float.valueOf(toString()).floatValue();
   }
@@ -1362,7 +1362,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
   public double doubleValue() 
   {
     return Double.valueOf(toString()).doubleValue();
-  }
+  }*/
 
   public BigDecimal setScale (int scale) //throws ArithmeticException
   {
@@ -1436,7 +1436,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
   public BigDecimal pow(int n)
   {
     if (n < 0 || n > 999999999)
-      throw new Error/*ArithmeticException*/("n must be between 0 and 999999999");
+      throw new EArithmeticException("n must be between 0 and 999999999");
     BigDecimal result = new BigDecimal(intVal.pow(n), scale * n);
     return result;
   }
@@ -1495,7 +1495,7 @@ public class BigDecimal //extends Number implements Comparable<BigDecimal>
     BigInteger tempVal = temp.intVal;
     // Check for overflow.
     long result = intVal.longValue();
-    if (tempVal.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 1
+    if (tempVal.compareTo(BigInteger.valueOf(0x7fffffffffffffffL/*Long.MAX_VALUE*/)) > 1
         || (result < 0 && signum() == 1) || (result > 0 && signum() == -1))
       throw new Error/*ArithmeticException*/("this BigDecimal is too " +
             "large to fit into the return type");
index 4dd41faea7661e7ccec5787406b2e5c444d70037..f9762df363b8ded174fa903ab3adafba05d0f8d5 100644 (file)
@@ -153,7 +153,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
 
   /** HAC (Handbook of Applied Cryptography), Alfred Menezes & al. Table 4.4. */
   private static final int[] k =
-      {100,150,200,250,300,350,400,500,600,800,1250, Integer.MAX_VALUE};
+      {100,150,200,250,300,350,400,500,600,800,1250, 0x7fffffff/*Integer.MAX_VALUE*/};
   private static final int[] t =
       { 27, 18, 15, 12,  9,  8,  7,  6,  5,  4,   3, 2};
 
@@ -865,7 +865,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     if (x < 0)
       {
        xNegative = true;
-       if (x == Long.MIN_VALUE)
+       if (x == 0x8000000000000000L/*Long.MIN_VALUE*/)
          {
            divide(valueOf(x), valueOf(y),
                   quotient, remainder, rounding_mode);
@@ -879,7 +879,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     if (y < 0)
       {
        yNegative = true;
-       if (y == Long.MIN_VALUE)
+       if (y == 0x8000000000000000L/*Long.MIN_VALUE*/)
          {
            if (rounding_mode == TRUNCATE)
              { // x != Long.Min_VALUE implies abs(x) < abs(y)
@@ -966,7 +966,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
       {
        long x_l = x.longValue();
        long y_l = y.longValue();
-       if (x_l != Long.MIN_VALUE && y_l != Long.MIN_VALUE)
+       if (x_l != 0x8000000000000000L/*Long.MIN_VALUE*/ && y_l != 0x8000000000000000L/*Long.MIN_VALUE*/)
          {
            divide(x_l, y_l, quotient, remainder, rounding_mode);
            return;
@@ -1222,7 +1222,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
       {
        if (exponent == 0)
          return ONE;
-         throw new Error/*ArithmeticException*/("negative exponent");
+         throw new ArithmeticException("negative exponent");
       }
 
     /*if (USING_NATIVE)
@@ -1497,7 +1497,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
        if (xval == 0)
          return abs(y);
        if (y.words == null
-           && xval != Integer.MIN_VALUE && yval != Integer.MIN_VALUE)
+           && xval != 0x80000000/*Integer.MIN_VALUE*/ && yval != 0x80000000/*Integer.MIN_VALUE*/)
          {
            if (xval < 0)
              xval = -xval;
@@ -1929,10 +1929,10 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     return make(words, size);
   }
 
-  public double doubleValue()
+  /*public double doubleValue()
   {
-    /*if (USING_NATIVE)
-      return mpz.doubleValue();*/
+    if (USING_NATIVE)
+      return mpz.doubleValue();
 
     if (words == null)
       return (double) ival;
@@ -1941,12 +1941,12 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     if (isNegative())
       return neg(this).roundToDouble(0, true, false);
       return roundToDouble(0, false, false);
-  }
+  }*/
 
-  public float floatValue()
+  /*public float floatValue()
   {
     return (float) doubleValue();
-  }
+  }*/
 
   /** Return true if any of the lowest n bits are one.
    * (false if n is negative).  */
@@ -1971,7 +1971,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
    * @param remainder true if the BigInteger is the result of a truncating
    * division that had non-zero remainder.  To ensure proper rounding in
    * this case, the BigInteger must have at least 54 bits.  */
-  private double roundToDouble(int exp, boolean neg, boolean remainder)
+  /*private double roundToDouble(int exp, boolean neg, boolean remainder)
   {
     // Compute length.
     int il = bitLength();
@@ -2041,7 +2041,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     long bits_exp = (exp <= 0) ? 0 : ((long)exp) << 52;
     long bits_mant = m & ~(1L << 52);
     return Double.longBitsToDouble(bits_sign | bits_exp | bits_mant);
-  }
+  }*/
 
   /** Copy the abolute value of this into an array of words.
    * Assumes words.length >= (this.words == null ? 1 : this.ival).
@@ -2090,7 +2090,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
     int len = x.ival;
     if (x.words == null)
       {
-       if (len == Integer.MIN_VALUE)
+       if (len == 0x80000000/*Integer.MIN_VALUE*/)
          set(- (long) len);
        else
          set(-len);
@@ -2127,7 +2127,7 @@ public class BigInteger //extends Number implements Comparable<BigInteger>
 
   private static BigInteger neg(BigInteger x)
   {
-    if (x.words == null && x.ival != Integer.MIN_VALUE)
+    if (x.words == null && x.ival != 0x80000000/*Integer.MIN_VALUE*/)
       return valueOf(- x.ival);
     BigInteger result = new BigInteger(0);
     result.setNegative(x);
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Boolean.java b/Robust/src/ClassLibrary/MGC/gnu/Boolean.java
new file mode 100644 (file)
index 0000000..8244444
--- /dev/null
@@ -0,0 +1,248 @@
+/* Boolean.java -- object wrapper for boolean
+   Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+
+/**
+ * Instances of class <code>Boolean</code> represent primitive
+ * <code>boolean</code> values.
+ *
+ * @author Paul Fisher
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @since 1.0
+ * @status updated to 1.5
+ */
+public final class Boolean //implements Serializable, Comparable<Boolean>
+{
+  /**
+   * Compatible with JDK 1.0.2+.
+   */
+  private static final long serialVersionUID = -3665804199014368530L;
+
+  /**
+   * This field is a <code>Boolean</code> object representing the
+   * primitive value <code>true</code>. This instance is returned
+   * by the static <code>valueOf()</code> methods if they return
+   * a <code>Boolean</code> representing <code>true</code>.
+   */
+  public static final Boolean TRUE = new Boolean(true);
+
+  /**
+   * This field is a <code>Boolean</code> object representing the
+   * primitive value <code>false</code>. This instance is returned
+   * by the static <code>valueOf()</code> methods if they return
+   * a <code>Boolean</code> representing <code>false</code>.
+   */
+  public static final Boolean FALSE = new Boolean(false);
+
+  /**
+   * The primitive type <code>boolean</code> is represented by this
+   * <code>Class</code> object.
+   *
+   * @since 1.1
+   */
+  //public static final Class<Boolean> TYPE = (Class<Boolean>) VMClassLoader.getPrimitiveClass('Z');
+
+  /**
+   * The immutable value of this Boolean.
+   * @serial the wrapped value
+   */
+  private final boolean value;
+
+  /**
+   * Create a <code>Boolean</code> object representing the value of the
+   * argument <code>value</code>. In general the use of the static
+   * method <code>valueof(boolean)</code> is more efficient since it will
+   * not create a new object.
+   *
+   * @param value the primitive value of this <code>Boolean</code>
+   * @see #valueOf(boolean)
+   */
+  public Boolean(boolean value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Creates a <code>Boolean</code> object representing the primitive
+   * <code>true</code> if and only if <code>s</code> matches
+   * the string "true" ignoring case, otherwise the object will represent
+   * the primitive <code>false</code>. In general the use of the static
+   * method <code>valueof(String)</code> is more efficient since it will
+   * not create a new object.
+   *
+   * @param s the <code>String</code> representation of <code>true</code>
+   *        or false
+   */
+  public Boolean(String s)
+  {
+    value = "true".equals(s) || "TRUE".equals(s);
+  }
+
+  /**
+   * Return the primitive <code>boolean</code> value of this
+   * <code>Boolean</code> object.
+   *
+   * @return true or false, depending on the value of this Boolean
+   */
+  public boolean booleanValue()
+  {
+    return value;
+  }
+
+  /**
+   * Returns the Boolean <code>TRUE</code> if the given boolean is
+   * <code>true</code>, otherwise it will return the Boolean
+   * <code>FALSE</code>.
+   *
+   * @param b the boolean to wrap
+   * @return the wrapper object
+   * @see #TRUE
+   * @see #FALSE
+   * @since 1.4
+   */
+  public static Boolean valueOf(boolean b)
+  {
+    return b ? TRUE : FALSE;
+  }
+
+  /**
+   * Returns the Boolean <code>TRUE</code> if and only if the given
+   * String is equal, ignoring case, to the the String "true", otherwise
+   * it will return the Boolean <code>FALSE</code>.
+   *
+   * @param s the string to convert
+   * @return a wrapped boolean from the string
+   */
+  public static Boolean valueOf(String s)
+  {
+    return ("true".equals(s) || "TRUE".equals(s)) ? TRUE : FALSE;
+  }
+
+  /**
+   * Returns "true" if the value of the give boolean is <code>true</code> and
+   * returns "false" if the value of the given boolean is <code>false</code>.
+   *
+   * @param b the boolean to convert
+   * @return the string representation of the boolean
+   * @since 1.4
+   */
+  public static String toString(boolean b)
+  {
+    return b ? "true" : "false";
+  }
+
+  /**
+   * Returns "true" if the value of this object is <code>true</code> and
+   * returns "false" if the value of this object is <code>false</code>.
+   *
+   * @return the string representation of this
+   */
+  public String toString()
+  {
+    return value ? "true" : "false";
+  }
+
+  /**
+   * Returns the integer <code>1231</code> if this object represents
+   * the primitive <code>true</code> and the integer <code>1237</code>
+   * otherwise.
+   *
+   * @return the hash code
+   */
+  public int hashCode()
+  {
+    return value ? 1231 : 1237;
+  }
+
+  /**
+   * If the <code>obj</code> is an instance of <code>Boolean</code> and
+   * has the same primitive value as this object then <code>true</code>
+   * is returned.  In all other cases, including if the <code>obj</code>
+   * is <code>null</code>, <code>false</code> is returned.
+   *
+   * @param obj possibly an instance of any <code>Class</code>
+   * @return true if <code>obj</code> equals this
+   */
+  public boolean equals(Object obj)
+  {
+    return obj instanceof Boolean && value == ((Boolean) obj).value;
+  }
+
+  /**
+   * If the value of the system property <code>name</code> matches
+   * "true" ignoring case then the function returns <code>true</code>.
+   *
+   * @param name the property name to look up
+   * @return true if the property resulted in "true"
+   * @throws SecurityException if accessing the system property is forbidden
+   * @see System#getProperty(String)
+   */
+  public static boolean getBoolean(String name)
+  {
+    if (name == null || "".equals(name))
+      return false;
+    return "true".equals(name) || "TRUE".equals(name);
+  }
+
+  /**
+   * Compares this Boolean to another.
+   *
+   * @param other the Boolean to compare this Boolean to
+   * @return 0 if both Booleans represent the same value, a positive number 
+   * if this Boolean represents true and the other false, and a negative
+   * number otherwise.
+   * @since 1.5
+   */
+  public int compareTo(Boolean other)
+  {
+    return value == other.value ? 0 : (value ? 1 : -1);
+  }
+
+  /**
+   * If the String argument is "true", ignoring case, return true.
+   * Otherwise, return false.
+   *
+   * @param b String to parse
+   * @since 1.5
+   */
+  public static boolean parseBoolean(String b)
+  {
+    return ("true".equals(b) || "TRUE".equals(b))  ? true : false;
+  }
+  
+}
index 7dc6cf2391b97f8966ea0c6726b3d6b5ed651cbb..46d17b59770b55a35d25b76b5b047377047dbbe6 100644 (file)
@@ -512,10 +512,10 @@ public /*abstract*/ class Calendar
    * Constructs a new Calendar with the default time zone and the default
    * locale.
    */
-  protected Calendar()
+  /*protected Calendar()
   {
-    this(/*TimeZone.getDefault(), */Locale.getDefault());
-  }
+    this(TimeZone.getDefault(), Locale.getDefault());
+  }*/
 
   /**
    * Constructs a new Calendar with the given time zone and the given
@@ -523,34 +523,34 @@ public /*abstract*/ class Calendar
    * @param zone a time zone.
    * @param locale a locale.
    */
-  protected Calendar(/*TimeZone zone, */Locale locale)
+  protected Calendar(TimeZone zone, Locale locale)
   {
-    //this.zone = zone;
+    this.zone = zone;
     lenient = true;
     String[] days = { "", "sun", "mon", "tue", "wed", "thu", "fri", "sat" };
 
-    /*String country = locale.getCountry();
-    String min = properties.getProperty("minDays." + country);
-    if (min == null)
-      min = properties.getProperty("minDays.DEFAULT");
-    String first = properties.getProperty("firstDay." + country);
-    if (first == null)
-      first = properties.getProperty("firstDay.DEFAULT");
+    String country = locale.getCountry();
+    String min = "1";//properties.getProperty("minDays." + country);
+    /*if (min == null)
+      min = properties.getProperty("minDays.DEFAULT");*/
+    String first = "sun";//properties.getProperty("firstDay." + country);
+    /*if (first == null)
+      first = properties.getProperty("firstDay.DEFAULT");*/
     try
       {
        if (min != null)
          minimalDaysInFirstWeek = Integer.parseInt(min);
       }
-    catch (NumberFormatException ex)
+    catch (/*NumberFormat*/Exception ex)
       {
        minimalDaysInFirstWeek = 1;
-      }*/
+      }
 
     firstDayOfWeek = 1;
-    /*if (first != null)
+    if (first != null)
       for (int i = 0; i < 8; i++)
        if (days[i].equals(first))
-         firstDayOfWeek = i;*/
+         firstDayOfWeek = i;
 
     clear();
   }
@@ -563,7 +563,7 @@ public /*abstract*/ class Calendar
    */
   public static synchronized Calendar getInstance()
   {
-    return getInstance(/*TimeZone.getDefault(), */Locale.getDefault());
+    return new GregorianCalendar/*getInstance*/(TimeZone.getDefault(), Locale.getDefault());
   }
 
   /**
@@ -576,10 +576,10 @@ public /*abstract*/ class Calendar
    * 
    * @throws NullPointerException if <code>zone</code> is <code>null</code>.
    */
-  /*public static synchronized Calendar getInstance(TimeZone zone)
+  public static synchronized Calendar getInstance(TimeZone zone)
   {
-    return getInstance(zone, Locale.getDefault());
-  }*/
+    return new GregorianCalendar/*getInstance*/(zone, Locale.getDefault());
+  }
 
   /**
    * Creates a calendar representing the actual time, using the default
@@ -620,26 +620,26 @@ public /*abstract*/ class Calendar
    * @throws NullPointerException if <code>zone</code> or <code>locale</code>
    *     is <code>null</code>.
    */
-  public static synchronized Calendar getInstance(/*TimeZone zone, */Locale locale)
+  /*public static synchronized Calendar getInstance(TimeZone zone, Locale locale)
   {
     Class calendarClass = (Class)cache.get(locale);
-    //Throwable exception = null;
+    Throwable exception = null;
 
-    /*try
+    try
       {
        if (calendarClass == null)
          {
            calendarClass = Class.forName(calendarClassName);
            if (Calendar.class.isAssignableFrom(calendarClass))
              cache.put(locale, calendarClass);
-         }*/
+         }
 
        // GregorianCalendar is by far the most common case. Optimize by 
        // avoiding reflection.
-       //if (calendarClass == GregorianCalendar.class)
+       if (calendarClass == GregorianCalendar.class)
          return new GregorianCalendar(zone, locale);
 
-       /*if (Calendar.class.isAssignableFrom(calendarClass))
+       if (Calendar.class.isAssignableFrom(calendarClass))
          {
            Constructor ctor = calendarClass.getConstructor(ctorArgTypes);
            return (Calendar) ctor.newInstance(new Object[] { zone, locale });
@@ -667,8 +667,8 @@ public /*abstract*/ class Calendar
       }
 
     throw new RuntimeException("Error instantiating calendar for locale "
-                               + locale, exception);*/
-  }
+                               + locale, exception);
+  }*/
 
   /**
    * Gets the set of locales for which a Calendar is available.
@@ -725,12 +725,12 @@ public /*abstract*/ class Calendar
    * @return the time in milliseconds since the epoch.
    * @specnote This was made public in 1.4.
    */
-  /*public long getTimeInMillis()
+  public long getTimeInMillis()
   {
     if (! isTimeSet)
       computeTime();
     return time;
-  }*/
+  }
 
   /**
    * Sets this Calendar's time to the given Time.  All time fields
@@ -790,7 +790,7 @@ public /*abstract*/ class Calendar
    *         <= <code>FIELD_COUNT</code>.
    * @specnote Not final since JDK 1.4
    */
-  /*public void set(int field, int value)
+  public void set(int field, int value)
   {
     if (isTimeSet)
       for (int i = 0; i < FIELD_COUNT; i++)
@@ -881,7 +881,7 @@ public /*abstract*/ class Calendar
     // May have crossed over a DST boundary.
     if (! explicitDSTOffset && (field != DST_OFFSET && field != ZONE_OFFSET))
       isSet[DST_OFFSET] = false;
-  }*/
+  }
 
   /**
    * Sets the fields for year, month, and date
@@ -949,7 +949,7 @@ public /*abstract*/ class Calendar
   {
     isTimeSet = false;
     areFieldsSet = false;
-    int zoneOffs = 0;//zone.getRawOffset();
+    int zoneOffs = zone.getRawOffset();
     int[] tempFields = 
                        {
                          1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
@@ -972,7 +972,7 @@ public /*abstract*/ class Calendar
     int[] tempFields = 
                        {
                          1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
-                         0, 0, 0/*zone.getRawOffset()*/, 0
+                         0, 0, zone.getRawOffset(), 0
                        };
     complete();
     isTimeSet = false;
@@ -1144,10 +1144,10 @@ public /*abstract*/ class Calendar
    * Gets the time zone of this calendar
    * @return the current time zone.
    */
-  /*public TimeZone getTimeZone()
+  public TimeZone getTimeZone()
   {
     return zone;
-  }*/
+  }
 
   /**
    * Specifies if the date/time interpretation should be lenient.
@@ -1321,11 +1321,11 @@ public /*abstract*/ class Calendar
   /**
    * Return a clone of this object.
    */
-  public Object clone()
+  /*public Object clone()
   {
     try
       {
-       Calendar cal = (Calendar) super.clone();
+       Calendar cal = super.clone();
        cal.fields = (int[]) fields.clone();
        cal.isSet = (boolean[]) isSet.clone();
        return cal;
@@ -1334,7 +1334,7 @@ public /*abstract*/ class Calendar
       {
        return null;
       }
-  }
+  }*/
 
   private static final String[] fieldNames = 
                                              {
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Collections.java b/Robust/src/ClassLibrary/MGC/gnu/Collections.java
new file mode 100644 (file)
index 0000000..4ce8db7
--- /dev/null
@@ -0,0 +1,99 @@
+/* Collections.java -- Utility class with methods to operate on collections
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+/**
+ * Utility class consisting of static methods that operate on, or return
+ * Collections. Contains methods to sort, search, reverse, fill and shuffle
+ * Collections, methods to facilitate interoperability with legacy APIs that
+ * are unaware of collections, a method to return a list which consists of
+ * multiple copies of one element, and methods which "wrap" collections to give
+ * them extra properties, such as thread-safety and unmodifiability.
+ * <p>
+ *
+ * All methods which take a collection throw a {@link NullPointerException} if
+ * that collection is null. Algorithms which can change a collection may, but
+ * are not required, to throw the {@link UnsupportedOperationException} that
+ * the underlying collection would throw during an attempt at modification.
+ * For example,
+ * <code>Collections.singleton("").addAll(Collections.EMPTY_SET)</code>
+ * does not throw a exception, even though addAll is an unsupported operation
+ * on a singleton; the reason for this is that addAll did not attempt to
+ * modify the set.
+ *
+ * @author Original author unknown
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @see Collection
+ * @see Set
+ * @see List
+ * @see Map
+ * @see Arrays
+ * @since 1.2
+ * @status updated to 1.5
+ */
+public class Collections
+{
+  /**
+   * Sort a list according to the natural ordering of its elements. The list
+   * must be modifiable, but can be of fixed size. The sort algorithm is
+   * precisely that used by Arrays.sort(Object[]), which offers guaranteed
+   * nlog(n) performance. This implementation dumps the list into an array,
+   * sorts the array, and then iterates over the list setting each element from
+   * the array.
+   *
+   * @param l the List to sort (<code>null</code> not permitted)
+   * @throws ClassCastException if some items are not mutually comparable
+   * @throws UnsupportedOperationException if the List is not modifiable
+   * @throws NullPointerException if the list is <code>null</code>, or contains
+   *     some element that is <code>null</code>.
+   * @see Arrays#sort(Object[])
+   */
+  public static void sort(Vector l)
+  {
+    /*T[] a = (T[]) l.toArray();
+    Arrays.sort(a, c);
+    ListIterator<T> i = l.listIterator();
+    for (int pos = 0, alen = a.length;  pos < alen;  pos++)
+      {
+       i.next();
+       i.set(a[pos]);
+      }*/
+    System.println("Collections.sort() invoked");
+  }
+} // class Collections
index 801c3778ff36336b98d727ce23bec0d8a63c60f0..3069a1e7de48a12a600b6faa98ef5afa5e58b00e 100644 (file)
@@ -161,10 +161,10 @@ public class Date
    * @param month the month as a value between 0 and 11.
    * @param day the day as a value between 0 and 31.
    */
-  public Date(int year, int month, int day)
+  /*public Date(int year, int month, int day)
   {
     this(year, month, day, 0, 0, 0);
-  }
+  }*/
 
   /**
    * Creates a new Date Object representing the given time.
@@ -178,10 +178,10 @@ public class Date
    *        clock notation.
    * @param min the minute as a value between 0 and 59.
    */
-  public Date(int year, int month, int day, int hour, int min)
+  /*public Date(int year, int month, int day, int hour, int min)
   {
     this(year, month, day, hour, min, 0);
-  }
+  }*/
 
   /**
    * Creates a new Date Object representing the given time.
@@ -197,12 +197,12 @@ public class Date
    * @param sec the second as a value between 0 and 61 (with 60
    *        and 61 being leap seconds).
    */
-  public Date(int year, int month, int day, int hour, int min, int sec)
+  /*public Date(int year, int month, int day, int hour, int min, int sec)
   {
     GregorianCalendar cal =
        new GregorianCalendar(year + 1900, month, day, hour, min, sec);
     time = cal.getTimeInMillis();
-  }
+  }*/
 
   /**
    * Creates a new Date from the given string representation.  This
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Float.java b/Robust/src/ClassLibrary/MGC/gnu/Float.java
new file mode 100644 (file)
index 0000000..21d7e4d
--- /dev/null
@@ -0,0 +1,631 @@
+/* Float.java -- object wrapper for float
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+/**
+ * Instances of class <code>Float</code> represent primitive
+ * <code>float</code> values.
+ *
+ * Additionally, this class provides various helper functions and variables
+ * related to floats.
+ *
+ * @author Paul Fisher
+ * @author Andrew Haley (aph@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.0
+ * @status partly updated to 1.5
+ */
+public final class Float
+{
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = -2671257302660747028L;
+
+  /**
+   * The maximum positive value a <code>double</code> may represent
+   * is 3.4028235e+38f.
+   */
+  public static final float MAX_VALUE = 3.4028235e+38f;
+
+  /**
+   * The minimum positive value a <code>float</code> may represent
+   * is 1.4e-45.
+   */
+  public static final float MIN_VALUE = 1.4e-45f;
+
+  /**
+   * The value of a float representation -1.0/0.0, negative infinity.
+   */
+  public static final float NEGATIVE_INFINITY = -1.0f / 0.0f;
+
+  /**
+   * The value of a float representation 1.0/0.0, positive infinity.
+   */
+  public static final float POSITIVE_INFINITY = 1.0f / 0.0f;
+
+  /**
+   * All IEEE 754 values of NaN have the same value in Java.
+   */
+  public static final float NaN = 0.0f / 0.0f;
+
+  /**
+   * The primitive type <code>float</code> is represented by this
+   * <code>Class</code> object.
+   * @since 1.1
+   */
+  //public static final Class<Float> TYPE = (Class<Float>) VMClassLoader.getPrimitiveClass('F');
+
+  /**
+   * The number of bits needed to represent a <code>float</code>.
+   * @since 1.5
+   */
+  public static final int SIZE = 32;
+
+  /**
+   * Cache representation of 0
+   */
+  private static final Float ZERO = new Float(0.0f);
+
+  /**
+   * Cache representation of 1
+   */
+  private static final Float ONE = new Float(1.0f);
+
+  /**
+   * The immutable value of this Float.
+   *
+   * @serial the wrapped float
+   */
+  private final float value;
+
+  /**
+   * Create a <code>Float</code> from the primitive <code>float</code>
+   * specified.
+   *
+   * @param value the <code>float</code> argument
+   */
+  public Float(float value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Create a <code>Float</code> from the primitive <code>double</code>
+   * specified.
+   *
+   * @param value the <code>double</code> argument
+   */
+  public Float(double value)
+  {
+    this.value = (float) value;
+  }
+
+  /**
+   * Create a <code>Float</code> from the specified <code>String</code>.
+   * This method calls <code>Float.parseFloat()</code>.
+   *
+   * @param s the <code>String</code> to convert
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>float</code>
+   * @throws NullPointerException if <code>s</code> is null
+   * @see #parseFloat(String)
+   */
+  public Float(String s)
+  {
+    value = parseFloat(s);
+  }
+
+  /**
+   * Convert the <code>float</code> to a <code>String</code>.
+   * Floating-point string representation is fairly complex: here is a
+   * rundown of the possible values.  "<code>[-]</code>" indicates that a
+   * negative sign will be printed if the value (or exponent) is negative.
+   * "<code>&lt;number&gt;</code>" means a string of digits ('0' to '9').
+   * "<code>&lt;digit&gt;</code>" means a single digit ('0' to '9').<br>
+   *
+   * <table border=1>
+   * <tr><th>Value of Float</th><th>String Representation</th></tr>
+   * <tr><td>[+-] 0</td> <td><code>[-]0.0</code></td></tr>
+   * <tr><td>Between [+-] 10<sup>-3</sup> and 10<sup>7</sup>, exclusive</td>
+   *     <td><code>[-]number.number</code></td></tr>
+   * <tr><td>Other numeric value</td>
+   *     <td><code>[-]&lt;digit&gt;.&lt;number&gt;
+   *          E[-]&lt;number&gt;</code></td></tr>
+   * <tr><td>[+-] infinity</td> <td><code>[-]Infinity</code></td></tr>
+   * <tr><td>NaN</td> <td><code>NaN</code></td></tr>
+   * </table>
+   *
+   * Yes, negative zero <em>is</em> a possible value.  Note that there is
+   * <em>always</em> a <code>.</code> and at least one digit printed after
+   * it: even if the number is 3, it will be printed as <code>3.0</code>.
+   * After the ".", all digits will be printed except trailing zeros. The
+   * result is rounded to the shortest decimal number which will parse back
+   * to the same float.
+   *
+   * <p>To create other output formats, use {@link java.text.NumberFormat}.
+   *
+   * @XXX specify where we are not in accord with the spec.
+   *
+   * @param f the <code>float</code> to convert
+   * @return the <code>String</code> representing the <code>float</code>
+   */
+  /*public static String toString(float f)
+  {
+    return VMFloat.toString(f);
+  }*/
+
+  /**
+   * Convert a float value to a hexadecimal string.  This converts as
+   * follows:
+   * <ul>
+   * <li> A NaN value is converted to the string "NaN".
+   * <li> Positive infinity is converted to the string "Infinity".
+   * <li> Negative infinity is converted to the string "-Infinity".
+   * <li> For all other values, the first character of the result is '-'
+   * if the value is negative.  This is followed by '0x1.' if the
+   * value is normal, and '0x0.' if the value is denormal.  This is
+   * then followed by a (lower-case) hexadecimal representation of the
+   * mantissa, with leading zeros as required for denormal values.
+   * The next character is a 'p', and this is followed by a decimal
+   * representation of the unbiased exponent.
+   * </ul>
+   * @param f the float value
+   * @return the hexadecimal string representation
+   * @since 1.5
+   */
+  /*public static String toHexString(float f)
+  {
+    if (isNaN(f))
+      return "NaN";
+    if (isInfinite(f))
+      return f < 0 ? "-Infinity" : "Infinity";
+
+    int bits = floatToIntBits(f);
+    CPStringBuilder result = new CPStringBuilder();
+    
+    if (bits < 0)
+      result.append('-');
+    result.append("0x");
+
+    final int mantissaBits = 23;
+    final int exponentBits = 8;
+    int mantMask = (1 << mantissaBits) - 1;
+    int mantissa = bits & mantMask;
+    int expMask = (1 << exponentBits) - 1;
+    int exponent = (bits >>> mantissaBits) & expMask;
+
+    result.append(exponent == 0 ? '0' : '1');
+    result.append('.');
+    // For Float only, we have to adjust the mantissa.
+    mantissa <<= 1;
+    result.append(Integer.toHexString(mantissa));
+    if (exponent == 0 && mantissa != 0)
+      {
+        // Treat denormal specially by inserting '0's to make
+        // the length come out right.  The constants here are
+        // to account for things like the '0x'.
+        int offset = 4 + ((bits < 0) ? 1 : 0);
+        // The silly +3 is here to keep the code the same between
+        // the Float and Double cases.  In Float the value is
+        // not a multiple of 4.
+        int desiredLength = offset + (mantissaBits + 3) / 4;
+        while (result.length() < desiredLength)
+          result.insert(offset, '0');
+      }
+    result.append('p');
+    if (exponent == 0 && mantissa == 0)
+      {
+        // Zero, so do nothing special.
+      }
+    else
+      {
+        // Apply bias.
+        boolean denormal = exponent == 0;
+        exponent -= (1 << (exponentBits - 1)) - 1;
+        // Handle denormal.
+        if (denormal)
+          ++exponent;
+      }
+
+    result.append(Integer.toString(exponent));
+    return result.toString();
+  }*/
+
+  /**
+   * Creates a new <code>Float</code> object using the <code>String</code>.
+   *
+   * @param s the <code>String</code> to convert
+   * @return the new <code>Float</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>float</code>
+   * @throws NullPointerException if <code>s</code> is null
+   * @see #parseFloat(String)
+   */
+  public static Float valueOf(String s)
+  {
+    return valueOf(parseFloat(s));
+  }
+
+  /**
+   * Returns a <code>Float</code> object wrapping the value.
+   * In contrast to the <code>Float</code> constructor, this method
+   * may cache some values.  It is used by boxing conversion.
+   *
+   * @param val the value to wrap
+   * @return the <code>Float</code>
+   * @since 1.5
+   */
+  public static Float valueOf(float val)
+  {
+    if ((val == 0.0)/* && (floatToRawIntBits(val) == 0)*/)
+      return ZERO;
+    else if (val == 1.0)
+      return ONE;
+    else
+      return new Float(val);
+  }
+
+  /**
+   * Parse the specified <code>String</code> as a <code>float</code>. The
+   * extended BNF grammar is as follows:<br>
+   * <pre>
+   * <em>DecodableString</em>:
+   *      ( [ <code>-</code> | <code>+</code> ] <code>NaN</code> )
+   *    | ( [ <code>-</code> | <code>+</code> ] <code>Infinity</code> )
+   *    | ( [ <code>-</code> | <code>+</code> ] <em>FloatingPoint</em>
+   *              [ <code>f</code> | <code>F</code> | <code>d</code>
+   *                | <code>D</code>] )
+   * <em>FloatingPoint</em>:
+   *      ( { <em>Digit</em> }+ [ <code>.</code> { <em>Digit</em> } ]
+   *              [ <em>Exponent</em> ] )
+   *    | ( <code>.</code> { <em>Digit</em> }+ [ <em>Exponent</em> ] )
+   * <em>Exponent</em>:
+   *      ( ( <code>e</code> | <code>E</code> )
+   *              [ <code>-</code> | <code>+</code> ] { <em>Digit</em> }+ )
+   * <em>Digit</em>: <em><code>'0'</code> through <code>'9'</code></em>
+   * </pre>
+   *
+   * <p>NaN and infinity are special cases, to allow parsing of the output
+   * of toString.  Otherwise, the result is determined by calculating
+   * <em>n * 10<sup>exponent</sup></em> to infinite precision, then rounding
+   * to the nearest float. Remember that many numbers cannot be precisely
+   * represented in floating point. In case of overflow, infinity is used,
+   * and in case of underflow, signed zero is used. Unlike Integer.parseInt,
+   * this does not accept Unicode digits outside the ASCII range.
+   *
+   * <p>If an unexpected character is found in the <code>String</code>, a
+   * <code>NumberFormatException</code> will be thrown.  Leading and trailing
+   * 'whitespace' is ignored via <code>String.trim()</code>, but spaces
+   * internal to the actual number are not allowed.
+   *
+   * <p>To parse numbers according to another format, consider using
+   * {@link java.text.NumberFormat}.
+   *
+   * @XXX specify where/how we are not in accord with the spec.
+   *
+   * @param str the <code>String</code> to convert
+   * @return the <code>float</code> value of <code>s</code>
+   * @throws NumberFormatException if <code>str</code> cannot be parsed as a
+   *         <code>float</code>
+   * @throws NullPointerException if <code>str</code> is null
+   * @see #MIN_VALUE
+   * @see #MAX_VALUE
+   * @see #POSITIVE_INFINITY
+   * @see #NEGATIVE_INFINITY
+   * @since 1.2
+   */
+  public static float parseFloat(String str)
+  {
+    //return VMFloat.parseFloat(str);
+    System.println("Float.parseFloat(String) invoked");
+    return 1.0f;
+  }
+
+  /**
+   * Return <code>true</code> if the <code>float</code> has the same
+   * value as <code>NaN</code>, otherwise return <code>false</code>.
+   *
+   * @param v the <code>float</code> to compare
+   * @return whether the argument is <code>NaN</code>
+   */
+  public static boolean isNaN(float v)
+  {
+    // This works since NaN != NaN is the only reflexive inequality
+    // comparison which returns true.
+    return v != v;
+  }
+
+  /**
+   * Return <code>true</code> if the <code>float</code> has a value
+   * equal to either <code>NEGATIVE_INFINITY</code> or
+   * <code>POSITIVE_INFINITY</code>, otherwise return <code>false</code>.
+   *
+   * @param v the <code>float</code> to compare
+   * @return whether the argument is (-/+) infinity
+   */
+  public static boolean isInfinite(float v)
+  {
+    return v == POSITIVE_INFINITY || v == NEGATIVE_INFINITY;
+  }
+
+  /**
+   * Return <code>true</code> if the value of this <code>Float</code>
+   * is the same as <code>NaN</code>, otherwise return <code>false</code>.
+   *
+   * @return whether this <code>Float</code> is <code>NaN</code>
+   */
+  public boolean isNaN()
+  {
+    return isNaN(value);
+  }
+
+  /**
+   * Return <code>true</code> if the value of this <code>Float</code>
+   * is the same as <code>NEGATIVE_INFINITY</code> or
+   * <code>POSITIVE_INFINITY</code>, otherwise return <code>false</code>.
+   *
+   * @return whether this <code>Float</code> is (-/+) infinity
+   */
+  public boolean isInfinite()
+  {
+    return isInfinite(value);
+  }
+
+  /**
+   * Convert the <code>float</code> value of this <code>Float</code>
+   * to a <code>String</code>.  This method calls
+   * <code>Float.toString(float)</code> to do its dirty work.
+   *
+   * @return the <code>String</code> representation
+   * @see #toString(float)
+   */
+  /*public String toString()
+  {
+    return toString(value);
+  }*/
+
+  /**
+   * Return the value of this <code>Float</code> as a <code>byte</code>.
+   *
+   * @return the byte value
+   * @since 1.1
+   */
+  public byte byteValue()
+  {
+    return (byte) value;
+  }
+
+  /**
+   * Return the value of this <code>Float</code> as a <code>short</code>.
+   *
+   * @return the short value
+   * @since 1.1
+   */
+  public short shortValue()
+  {
+    return (short) value;
+  }
+
+  /**
+   * Return the value of this <code>Integer</code> as an <code>int</code>.
+   *
+   * @return the int value
+   */
+  public int intValue()
+  {
+    return (int) value;
+  }
+
+  /**
+   * Return the value of this <code>Integer</code> as a <code>long</code>.
+   *
+   * @return the long value
+   */
+  public long longValue()
+  {
+    return (long) value;
+  }
+
+  /**
+   * Return the value of this <code>Float</code>.
+   *
+   * @return the float value
+   */
+  public float floatValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Float</code> as a <code>double</code>
+   *
+   * @return the double value
+   */
+  public double doubleValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return a hashcode representing this Object. <code>Float</code>'s hash
+   * code is calculated by calling <code>floatToIntBits(floatValue())</code>.
+   *
+   * @return this Object's hash code
+   * @see #floatToIntBits(float)
+   */
+  /*public int hashCode()
+  {
+    return floatToIntBits(value);
+  }*/
+
+  /**
+   * Returns <code>true</code> if <code>obj</code> is an instance of
+   * <code>Float</code> and represents the same float value. Unlike comparing
+   * two floats with <code>==</code>, this treats two instances of
+   * <code>Float.NaN</code> as equal, but treats <code>0.0</code> and
+   * <code>-0.0</code> as unequal.
+   *
+   * <p>Note that <code>f1.equals(f2)</code> is identical to
+   * <code>floatToIntBits(f1.floatValue()) ==
+   *    floatToIntBits(f2.floatValue())</code>.
+   *
+   * @param obj the object to compare
+   * @return whether the objects are semantically equal
+   */
+  /*public boolean equals(Object obj)
+  {
+    if (obj instanceof Float)
+      {
+        float f = ((Float) obj).value;
+        return (floatToRawIntBits(value) == floatToRawIntBits(f)) ||
+          (isNaN(value) && isNaN(f));
+      }
+    return false;
+  }*/
+
+  /**
+   * Convert the float to the IEEE 754 floating-point "single format" bit
+   * layout. Bit 31 (the most significant) is the sign bit, bits 30-23
+   * (masked by 0x7f800000) represent the exponent, and bits 22-0
+   * (masked by 0x007fffff) are the mantissa. This function collapses all
+   * versions of NaN to 0x7fc00000. The result of this function can be used
+   * as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the
+   * original <code>float</code> value.
+   *
+   * @param value the <code>float</code> to convert
+   * @return the bits of the <code>float</code>
+   * @see #intBitsToFloat(int)
+   */
+  /*public static int floatToIntBits(float value)
+  {
+    if (isNaN(value))
+      return 0x7fc00000;
+    else
+      return VMFloat.floatToRawIntBits(value);
+  }*/
+
+  /**
+   * Convert the float to the IEEE 754 floating-point "single format" bit
+   * layout. Bit 31 (the most significant) is the sign bit, bits 30-23
+   * (masked by 0x7f800000) represent the exponent, and bits 22-0
+   * (masked by 0x007fffff) are the mantissa. This function leaves NaN alone,
+   * rather than collapsing to a canonical value. The result of this function
+   * can be used as the argument to <code>Float.intBitsToFloat(int)</code> to
+   * obtain the original <code>float</code> value.
+   *
+   * @param value the <code>float</code> to convert
+   * @return the bits of the <code>float</code>
+   * @see #intBitsToFloat(int)
+   */
+  /*public static int floatToRawIntBits(float value)
+  {
+    return VMFloat.floatToRawIntBits(value);
+  }*/
+
+  /**
+   * Convert the argument in IEEE 754 floating-point "single format" bit
+   * layout to the corresponding float. Bit 31 (the most significant) is the
+   * sign bit, bits 30-23 (masked by 0x7f800000) represent the exponent, and
+   * bits 22-0 (masked by 0x007fffff) are the mantissa. This function leaves
+   * NaN alone, so that you can recover the bit pattern with
+   * <code>Float.floatToRawIntBits(float)</code>.
+   *
+   * @param bits the bits to convert
+   * @return the <code>float</code> represented by the bits
+   * @see #floatToIntBits(float)
+   * @see #floatToRawIntBits(float)
+   */
+  /*public static float intBitsToFloat(int bits)
+  {
+    return VMFloat.intBitsToFloat(bits);
+  }*/
+
+  /**
+   * Compare two Floats numerically by comparing their <code>float</code>
+   * values. The result is positive if the first is greater, negative if the
+   * second is greater, and 0 if the two are equal. However, this special
+   * cases NaN and signed zero as follows: NaN is considered greater than
+   * all other floats, including <code>POSITIVE_INFINITY</code>, and positive
+   * zero is considered greater than negative zero.
+   *
+   * @param f the Float to compare
+   * @return the comparison
+   * @since 1.2
+   */
+  /*public int compareTo(Float f)
+  {
+    return compare(value, f.value);
+  }*/
+
+  /**
+   * Behaves like <code>new Float(x).compareTo(new Float(y))</code>; in
+   * other words this compares two floats, special casing NaN and zero,
+   * without the overhead of objects.
+   *
+   * @param x the first float to compare
+   * @param y the second float to compare
+   * @return the comparison
+   * @since 1.4
+   */
+  /*public static int compare(float x, float y)
+  {
+      // handle the easy cases:
+      if (x < y)
+         return -1;
+      if (x > y)
+         return 1;
+
+      // handle equality respecting that 0.0 != -0.0 (hence not using x == y):
+      int ix = floatToRawIntBits(x);
+      int iy = floatToRawIntBits(y);
+      if (ix == iy)
+         return 0;
+
+      // handle NaNs:
+      if (x != x)
+         return (y != y) ? 0 : 1;
+      else if (y != y)
+         return -1;
+
+      // handle +/- 0.0
+      return (ix < iy) ? -1 : 1;
+  }*/
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Formatter.java b/Robust/src/ClassLibrary/MGC/gnu/Formatter.java
new file mode 100644 (file)
index 0000000..c9ebd0d
--- /dev/null
@@ -0,0 +1,168 @@
+/* Formatter.java --
+   A class for formatting log messages by localizing message texts
+   and performing substitution of parameters
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/**
+ * A <code>Formatter</code> supports handlers by localizing
+ * message texts and by subsituting parameter values for their
+ * placeholders.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public abstract class Formatter
+{
+  /**
+   * Constructs a new Formatter.
+   */
+  protected Formatter()
+  {
+  }
+
+
+  /**
+   * Formats a LogRecord into a string.  Usually called by handlers
+   * which need a string for a log record, for example to append
+   * a record to a log file or to transmit a record over the network.
+   *
+   * @param record the log record for which a string form is requested.
+   */
+  public abstract String format(LogRecord record);
+
+
+  /**
+   * Returns a string that handlers are supposed to emit before
+   * the first log record.  The base implementation returns an
+   * empty string, but subclasses such as {@link XMLFormatter}
+   * override this method in order to provide a suitable header.
+   *
+   * @return a string for the header.
+   *
+   * @param handler the handler which will prepend the returned
+   *     string in front of the first log record.  This method
+   *     may inspect certain properties of the handler, for
+   *     example its encoding, in order to construct the header.
+   */
+  public String getHead(Handler handler)
+  {
+    return "";
+  }
+
+
+  /**
+   * Returns a string that handlers are supposed to emit after
+   * the last log record.  The base implementation returns an
+   * empty string, but subclasses such as {@link XMLFormatter}
+   * override this method in order to provide a suitable tail.
+   *
+   * @return a string for the header.
+   *
+   * @param handler the handler which will append the returned
+   *     string after the last log record.  This method
+   *     may inspect certain properties of the handler
+   *     in order to construct the tail.
+   */
+  public String getTail(Handler handler)
+  {
+    return "";
+  }
+
+
+  /**
+   * Formats the message part of a log record.
+   *
+   * <p>First, the Formatter localizes the record message to the
+   * default locale by looking up the message in the record's
+   * localization resource bundle.  If this step fails because there
+   * is no resource bundle associated with the record, or because the
+   * record message is not a key in the bundle, the raw message is
+   * used instead.
+   *
+   * <p>Second, the Formatter substitutes appropriate strings for
+   * the message parameters. If the record returns a non-empty
+   * array for <code>getParameters()</code> and the localized
+   * message string contains the character sequence "{0", the
+   * formatter uses <code>java.text.MessageFormat</code> to format
+   * the message.  Otherwise, no parameter substitution is performed.
+   *
+   * @param record the log record to be localized and formatted.
+   *
+   * @return the localized message text where parameters have been
+   *         substituted by suitable strings.
+   *
+   * @throws NullPointerException if <code>record</code>
+   *         is <code>null</code>.
+   */
+  /*public String formatMessage(LogRecord record)
+  {
+    String          msg;
+    ResourceBundle  bundle;
+    Object[]        params;
+
+    /* This will throw a NullPointerExceptionif record is null. */
+    /*msg = record.getMessage();
+    if (msg == null)
+      msg = "";
+
+    /* Try to localize the message. */
+    /*bundle = record.getResourceBundle();
+    if (bundle != null)
+    {
+      try
+      {
+       msg = bundle.getString(msg);
+      }
+      catch (java.util.MissingResourceException _)
+      {
+      }
+    }
+
+    /* Format the message if there are parameters. */
+    /*params = record.getParameters();
+    if ((params != null)
+       && (params.length > 0)
+       && (msg.indexOf("{0") >= 0))
+    {
+      msg = MessageFormat.format(msg, params);
+    }
+
+    return msg;
+  }*/
+}
index ebad05888c8b8b6da174f36c3349db3ef47826bb..f7848515bacaa0baef053a8e90e68efb393b970e 100644 (file)
@@ -154,7 +154,7 @@ public class GregorianCalendar extends Calendar
    */
   private long gregorianCutover = (new Date((24 * 60 * 60 * 1000L) * (((1582 * (365 * 4
                                             + 1)) / 4
-                                            + (java.util.Calendar.OCTOBER * (31
+                                            + (/*java.util.*/Calendar.OCTOBER * (31
                                             + 30 + 31 + 30 + 31) - 9) / 5 + 5)
                                             - ((1970 * (365 * 4 + 1)) / 4 + 1
                                             - 13)))).getTime();
@@ -187,7 +187,7 @@ public class GregorianCalendar extends Calendar
    */
   public GregorianCalendar()
   {
-    this(/*TimeZone.getDefault(), */Locale.getDefault());
+    this(TimeZone.getDefault(), Locale.getDefault());
   }
 
   /**
@@ -207,10 +207,10 @@ public class GregorianCalendar extends Calendar
    *
    * @param locale a locale.
    */
-  public GregorianCalendar(Locale locale)
+  /*public GregorianCalendar(Locale locale)
   {
-    this(/*TimeZone.getDefault(), */locale);
-  }
+    this(TimeZone.getDefault(), locale);
+  }*/
 
   /**
    * Constructs a new GregorianCalender representing the current
@@ -219,11 +219,11 @@ public class GregorianCalendar extends Calendar
    * @param zone a time zone.
    * @param locale a locale.
    */
-  /*public GregorianCalendar(TimeZone zone, Locale locale)
+  public GregorianCalendar(TimeZone zone, Locale locale)
   {
     this(zone, locale, false);
     setTimeInMillis(System.currentTimeMillis());
-  }*/
+  }
 
   /**
    * Common constructor that all constructors should call.
@@ -232,9 +232,9 @@ public class GregorianCalendar extends Calendar
    * @param unused unused parameter to make the signature differ from
    * the public constructor (TimeZone, Locale).
    */
-  private GregorianCalendar(/*TimeZone zone, */Locale locale, boolean unused)
+  private GregorianCalendar(TimeZone zone, Locale locale, boolean unused)
   {
-    super(/*zone, */locale);
+    super(zone, locale);
   }
 
   /**
@@ -245,11 +245,11 @@ public class GregorianCalendar extends Calendar
    * @param month corresponds to the MONTH time field.
    * @param day corresponds to the DAY time field.
    */
-  public GregorianCalendar(int year, int month, int day)
+  /*public GregorianCalendar(int year, int month, int day)
   {
-    this(/*TimeZone.getDefault(), */Locale.getDefault(), false);
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
     set(year, month, day);
-  }
+  }*/
 
   /**
    * Constructs a new GregorianCalendar representing midnight on the
@@ -261,11 +261,11 @@ public class GregorianCalendar extends Calendar
    * @param hour corresponds to the HOUR_OF_DAY time field.
    * @param minute corresponds to the MINUTE time field.
    */
-  public GregorianCalendar(int year, int month, int day, int hour, int minute)
+  /*public GregorianCalendar(int year, int month, int day, int hour, int minute)
   {
-    this(/*TimeZone.getDefault(), */Locale.getDefault(), false);
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
     set(year, month, day, hour, minute);
-  }
+  }*/
 
   /**
    * Constructs a new GregorianCalendar representing midnight on the
@@ -278,12 +278,12 @@ public class GregorianCalendar extends Calendar
    * @param minute corresponds to the MINUTE time field.
    * @param second corresponds to the SECOND time field.
    */
-  public GregorianCalendar(int year, int month, int day, int hour, int minute,
+  /*public GregorianCalendar(int year, int month, int day, int hour, int minute,
                            int second)
   {
-    this(/*TimeZone.getDefault(), */Locale.getDefault(), false);
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
     set(year, month, day, hour, minute, second);
-  }
+  }*/
 
   /**
    * Sets the date of the switch from Julian dates to Gregorian dates.
@@ -614,7 +614,7 @@ public class GregorianCalendar extends Calendar
     // Calculate number of milliseconds into the day
     // This takes care of both h, m, s, ms over/underflows.
     long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis;
-    day += allMillis / (24 * 60 * 60 * 1000L);
+    day += (int)(allMillis / (24 * 60 * 60 * 1000L));
     millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L));
 
     if (month < 0)
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Handler.java b/Robust/src/ClassLibrary/MGC/gnu/Handler.java
new file mode 100644 (file)
index 0000000..09d5a8e
--- /dev/null
@@ -0,0 +1,384 @@
+/* Handler.java -- a class for publishing log messages
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/**
+ * A <code>Handler</code> publishes <code>LogRecords</code> to
+ * a sink, for example a file, the console or a network socket.
+ * There are different subclasses of <code>Handler</code>
+ * to deal with different kinds of sinks.
+ *
+ * <p>FIXME: Are handlers thread-safe, or is the assumption that only
+ * loggers are, and a handler can belong only to one single logger? If
+ * the latter, should we enforce it? (Spec not clear). In any
+ * case, it needs documentation.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public abstract class Handler
+{
+  Formatter     formatter;
+  //Filter        filter;
+  Level         level;
+  //ErrorManager  errorManager;
+  //String        encoding;
+
+  /**
+   * Constructs a Handler with a logging severity level of
+   * <code>Level.ALL</code>, no formatter, no filter, and
+   * an instance of <code>ErrorManager</code> managing errors.
+   *
+   * <p><strong>Specification Note:</strong> The specification of the
+   * Java<sup>TM</sup> Logging API does not mention which character
+   * encoding is to be used by freshly constructed Handlers.  The GNU
+   * implementation uses the default platform encoding, but other
+   * Java implementations might behave differently.
+   *
+   * <p><strong>Specification Note:</strong> While a freshly constructed
+   * Handler is required to have <em>no filter</em> according to the
+   * specification, <code>null</code> is not a valid parameter for
+   * <code>Handler.setFormatter</code>.  Therefore, the following
+   * code will throw a <code>java.lang.NullPointerException</code>:
+   *
+   * <p><pre>Handler h = new MyConcreteSubclassOfHandler();
+h.setFormatter(h.getFormatter());</pre>
+   *
+   * It seems strange that a freshly constructed Handler is not
+   * supposed to provide a Formatter, but this is what the specification
+   * says.
+   */
+  protected Handler()
+  {
+    level = Level.ALL;
+  }
+
+
+  /**
+   * Publishes a <code>LogRecord</code> to an appropriate sink,
+   * provided the record passes all tests for being loggable.  The
+   * <code>Handler</code> will localize the message of the log
+   * record and substitute any message parameters.
+   *
+   * <p>Most applications do not need to call this method directly.
+   * Instead, they will use use a {@link Logger}, which will
+   * create LogRecords and distribute them to registered handlers.
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.
+   *
+   * @param record the log event to be published.
+   */
+  //public abstract void publish(LogRecord record);
+
+
+  /**
+   * Forces any data that may have been buffered to the underlying
+   * output device.
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.
+   */
+  //public abstract void flush();
+
+
+  /**
+   * Closes this <code>Handler</code> after having flushed
+   * the buffers.  As soon as <code>close</code> has been called,
+   * a <code>Handler</code> should not be used anymore. Attempts
+   * to publish log records, to flush buffers, or to modify the
+   * <code>Handler</code> in any other way may throw runtime
+   * exceptions after calling <code>close</code>.
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   */
+  //public abstract void close()
+  //  throws SecurityException;
+
+
+  /**
+   * Returns the <code>Formatter</code> which will be used to
+   * localize the text of log messages and to substitute
+   * message parameters.  A <code>Handler</code> is encouraged,
+   * but not required to actually use an assigned
+   * <code>Formatter</code>.
+   *
+   * @return the <code>Formatter</code> being used, or
+   *         <code>null</code> if this <code>Handler</code>
+   *         does not use formatters and no formatter has
+   *         ever been set by calling <code>setFormatter</code>.
+   */
+  public Formatter getFormatter()
+  {
+    return formatter;
+  }
+
+
+  /**
+   * Sets the <code>Formatter</code> which will be used to
+   * localize the text of log messages and to substitute
+   * message parameters.  A <code>Handler</code> is encouraged,
+   * but not required to actually use an assigned
+   * <code>Formatter</code>.
+   *
+   * @param formatter the new <code>Formatter</code> to use.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   *
+   * @throws NullPointerException if <code>formatter</code> is
+   *         <code>null</code>.
+   */
+  public void setFormatter(Formatter formatter)
+    //throws SecurityException
+  {
+    //LogManager.getLogManager().checkAccess();
+    
+    /* Throws a NullPointerException if formatter is null. */
+    //formatter.getClass();
+
+    this.formatter = formatter;
+  }
+
+
+  /**
+   * Returns the character encoding which this handler uses for publishing
+   * log records.
+   *
+   * @return the name of a character encoding, or <code>null</code>
+   *         for the default platform encoding.
+   */
+  /*public String getEncoding()
+  {
+    return encoding;
+  }*/
+
+
+  /**
+   * Sets the character encoding which this handler uses for publishing
+   * log records.  The encoding of a <code>Handler</code> must be
+   * set before any log records have been published.
+   *
+   * @param encoding the name of a character encoding, or <code>null</code>
+   *            for the default encoding.
+   *
+   * @exception SecurityException if a security manager exists and
+   *            the caller is not granted the permission to control
+   *            the logging infrastructure.
+   *
+   */
+  /*public void setEncoding(String encoding)
+    throws SecurityException, UnsupportedEncodingException
+  {
+    /* Should any developer ever change this implementation, they are
+     * advised to have a look at StreamHandler.setEncoding(String),
+     * which overrides this method without calling super.setEncoding.
+     */
+    //LogManager.getLogManager().checkAccess();
+
+    /* Simple check for supported encodings. This is more expensive
+     * than it could be, but this method is overwritten by StreamHandler
+     * anyway.
+     */
+    /*if (encoding != null)
+      new String(new byte[0], encoding);
+
+    this.encoding = encoding;
+  }*/
+
+
+  /**
+   * Returns the <code>Filter</code> that currently controls which
+   * log records are being published by this <code>Handler</code>.
+   *
+   * @return the currently active <code>Filter</code>, or
+   *         <code>null</code> if no filter has been associated.
+   *         In the latter case, log records are filtered purely
+   *         based on their severity level.
+   */
+  /*public Filter getFilter()
+  {
+    return filter;
+  }*/
+
+
+  /**
+   * Sets the <code>Filter</code> for controlling which
+   * log records will be published by this <code>Handler</code>.
+   *
+   * @param filter the <code>Filter</code> to use, or
+   *         <code>null</code> to filter log records purely based
+   *         on their severity level.
+   */
+  /*public void setFilter(Filter filter)
+    throws SecurityException
+  {
+    LogManager.getLogManager().checkAccess();
+    this.filter = filter;
+  }*/
+
+
+  /**
+   * Returns the <code>ErrorManager</code> that currently deals
+   * with errors originating from this Handler.
+   *
+   * @exception SecurityException if a security manager exists and
+   *            the caller is not granted the permission to control
+   *            the logging infrastructure.
+   */
+  /*public ErrorManager getErrorManager()
+  {
+    LogManager.getLogManager().checkAccess();
+
+    /* Developers wanting to change the subsequent code should
+     * have a look at Handler.reportError -- it also can create
+     * an ErrorManager, but does so without checking permissions
+     * to control the logging infrastructure.
+     */
+    /*if (errorManager == null)
+      errorManager = new ErrorManager();
+
+    return errorManager;
+  }*/
+
+
+  /*public void setErrorManager(ErrorManager manager)
+  {
+    LogManager.getLogManager().checkAccess();
+
+    /* Make sure manager is not null. */
+    /*manager.getClass();
+
+    this.errorManager = manager;
+  }*/
+
+
+  /*protected void reportError(String message, Exception ex, int code)
+  {
+    if (errorManager == null)
+      errorManager = new ErrorManager();
+
+    errorManager.error(message, ex, code);
+  }*/
+
+
+  /**
+   * Returns the severity level threshold for this <code>Handler</code>
+   * All log records with a lower severity level will be discarded;
+   * a log record of the same or a higher level will be published
+   * unless an installed <code>Filter</code> decides to discard it.
+   *
+   * @return the severity level below which all log messages
+   *         will be discarded.
+   */
+  public Level getLevel()
+  {
+    return level;
+  }
+
+
+  /**
+   * Sets the severity level threshold for this <code>Handler</code>.
+   * All log records with a lower severity level will be discarded;
+   * a log record of the same or a higher level will be published
+   * unless an installed <code>Filter</code> decides to discard it.
+   *
+   * @param level the severity level below which all log messages
+   *              will be discarded.
+   *
+   * @exception SecurityException if a security manager exists and
+   *            the caller is not granted the permission to control
+   *            the logging infrastructure.
+   *
+   * @exception NullPointerException if <code>level</code> is
+   *            <code>null</code>.
+   */
+  public void setLevel(Level level)
+  {
+    //LogManager.getLogManager().checkAccess();
+
+    /* Throw NullPointerException if level is null.  */
+    //level.getClass();
+    this.level = level;
+  }
+
+
+  /**
+   * Checks whether a <code>LogRecord</code> would be logged
+   * if it was passed to this <code>Handler</code> for publication.
+   *
+   * <p>The <code>Handler</code> implementation considers a record as
+   * loggable if its level is greater than or equal to the severity
+   * level threshold.  In a second step, if a {@link Filter} has
+   * been installed, its {@link Filter#isLoggable(LogRecord) isLoggable}
+   * method is invoked. Subclasses of <code>Handler</code> can override
+   * this method to impose their own constraints.
+   *
+   * @param record the <code>LogRecord</code> to be checked.
+   *
+   * @return <code>true</code> if <code>record</code> would
+   *         be published by {@link #publish(LogRecord) publish},
+   *         <code>false</code> if it would be discarded.
+   *
+   * @see #setLevel(Level)
+   * @see #setFilter(Filter)
+   * @see Filter#isLoggable(LogRecord)
+   *
+   * @throws NullPointerException if <code>record</code>
+   *         is <code>null</code>.
+   */
+  public boolean isLoggable(LogRecord record)
+  {
+    if (record.getLevel().intValue() < level.intValue())
+      return false;
+    
+    /*if (filter != null)
+      return filter.isLoggable(record);
+    else*/
+      return true;
+  }
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Level.java b/Robust/src/ClassLibrary/MGC/gnu/Level.java
new file mode 100644 (file)
index 0000000..70cf86e
--- /dev/null
@@ -0,0 +1,417 @@
+/* Level.java -- a class for indicating logging levels
+   Copyright (C) 2002, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/**import java.io.Serializable;
+import java.util.ResourceBundle;*/
+
+/**
+ * A class for indicating logging levels.  A number of commonly used
+ * levels is pre-defined (such as <code>java.util.logging.Level.INFO</code>),
+ * and applications should utilize those whenever possible.  For specialized
+ * purposes, however, applications can sub-class Level in order to define
+ * custom logging levels.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class Level //implements Serializable
+{
+  /* The integer values are the same as in the Sun J2SE 1.4.
+   * They have been obtained with a test program. In J2SE 1.4.1,
+   * Sun has amended the API documentation; these values are now
+   * publicly documented.
+   */
+
+  /**
+   * The <code>OFF</code> level is used as a threshold for filtering
+   * log records, meaning that no message should be logged.
+   *
+   * @see Logger#setLevel(java.util.logging.Level)
+   */
+  public static final Level OFF = new Level ("OFF", 0x7fffffff/*Integer.MAX_VALUE*/);
+
+  /**
+   * Log records whose level is <code>SEVERE</code> indicate a serious
+   * failure that prevents normal program execution.  Messages at this
+   * level should be understandable to an inexperienced, non-technical
+   * end user.  Ideally, they explain in simple words what actions the
+   * user can take in order to resolve the problem.
+   */
+  public static final Level SEVERE = new Level ("SEVERE", 1000);
+
+
+  /**
+   * Log records whose level is <code>WARNING</code> indicate a
+   * potential problem that does not prevent normal program execution.
+   * Messages at this level should be understandable to an
+   * inexperienced, non-technical end user.  Ideally, they explain in
+   * simple words what actions the user can take in order to resolve
+   * the problem.
+   */
+  public static final Level WARNING = new Level ("WARNING", 900);
+
+
+  /**
+   * Log records whose level is <code>INFO</code> are used in purely
+   * informational situations that do not constitute serious errors or
+   * potential problems. In the default logging configuration, INFO
+   * messages will be written to the system console.  For this reason,
+   * the INFO level should be used only for messages that are
+   * important to end users and system administrators.  Messages at
+   * this level should be understandable to an inexperienced,
+   * non-technical user.
+   */
+  public static final Level INFO = new Level ("INFO", 800);
+
+
+  /**
+   * Log records whose level is <code>CONFIG</code> are used for
+   * describing the static configuration, for example the windowing
+   * environment, the operating system version, etc.
+   */
+  public static final Level CONFIG = new Level ("CONFIG", 700);
+
+
+  /**
+   * Log records whose level is <code>FINE</code> are typically used
+   * for messages that are relevant for developers using
+   * the component generating log messages.  Examples include minor,
+   * recoverable failures, or possible inefficiencies.
+   */
+  public static final Level FINE = new Level ("FINE", 500);
+
+
+  /**
+   * Log records whose level is <code>FINER</code> are intended for
+   * rather detailed tracing, for example entering a method, returning
+   * from a method, or throwing an exception.
+   */
+  public static final Level FINER = new Level ("FINER", 400);
+
+
+  /**
+   * Log records whose level is <code>FINEST</code> are used for
+   * highly detailed tracing, for example to indicate that a certain
+   * point inside the body of a method has been reached.
+   */
+  public static final Level FINEST = new Level ("FINEST", 300);
+
+
+  /**
+   * The <code>ALL</code> level is used as a threshold for filtering
+   * log records, meaning that every message should be logged.
+   *
+   * @see Logger#setLevel(java.util.logging.Level)
+   */
+  public static final Level ALL = new Level ("ALL", Integer.MIN_VALUE);
+
+
+  private static final Level[] knownLevels = {
+    ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF
+  };
+
+
+  /**
+   * The name of the Level without localizing it, for example
+   * "WARNING".
+   */
+  private String name;
+
+
+  /**
+   * The integer value of this <code>Level</code>.
+   */
+  private int value;
+
+
+  /**
+   * The name of the resource bundle used for localizing the level
+   * name, or <code>null</code> if the name does not undergo
+   * localization.
+   */
+  private String resourceBundleName;
+
+
+  /**
+   * Creates a logging level given a name and an integer value.
+   * It rarely is necessary to create custom levels,
+   * as most applications should be well served with one of the
+   * standard levels such as <code>Level.CONFIG</code>,
+   * <code>Level.INFO</code>, or <code>Level.FINE</code>.
+   *
+   * @param name the name of the level.
+   *
+   * @param value the integer value of the level.  Please note
+   *     that the Java<small><sup>TM</sup></small>
+   *     Logging API does not specify integer
+   *    values for standard levels (such as
+   *    Level.FINE).  Therefore, a custom
+   *    level should pass an integer value that
+   *    is calculated at run-time, e.g.
+   *    <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
+   *    / 2</code> for a level between FINE and CONFIG.
+   */
+  protected Level(String name, int value)
+  {
+    this(name, value, null);
+  }
+
+
+  /**
+   * Create a logging level given a name, an integer value and a name
+   * of a resource bundle for localizing the level name.  It rarely
+   * is necessary to create custom levels, as most applications
+   * should be well served with one of the standard levels such as
+   * <code>Level.CONFIG</code>, <code>Level.INFO</code>, or
+   * <code>Level.FINE</code>.
+   *
+   * @param name the name of the level.
+   *
+   * @param value the integer value of the level.  Please note
+   *        that the Java<small><sup>TM</sup></small>
+   *       Logging API does not specify integer
+   *       values for standard levels (such as
+   *       Level.FINE).  Therefore, a custom
+   *       level should pass an integer value that
+   *       is calculated at run-time, e.g.
+   *       <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
+   *       / 2</code> for a level between FINE and CONFIG.
+   *
+   * @param resourceBundleName the name of a resource bundle
+   *       for localizing the level name, or <code>null</code>
+   *       if the name does not need to be localized.
+   */
+  protected Level(String name, int value, String resourceBundleName)
+  {
+    this.name = name;
+    this.value = value;
+    this.resourceBundleName = resourceBundleName;
+  }
+
+
+  static final long serialVersionUID = -8176160795706313070L;
+
+
+  /**
+   * Checks whether the Level has the same intValue as one of the
+   * pre-defined levels.  If so, the pre-defined level object is
+   * returned.
+   *
+   * <br/>Since the resource bundle name is not taken into
+   * consideration, it is possible to resolve Level objects that have
+   * been de-serialized by another implementation, even if the other
+   * implementation uses a different resource bundle for localizing
+   * the names of pre-defined levels.
+   */
+  /*private Object readResolve()
+  {
+    for (int i = 0; i < knownLevels.length; i++)
+      if (value == knownLevels[i].intValue())
+       return knownLevels[i];
+
+    return this;
+  }*/
+
+
+  /**
+   * Returns the name of the resource bundle used for localizing the
+   * level name.
+   *
+   * @return the name of the resource bundle used for localizing the
+   * level name, or <code>null</code> if the name does not undergo
+   * localization.
+   */
+  public String getResourceBundleName()
+  {
+    return resourceBundleName;
+  }
+
+
+  /**
+   * Returns the name of the Level without localizing it, for example
+   * "WARNING".
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+
+  /**
+   * Returns the name of the Level after localizing it, for example
+   * "WARNUNG".
+   */
+  /*public String getLocalizedName()
+  {
+    String localizedName = null;
+
+    if (resourceBundleName != null)
+    {
+      try
+      {
+        ResourceBundle b = ResourceBundle.getBundle(resourceBundleName);
+       localizedName = b.getString(name);
+      }
+      catch (Exception _)
+      {
+      }
+    }
+
+    if (localizedName != null)
+      return localizedName;
+    else
+      return name;
+  }*/
+
+
+  /**
+   * Returns the name of the Level without localizing it, for example
+   * "WARNING".
+   */
+  public final String toString()
+  {
+    return getName();
+  }
+
+
+  /**
+   * Returns the integer value of the Level.
+   */
+  public final int intValue()
+  {
+    return value;
+  }
+
+
+  /**
+   * Returns one of the standard Levels given either its name or its
+   * integer value.  Custom subclasses of Level will not be returned
+   * by this method.
+   *
+   * @throws IllegalArgumentException if <code>name</code> is neither
+   * the name nor the integer value of one of the pre-defined standard
+   * logging levels.
+   *
+   * @throws NullPointerException if <code>name</code> is null.
+   *
+   */
+  public static Level parse(String name)
+    //throws IllegalArgumentException
+  {
+    /* This will throw a NullPointerException if name is null,
+     * as required by the API specification.
+     */
+    //name = name.intern();
+
+    for (int i = 0; i < knownLevels.length; i++)
+    {
+      // It's safe to use == instead of .equals here because only the
+      // standard logging levels will be returned by this method, and
+      // they are all created using string literals.
+      if (name.equals(knownLevels[i].name))
+       return knownLevels[i];
+    }
+    
+    try
+    {
+      int num = Integer.parseInt(name);
+      for (int i = 0; i < knownLevels.length; i++)
+       if (num == knownLevels[i].value)
+         return knownLevels[i];
+    }
+    catch (/*NumberFormat*/Exception _)
+    {
+    }
+
+    String msg = "Not the name of a standard logging level: \"" + name + "\"";
+    throw new /*IllegalArgument*/Exception(msg);
+  }
+
+
+  /**
+   * Checks whether this Level's integer value is equal to that of
+   * another object.
+   *
+   * @return <code>true</code> if <code>other</code> is an instance of
+   *    <code>java.util.logging.Level</code> and has the same integer
+   * value, <code>false</code> otherwise.
+   */
+  public boolean equals(Object other)
+  {
+    if (!(other instanceof Level))
+      return false;
+
+    return value == ((Level) other).value;
+  }
+
+
+  /**
+   * Returns a hash code for this Level which is based on its numeric
+   * value.
+   */
+  public int hashCode()
+  {
+    return value;
+  }  
+
+
+  /**
+   * Determines whether or not this Level is one of the standard
+   * levels specified in the Logging API.
+   *
+   * <p>This method is package-private because it is not part
+   * of the logging API specification.  However, an XMLFormatter
+   * is supposed to emit the numeric value for a custom log
+   * level, but the name for a pre-defined level. It seems
+   * cleaner to put this method to Level than to write some
+   * procedural code for XMLFormatter.
+   *
+   * @return <code>true</code> if this Level is a standard level,
+   *         <code>false</code> otherwise.
+   */
+  final boolean isStandardLevel()
+  {
+    for (int i = 0; i < knownLevels.length; i++)
+      if (knownLevels[i] == this)
+       return true;
+
+    return false;
+  }
+}
+
index 2d4105a8e8b11e4e1c09cddc2b1ac6f7bde1db7f..1a4b6179b0a869ae5671b2a65523d6e384358121 100644 (file)
@@ -330,9 +330,9 @@ public final class Locale //implements Serializable, Cloneable
         language = convertLanguage(language);
         country = country.toUpperCase();
       }
-    this.language = language.intern();
-    this.country = country.intern();
-    this.variant = variant.intern();
+    this.language = language;//.intern();
+    this.country = country;//.intern();
+    this.variant = variant;//.intern();
     hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
   }
 
@@ -387,7 +387,7 @@ public final class Locale //implements Serializable, Cloneable
   public static void setDefault(Locale newLocale)
   {
     if (newLocale == null)
-      throw new NullPointerException();
+      throw new Exception/*NullPointerException*/("NullPointerException");
     /*SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       sm.checkPermission(new PropertyPermission("user.language", "write"));*/
@@ -399,7 +399,7 @@ public final class Locale //implements Serializable, Cloneable
    *
    * @return the installed locales
    */
-  public static synchronized Locale[] getAvailableLocales()
+  /*public static synchronized Locale[] getAvailableLocales()
   {
     if (availableLocales == null)
       {
@@ -430,7 +430,7 @@ public final class Locale //implements Serializable, Cloneable
       }
     
     return (Locale[]) availableLocales.clone();
-  }
+  }*/
 
   /**
    * Returns a list of all 2-letter uppercase country codes as defined
@@ -438,7 +438,7 @@ public final class Locale //implements Serializable, Cloneable
    *
    * @return a list of acceptable country codes
    */
-  public static String[] getISOCountries()
+  /*public static String[] getISOCountries()
   {
     if (countryCache == null)
       {
@@ -446,7 +446,7 @@ public final class Locale //implements Serializable, Cloneable
       }
 
     return (String[]) countryCache.clone();
-  }
+  }*/
 
   /**
    * Returns a list of all 2-letter lowercase language codes as defined
@@ -454,14 +454,14 @@ public final class Locale //implements Serializable, Cloneable
    *
    * @return a list of acceptable language codes
    */
-  public static String[] getISOLanguages()
+  /*public static String[] getISOLanguages()
   {
     if (languageCache == null)
       {
        languageCache = getISOStrings("languages");
       }
     return (String[]) languageCache.clone();
-  }
+  }*/
 
   /**
    * Returns the set of keys from the specified resource hashtable, filtered
@@ -563,7 +563,7 @@ public final class Locale //implements Serializable, Cloneable
    *
    * @throws MissingResourceException if the three-letter code is not known
    */
-  public String getISO3Language()
+  /*public String getISO3Language()
   {
     // We know all strings are interned so we can use '==' for better performance.
     if (language == "")
@@ -593,14 +593,14 @@ public final class Locale //implements Serializable, Cloneable
        + "srpsswsotsunsweswatamteltgkthatirtuktgltsntonturtsotattwiuigukrurd"
        + "uzbvievolwolxhoyidyorzhazhozul")
       .substring(index, index + 3);
-  }
+  }*/
 
   /**
    * Returns the three-letter ISO country abbrevation of the locale.
    *
    * @throws MissingResourceException if the three-letter code is not known
    */
-  public String getISO3Country()
+  /*public String getISO3Country()
   {
     // We know all strings are interned so we can use '==' for better performance.
     if (country == "")
@@ -639,7 +639,7 @@ public final class Locale //implements Serializable, Cloneable
        + "SLVSYRSWZTCATCDATFTGOTHATJKTKLTKMTUNTONTMPTURTTOTUVTWNTZAUKRUGAUMI"
        + "USAURYUZBVATVCTVENVGBVIRVNMVUTWLFWSMYEMMYTYUGZAFZMBZARZWE")
       .substring(index, index + 3);
-  }
+  }*/
 
   /**
    * Gets the country name suitable for display to the user, formatted
@@ -651,10 +651,10 @@ public final class Locale //implements Serializable, Cloneable
    * @return the language name of this locale localized to the default locale,
    *         with the ISO code as backup
    */
-  public String getDisplayLanguage()
+  /*public String getDisplayLanguage()
   {
     return getDisplayLanguage(defaultLocale);
-  }
+  }*/
 
   /**
    * <p>
@@ -730,10 +730,10 @@ public final class Locale //implements Serializable, Cloneable
    * @return the country name of this locale localized to the given locale,
    *         with the ISO code as backup
    */
-  public String getDisplayCountry()
+  /*public String getDisplayCountry()
   {
-    return null;//getDisplayCountry(defaultLocale);
-  }
+    return getDisplayCountry(defaultLocale);
+  }*/
 
   /**
    * <p>
@@ -809,10 +809,10 @@ public final class Locale //implements Serializable, Cloneable
    * @return the variant code of this locale localized to the given locale,
    *         with the ISO code as backup
    */
-  public String getDisplayVariant()
+  /*public String getDisplayVariant()
   {
     return getDisplayVariant(defaultLocale);
-  }
+  }*/
 
 
   /**
@@ -897,10 +897,10 @@ public final class Locale //implements Serializable, Cloneable
    *
    * @return String version of this locale, suitable for display to the user
    */
-  public String getDisplayName()
+  /*public String getDisplayName()
   {
     return getDisplayName(defaultLocale);
-  }
+  }*/
 
   /**
    * Gets all local components suitable for display to the user, formatted
@@ -989,9 +989,9 @@ public final class Locale //implements Serializable, Cloneable
       return false;
     Locale l = (Locale) obj;
 
-    return (language == l.language 
-            && country == l.country 
-            && variant == l.variant);
+    return (language.equals(l.language)// == l.language 
+            && country.equals(l.country)// == l.country 
+            && variant.equals(l.variant)/* == l.variant*/);
   }
 
   /**
diff --git a/Robust/src/ClassLibrary/MGC/gnu/LogManager.java b/Robust/src/ClassLibrary/MGC/gnu/LogManager.java
new file mode 100644 (file)
index 0000000..3e4a61d
--- /dev/null
@@ -0,0 +1,991 @@
+/* LogManager.java -- a class for maintaining Loggers and managing
+   configuration properties
+   Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/*import gnu.classpath.SystemProperties;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;*/
+
+/**
+ * The <code>LogManager</code> maintains a hierarchical namespace
+ * of Logger objects and manages properties for configuring the logging
+ * framework. There exists only one single <code>LogManager</code>
+ * per virtual machine. This instance can be retrieved using the
+ * static method {@link #getLogManager()}.
+ *
+ * <p><strong>Configuration Process:</strong> The global LogManager
+ * object is created and configured when the class
+ * <code>java.util.logging.LogManager</code> is initialized.
+ * The configuration process includes the subsequent steps:
+ *
+ * <ul>
+ * <li>If the system property <code>java.util.logging.manager</code>
+ *     is set to the name of a subclass of
+ *     <code>java.util.logging.LogManager</code>, an instance of
+ *     that subclass is created and becomes the global LogManager.
+ *     Otherwise, a new instance of LogManager is created.</li>
+ * <li>The <code>LogManager</code> constructor tries to create
+ *     a new instance of the class specified by the system
+ *     property <code>java.util.logging.config.class</code>.
+ *     Typically, the constructor of this class will call
+ *     <code>LogManager.getLogManager().readConfiguration(java.io.InputStream)</code>
+ *     for configuring the logging framework.
+ *     The configuration process stops at this point if
+ *     the system property <code>java.util.logging.config.class</code>
+ *     is set (irrespective of whether the class constructor
+ *     could be called or an exception was thrown).</li>
+ *
+ * <li>If the system property <code>java.util.logging.config.class</code>
+ *     is <em>not</em> set, the configuration parameters are read in from
+ *     a file and passed to
+ *     {@link #readConfiguration(java.io.InputStream)}.
+ *     The name and location of this file are specified by the system
+ *     property <code>java.util.logging.config.file</code>.</li>
+ * <li>If the system property <code>java.util.logging.config.file</code>
+ *     is not set, however, the contents of the URL
+ *     "{gnu.classpath.home.url}/logging.properties" are passed to
+ *     {@link #readConfiguration(java.io.InputStream)}.
+ *     Here, "{gnu.classpath.home.url}" stands for the value of
+ *     the system property <code>gnu.classpath.home.url</code>.</li>
+ * </ul>
+ *
+ * <p>The <code>LogManager</code> has a level of <code>INFO</code> by
+ * default, and this will be inherited by <code>Logger</code>s unless they
+ * override it either by properties or programmatically.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class LogManager
+{
+  /**
+   * The object name for the logging management bean.
+   * @since 1.5
+   */
+  public static final String LOGGING_MXBEAN_NAME
+    = "java.util.logging:type=Logging";
+
+  /**
+   * The singleton LogManager instance.
+   */
+  private static LogManager logManager;
+
+  /**
+   * The singleton logging bean.
+   */
+  //private static LoggingMXBean loggingBean;
+
+  /**
+   * The registered named loggers; maps the name of a Logger to
+   * a WeakReference to it.
+   */
+  private HashMap/*Map<String, WeakReference<Logger>>*/ loggers;
+
+  /**
+   * The properties for the logging framework which have been
+   * read in last.
+   */
+  //private Properties properties;
+
+  /**
+   * A delegate object that provides support for handling
+   * PropertyChangeEvents.  The API specification does not
+   * mention which bean should be the source in the distributed
+   * PropertyChangeEvents, but Mauve test code has determined that
+   * the Sun J2SE 1.4 reference implementation uses the LogManager
+   * class object. This is somewhat strange, as the class object
+   * is not the bean with which listeners have to register, but
+   * there is no reason for the GNU Classpath implementation to
+   * behave differently from the reference implementation in
+   * this case.
+   */
+  //private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */
+       //                                                            LogManager.class);
+
+  protected LogManager()
+  {
+    loggers = new HashMap();
+  }
+
+  /**
+   * Returns the globally shared LogManager instance.
+   */
+  public static synchronized LogManager getLogManager()
+  {
+    if (logManager == null)
+      {
+        logManager = makeLogManager();
+        initLogManager();
+      }
+    return logManager;
+  }
+
+  private static final String MANAGER_PROPERTY = "java.util.logging.manager";
+
+  private static LogManager makeLogManager()
+  {
+    //String managerClassName = SystemProperties.getProperty(MANAGER_PROPERTY);
+    LogManager manager = null/*(LogManager) createInstance
+      (managerClassName, LogManager.class, MANAGER_PROPERTY)*/;
+    if (manager == null)
+      manager = new LogManager();
+    return manager;
+  }
+
+  private static final String CONFIG_PROPERTY = "java.util.logging.config.class";
+
+  private static void initLogManager()
+  {
+    LogManager manager = getLogManager();
+    Logger.root.setLevel(Level.INFO);
+    manager.addLogger(Logger.root);
+
+    /* The Javadoc description of the class explains
+     * what is going on here.
+     */
+    //Object configurator = createInstance(System.getProperty(CONFIG_PROPERTY),
+     //                                    /* must be instance of */ Object.class,
+     //                                    CONFIG_PROPERTY);
+
+    /*try
+      {
+        if (configurator == null)
+          manager.readConfiguration();
+      }
+    catch (IOException ex)
+      {
+        /* FIXME: Is it ok to ignore exceptions here? */
+      //}
+  }
+
+  /**
+   * Registers a listener which will be notified when the
+   * logging properties are re-read.
+   */
+  /*public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
+  {
+    /* do not register null. */
+    /*listener.getClass();
+
+    pcs.addPropertyChangeListener(listener);
+  }*/
+
+  /**
+   * Unregisters a listener.
+   *
+   * If <code>listener</code> has not been registered previously,
+   * nothing happens.  Also, no exception is thrown if
+   * <code>listener</code> is <code>null</code>.
+   */
+  /*public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
+  {
+    if (listener != null)
+      pcs.removePropertyChangeListener(listener);
+  }*/
+
+  /**
+   * Adds a named logger.  If a logger with the same name has
+   * already been registered, the method returns <code>false</code>
+   * without adding the logger.
+   *
+   * <p>The <code>LogManager</code> only keeps weak references
+   * to registered loggers.  Therefore, names can become available
+   * after automatic garbage collection.
+   *
+   * @param logger the logger to be added.
+   *
+   * @return <code>true</code>if <code>logger</code> was added,
+   *         <code>false</code> otherwise.
+   *
+   * @throws NullPointerException if <code>name</code> is
+   *         <code>null</code>.
+   */
+  public synchronized boolean addLogger(Logger logger)
+  {
+    /* To developers thinking about to remove the 'synchronized'
+     * declaration from this method: Please read the comment
+     * in java.util.logging.Logger.getLogger(String, String)
+     * and make sure that whatever you change wrt. synchronization
+     * does not endanger thread-safety of Logger.getLogger.
+     * The current implementation of Logger.getLogger assumes
+     * that LogManager does its synchronization on the globally
+     * shared instance of LogManager.
+     */
+    String name;
+    //WeakReference ref;
+    Logger ref;
+
+    /* This will throw a NullPointerException if logger is null,
+     * as required by the API specification.
+     */
+    name = logger.getName();
+
+    ref = (Logger)loggers.get(name);
+    if (ref != null)
+      {
+       //if (ref.get() != null)
+         return false;
+
+       /* There has been a logger under this name in the past,
+        * but it has been garbage collected.
+        */
+       //loggers.remove(ref);
+      }
+
+    /* Adding a named logger requires a security permission. */
+    /*if ((name != null) && ! name.equals(""))
+      checkAccess();*/
+
+    Logger parent = findAncestor(logger);
+    loggers.put(name, /*new WeakReference<Logger>(*/logger);//));
+    if (parent != logger.getParent())
+      logger.setParent(parent);
+
+    // The level of the newly added logger must be specified.
+    // The easiest case is if there is a level for exactly this logger
+    // in the properties. If no such level exists the level needs to be 
+    // searched along the hirachy. So if there is a new logger 'foo.blah.blub'
+    // and an existing parent logger 'foo' the properties 'foo.blah.blub.level'
+    // and 'foo.blah.level' need to be checked. If both do not exist in the 
+    // properties the level of the new logger is set to 'null' (i.e. it uses the
+    // level of its parent 'foo').
+    Level logLevel = logger.getLevel();
+    String searchName = name;
+    String parentName = parent != null ? parent.getName() : "";
+    /*while (logLevel == null && ! searchName.equals(parentName))
+      {
+        logLevel = getLevelProperty(searchName + ".level", logLevel);
+        int index = searchName.lastIndexOf('.');
+        if(index > -1)
+          searchName = searchName.substring(0,index);
+        else
+          searchName = "";
+      }*/
+    logger.setLevel(logLevel);
+
+    /* It can happen that existing loggers should be children of
+     * the newly added logger. For example, assume that there
+     * already exist loggers under the names "", "foo", and "foo.bar.baz".
+     * When adding "foo.bar", the logger "foo.bar.baz" should change
+     * its parent to "foo.bar".
+     */
+    for (HashMapIterator iter = loggers./*.keySet().*/iterator(0); iter.hasNext();)
+      {
+       Logger possChild = (Logger) /*((WeakReference) */loggers.get(iter.next());//)
+        // .get();
+       if ((possChild == null) || (possChild == logger)
+           || (possChild.getParent() != parent))
+         continue;
+       
+       if (! possChild.getName().startsWith(name))
+         continue;
+       
+       if (possChild.getName().charAt(name.length()) != '.')
+         continue;
+       
+       possChild.setParent(logger);
+      }
+    
+    return true;
+  }
+
+  /**
+   * Finds the closest ancestor for a logger among the currently
+   * registered ones.  For example, if the currently registered
+   * loggers have the names "", "foo", and "foo.bar", the result for
+   * "foo.bar.baz" will be the logger whose name is "foo.bar".
+   *
+   * @param child a logger for whose name no logger has been
+   *        registered.
+   *
+   * @return the closest ancestor for <code>child</code>,
+   *         or <code>null</code> if <code>child</code>
+   *         is the root logger.
+   *
+   * @throws NullPointerException if <code>child</code>
+   *         is <code>null</code>.
+   */
+  private synchronized Logger findAncestor(Logger child)
+  {
+    String childName = child.getName();
+    int childNameLength = childName.length();
+    Logger best = Logger.root;
+    int bestNameLength = 0;
+
+    Logger cand;
+    int candNameLength;
+
+    if (child == Logger.root)
+      return null;
+
+    //for (String candName : loggers.keySet())
+    HashMapIterator it_key = loggers.iterator(0);
+    while(it_key.hasNext())
+      {
+      String candName = (String)it_key.next();
+       candNameLength = candName.length();
+
+       if (candNameLength > bestNameLength
+           && childNameLength > candNameLength
+           && childName.startsWith(candName)
+           && childName.charAt(candNameLength) == '.')
+         {
+           cand = loggers.get(candName);//.get();
+           if ((cand == null) || (cand == child))
+             continue;
+
+           bestNameLength = candName.length();
+           best = cand;
+         }
+      }
+
+    return best;
+  }
+
+  /**
+   * Returns a Logger given its name.
+   *
+   * @param name the name of the logger.
+   *
+   * @return a named Logger, or <code>null</code> if there is no
+   *     logger with that name.
+   *
+   * @throw java.lang.NullPointerException if <code>name</code>
+   *     is <code>null</code>.
+   */
+  public synchronized Logger getLogger(String name)
+  {
+    //WeakReference<Logger> ref;
+    Logger ref;
+
+    /* Throw a NullPointerException if name is null. */
+    //name.getClass();
+
+    ref = (Logger)loggers.get(name);
+    if (ref != null)
+      return ref;//.get();
+    else
+      return null;
+  }
+
+  /**
+   * Returns an Enumeration of currently registered Logger names.
+   * Since other threads can register loggers at any time, the
+   * result could be different any time this method is called.
+   *
+   * @return an Enumeration with the names of the currently
+   *    registered Loggers.
+   */
+  /*public synchronized Enumeration<String> getLoggerNames()
+  {
+    return Collections.enumeration(loggers.keySet());
+  }*/
+
+  /**
+   * Resets the logging configuration by removing all handlers for
+   * registered named loggers and setting their level to <code>null</code>.
+   * The level of the root logger will be set to <code>Level.INFO</code>.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   */
+  /*public synchronized void reset() throws SecurityException
+  {
+    /* Throw a SecurityException if the caller does not have the
+     * permission to control the logging infrastructure.
+     */
+    /*checkAccess();
+
+    properties = new Properties();
+
+    Iterator<WeakReference<Logger>> iter = loggers.values().iterator();
+    while (iter.hasNext())
+      {
+       WeakReference<Logger> ref;
+       Logger logger;
+
+       ref = iter.next();
+       if (ref != null)
+         {
+           logger = ref.get();
+
+           if (logger == null)
+             iter.remove();
+           else if (logger != Logger.root)
+             {
+               logger.resetLogger();
+               logger.setLevel(null);
+             }
+         }
+      }
+
+    Logger.root.setLevel(Level.INFO);
+    Logger.root.resetLogger();
+  }*/
+
+  /**
+   * Configures the logging framework by reading a configuration file.
+   * The name and location of this file are specified by the system
+   * property <code>java.util.logging.config.file</code>.  If this
+   * property is not set, the URL
+   * "{gnu.classpath.home.url}/logging.properties" is taken, where
+   * "{gnu.classpath.home.url}" stands for the value of the system
+   * property <code>gnu.classpath.home.url</code>.
+   *
+   * <p>The task of configuring the framework is then delegated to
+   * {@link #readConfiguration(java.io.InputStream)}, which will
+   * notify registered listeners after having read the properties.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure, or if the caller is
+   *         not granted the permission to read the configuration
+   *         file.
+   *
+   * @throws IOException if there is a problem reading in the
+   *         configuration file.
+   */
+  /*public synchronized void readConfiguration()
+    throws IOException, SecurityException
+  {
+    String path;
+    InputStream inputStream;
+
+    path = System.getProperty("java.util.logging.config.file");
+    if ((path == null) || (path.length() == 0))
+      {
+        String url = (System.getProperty("gnu.classpath.home.url")
+                      + "/logging.properties");
+        try
+          {
+            inputStream = new URL(url).openStream();
+          } 
+        catch (Exception e)
+          {
+            inputStream=null;
+          }
+
+        // If no config file could be found use a default configuration.
+        if(inputStream == null)
+          {
+            String defaultConfig = "handlers = java.util.logging.ConsoleHandler   \n"
+              + ".level=INFO \n";
+            inputStream = new ByteArrayInputStream(defaultConfig.getBytes());
+          }
+      }
+    else
+      inputStream = new java.io.FileInputStream(path);
+
+    try
+      {
+        readConfiguration(inputStream);
+      }
+    finally
+      {
+        // Close the stream in order to save
+        // resources such as file descriptors.
+        inputStream.close();
+      }
+  }*/
+
+  /*public synchronized void readConfiguration(InputStream inputStream)
+    throws IOException, SecurityException
+  {
+    Properties newProperties;
+    Enumeration keys;
+
+    checkAccess();
+    newProperties = new Properties();
+    newProperties.load(inputStream);
+    reset();
+    this.properties = newProperties;
+    keys = newProperties.propertyNames();
+
+    while (keys.hasMoreElements())
+      {
+       String key = ((String) keys.nextElement()).trim();
+       String value = newProperties.getProperty(key);
+
+       if (value == null)
+         continue;
+
+       value = value.trim();
+
+       if ("handlers".equals(key))
+         {
+           // In Java 5 and earlier this was specified to be
+           // whitespace-separated, but in reality it also accepted
+           // commas (tomcat relied on this), and in Java 6 the
+           // documentation was updated to fit the implementation.
+           StringTokenizer tokenizer = new StringTokenizer(value,
+                                                           " \t\n\r\f,");
+           while (tokenizer.hasMoreTokens())
+             {
+               String handlerName = tokenizer.nextToken();
+                Handler handler = (Handler)
+                  createInstance(handlerName, Handler.class, key);
+               // Tomcat also relies on the implementation ignoring
+               // items in 'handlers' which are not class names.
+               if (handler != null)
+                 Logger.root.addHandler(handler);
+             }
+         }
+
+       if (key.endsWith(".level"))
+         {
+           String loggerName = key.substring(0, key.length() - 6);
+           Logger logger = getLogger(loggerName);
+
+           if (logger == null)
+             {
+               logger = Logger.getLogger(loggerName);
+               addLogger(logger);
+             }
+            Level level = null;
+           try
+              {
+                level = Level.parse(value);
+              }
+            catch (IllegalArgumentException e)
+              {
+                warn("bad level \'" + value + "\'", e);
+              }
+            if (level != null)
+              {
+                logger.setLevel(level);
+              }
+           continue;
+         }
+      }
+
+    /* The API specification does not talk about the
+     * property name that is distributed with the
+     * PropertyChangeEvent.  With test code, it could
+     * be determined that the Sun J2SE 1.4 reference
+     * implementation uses null for the property name.
+     */
+    pcs.firePropertyChange(null, null, null);
+  }*/
+
+  /**
+   * Returns the value of a configuration property as a String.
+   */
+  /*public synchronized String getProperty(String name)
+  {
+    if (properties != null)
+      return properties.getProperty(name);
+    else
+      return null;
+  }*/
+
+  /**
+   * Returns the value of a configuration property as an integer.
+   * This function is a helper used by the Classpath implementation
+   * of java.util.logging, it is <em>not</em> specified in the
+   * logging API.
+   *
+   * @param name the name of the configuration property.
+   *
+   * @param defaultValue the value that will be returned if the
+   *        property is not defined, or if its value is not an integer
+   *        number.
+   */
+  /*static int getIntProperty(String name, int defaultValue)
+  {
+    try
+      {
+       return Integer.parseInt(getLogManager().getProperty(name));
+      }
+    catch (Exception ex)
+      {
+       return defaultValue;
+      }
+  }*/
+
+  /**
+   * Returns the value of a configuration property as an integer,
+   * provided it is inside the acceptable range.
+   * This function is a helper used by the Classpath implementation
+   * of java.util.logging, it is <em>not</em> specified in the
+   * logging API.
+   *
+   * @param name the name of the configuration property.
+   *
+   * @param minValue the lowest acceptable value.
+   *
+   * @param maxValue the highest acceptable value.
+   *
+   * @param defaultValue the value that will be returned if the
+   *        property is not defined, or if its value is not an integer
+   *        number, or if it is less than the minimum value,
+   *        or if it is greater than the maximum value.
+   */
+  /*static int getIntPropertyClamped(String name, int defaultValue,
+                                   int minValue, int maxValue)
+  {
+    int val = getIntProperty(name, defaultValue);
+    if ((val < minValue) || (val > maxValue))
+      val = defaultValue;
+    return val;
+  }*/
+
+  /**
+   * Returns the value of a configuration property as a boolean.
+   * This function is a helper used by the Classpath implementation
+   * of java.util.logging, it is <em>not</em> specified in the
+   * logging API.
+   *
+   * @param name the name of the configuration property.
+   *
+   * @param defaultValue the value that will be returned if the
+   *        property is not defined, or if its value is neither
+   *        <code>"true"</code> nor <code>"false"</code>.
+   */
+  /*static boolean getBooleanProperty(String name, boolean defaultValue)
+  {
+    try
+      {
+       return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
+      }
+    catch (Exception ex)
+      {
+       return defaultValue;
+      }
+  }*/
+
+  /**
+   * Returns the value of a configuration property as a Level.
+   * This function is a helper used by the Classpath implementation
+   * of java.util.logging, it is <em>not</em> specified in the
+   * logging API.
+   *
+   * @param propertyName the name of the configuration property.
+   *
+   * @param defaultValue the value that will be returned if the
+   *        property is not defined, or if
+   *        {@link Level#parse(java.lang.String)} does not like
+   *        the property value.
+   */
+  /*static Level getLevelProperty(String propertyName, Level defaultValue)
+  {
+    try
+      {
+        String value = getLogManager().getProperty(propertyName);
+       if (value != null)
+         return Level.parse(getLogManager().getProperty(propertyName));
+        else
+          return defaultValue;
+      }
+    catch (Exception ex)
+      {
+       return defaultValue;
+      }
+  }*/
+
+  /**
+   * Returns the value of a configuration property as a Class.
+   * This function is a helper used by the Classpath implementation
+   * of java.util.logging, it is <em>not</em> specified in the
+   * logging API.
+   *
+   * @param propertyName the name of the configuration property.
+   *
+   * @param defaultValue the value that will be returned if the
+   *        property is not defined, or if it does not specify
+   *        the name of a loadable class.
+   */
+  /*static final Class getClassProperty(String propertyName, Class defaultValue)
+  {
+    String propertyValue = logManager.getProperty(propertyName);
+
+    if (propertyValue != null)
+      try
+        {
+          return locateClass(propertyValue);
+        }
+      catch (ClassNotFoundException e)
+        {
+          warn(propertyName + " = " + propertyValue, e);
+        }
+
+    return defaultValue;
+  }*/
+
+  /*static final Object getInstanceProperty(String propertyName, Class ofClass,
+                                          Class defaultClass)
+  {
+    Class klass = getClassProperty(propertyName, defaultClass);
+    if (klass == null)
+      return null;
+
+    try
+      {
+        Object obj = klass.newInstance();
+        if (ofClass.isInstance(obj))
+          return obj;
+      }
+    catch (InstantiationException e)
+      {
+        warn(propertyName + " = " + klass.getName(), e);
+      }
+    catch (IllegalAccessException e)
+      {
+        warn(propertyName + " = " + klass.getName(), e);
+      }
+
+    if (defaultClass == null)
+      return null;
+
+    try
+      {
+       return defaultClass.newInstance();
+      }
+    catch (java.lang.InstantiationException ex)
+      {
+       throw new RuntimeException(ex.getMessage());
+      }
+    catch (java.lang.IllegalAccessException ex)
+      {
+       throw new RuntimeException(ex.getMessage());
+      }
+  }*/
+
+  /**
+   * An instance of <code>LoggingPermission("control")</code>
+   * that is shared between calls to <code>checkAccess()</code>.
+   */
+  //private static final LoggingPermission controlPermission = new LoggingPermission("control",
+   //                                                                                null);
+
+  /**
+   * Checks whether the current security context allows changing
+   * the configuration of the logging framework.  For the security
+   * context to be trusted, it has to be granted
+   * a LoggingPermission("control").
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   */
+ /* public void checkAccess() throws SecurityException
+  {
+    SecurityManager sm = System.getSecurityManager();
+    if (sm != null)
+      sm.checkPermission(controlPermission);
+  }*/
+
+  /**
+   * Creates a new instance of a class specified by name and verifies
+   * that it is an instance (or subclass of) a given type.
+   *
+   * @param className the name of the class of which a new instance
+   *        should be created.
+   *
+   * @param type the object created must be an instance of
+   * <code>type</code> or any subclass of <code>type</code>
+   *
+   * @param property the system property to reference in error
+   * messages
+   *
+   * @return the new instance, or <code>null</code> if
+   *         <code>className</code> is <code>null</code>, if no class
+   *         with that name could be found, if there was an error
+   *         loading that class, or if the constructor of the class
+   *         has thrown an exception.
+   */
+  /*private static final Object createInstance(String className, Class type,
+                                             String property)
+  {
+    Class klass = null;
+
+    if ((className == null) || (className.length() == 0))
+      return null;
+
+    try
+      {
+        klass = locateClass(className);
+        if (type.isAssignableFrom(klass))
+          return klass.newInstance();
+        warn(property, className, "not an instance of " + type.getName());
+      }
+    catch (ClassNotFoundException e)
+      {
+        warn(property, className, "class not found", e);
+      }
+    catch (IllegalAccessException e)
+      {
+        warn(property, className, "illegal access", e);
+      }
+    catch (InstantiationException e)
+      {
+        warn(property, className, e);
+      }
+    catch (java.lang.LinkageError e)
+      {
+        warn(property, className, "linkage error", e);
+      }
+
+    return null;
+  }*/
+
+  /*private static final void warn(String property, String klass, Throwable t)
+  {
+    warn(property, klass, null, t);
+  }*/
+
+  /*private static final void warn(String property, String klass, String msg)
+  {
+    warn(property, klass, msg, null);
+  }*/
+
+  /*private static final void warn(String property, String klass, String msg,
+                                 Throwable t)
+  {
+    warn("error instantiating '" + klass + "' referenced by " + property +
+         (msg == null ? "" : ", " + msg), t);
+  }*/
+
+  /**
+   * All debug warnings go through this method.
+   */
+
+  /*private static final void warn(String msg, Throwable t)
+  {
+    System.err.println("WARNING: " + msg);
+    if (t != null)
+      t.printStackTrace(System.err);
+  }*/
+
+  /**
+   * Locates a class by first checking the system class loader and
+   * then checking the context class loader.
+   *
+   * @param name the fully qualified name of the Class to locate
+   * @return Class the located Class
+   */
+
+  /*private static Class locateClass(String name) throws ClassNotFoundException
+  {
+    ClassLoader loader = Thread.currentThread().getContextClassLoader();
+    try
+      {
+        return Class.forName(name, true, loader);
+      }
+    catch (ClassNotFoundException e)
+      {
+        loader = ClassLoader.getSystemClassLoader();
+        return Class.forName(name, true, loader);
+      }
+  }*/
+
+  /**
+   * Return the logging bean.  There is a single logging bean per
+   * VM instance.
+   * @since 1.5
+   */
+  /*public static synchronized LoggingMXBean getLoggingMXBean()
+  {
+    if (loggingBean == null)
+      {
+        loggingBean = new LoggingMXBean()
+        {
+          public String getLoggerLevel(String logger)
+          {
+            LogManager mgr = getLogManager();
+            Logger l = mgr.getLogger(logger);
+            if (l == null)
+              return null;
+            Level lev = l.getLevel();
+            if (lev == null)
+              return "";
+            return lev.getName();
+          }
+
+          public List getLoggerNames()
+          {
+            LogManager mgr = getLogManager();
+            // This is inefficient, but perhaps better for maintenance.
+            return Collections.list(mgr.getLoggerNames());
+          }
+
+          public String getParentLoggerName(String logger)
+          {
+            LogManager mgr = getLogManager();
+            Logger l = mgr.getLogger(logger);
+            if (l == null)
+              return null;
+            l = l.getParent();
+            if (l == null)
+              return "";
+            return l.getName();
+          }
+
+          public void setLoggerLevel(String logger, String level)
+          {
+            LogManager mgr = getLogManager();
+            Logger l = mgr.getLogger(logger);
+            if (l == null)
+              throw new IllegalArgumentException("no logger named " + logger);
+            Level newLevel;
+            if (level == null)
+              newLevel = null;
+            else
+              newLevel = Level.parse(level);
+            l.setLevel(newLevel);
+          }
+        };
+      }
+    return loggingBean;
+  }*/
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/LogRecord.java b/Robust/src/ClassLibrary/MGC/gnu/LogRecord.java
new file mode 100644 (file)
index 0000000..ed6b363
--- /dev/null
@@ -0,0 +1,672 @@
+/* LogRecord.java --
+   A class for the state associated with individual logging events
+   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+//import java.util.ResourceBundle;
+
+
+/**
+ * A <code>LogRecord</code> contains the state for an individual
+ * event to be logged.
+ *
+ * <p>As soon as a LogRecord instance has been handed over to the
+ * logging framework, applications should not manipulate it anymore.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class LogRecord
+  //implements java.io.Serializable
+{
+  /**
+   * The severity level of this <code>LogRecord</code>.
+   */
+  private Level      level;
+
+
+  /**
+   * The sequence number of this <code>LogRecord</code>.
+   */
+  private long       sequenceNumber;
+
+
+  /**
+   * The name of the class that issued the logging request, or
+   * <code>null</code> if this information could not be obtained.
+   */
+  private String     sourceClassName;
+
+
+  /**
+   * The name of the method that issued the logging request, or
+   * <code>null</code> if this information could not be obtained.
+   */
+  private String sourceMethodName;
+
+
+  /**
+   * The message for this <code>LogRecord</code> before
+   * any localization or formatting.
+   */
+  private String message;
+
+
+  /**
+   * An identifier for the thread in which this <code>LogRecord</code>
+   * was created.  The identifier is not necessarily related to any
+   * thread identifiers used by the operating system.
+   */
+  //private int threadID;
+
+
+  /**
+   * The time when this <code>LogRecord</code> was created,
+   * in milliseconds since the beginning of January 1, 1970.
+   */
+  private long millis;
+
+
+  /**
+   * The Throwable associated with this <code>LogRecord</code>, or
+   * <code>null</code> if the logged event is not related to an
+   * exception or error.
+   */
+  private Throwable thrown;
+
+
+  /**
+   * The name of the logger where this <code>LogRecord</code> has
+   * originated, or <code>null</code> if this <code>LogRecord</code>
+   * does not originate from a <code>Logger</code>.
+   */
+  private String  loggerName;
+
+
+  /**
+   * The name of the resource bundle used for localizing log messages,
+   * or <code>null</code> if no bundle has been specified.
+   */
+  //private String resourceBundleName;
+
+  private transient Object[] parameters;
+
+  //private transient ResourceBundle bundle;
+
+
+  /**
+   * Constructs a <code>LogRecord</code> given a severity level and
+   * an unlocalized message text.  In addition, the sequence number,
+   * creation time (as returned by <code>getMillis()</code>) and
+   * thread ID are assigned. All other properties are set to
+   * <code>null</code>.
+   *
+   * @param level the severity level, for example <code>Level.WARNING</code>.
+   *
+   * @param message the message text (which will be used as key
+   *                for looking up the localized message text
+   *                if a resource bundle has been associated). 
+   */
+  public LogRecord(Level level, String message)
+  {
+    this.level = level;
+    this.message = message;
+    this.millis = System.currentTimeMillis();
+
+    /* A subclass of java.lang.Thread could override hashCode(),
+     * in which case the result would not be guaranteed anymore
+     * to be unique among all threads.  While System.identityHashCode
+     * is not necessarily unique either, it at least cannot be
+     * overridden by user code.  However, is might be a good idea
+     * to use something better for generating thread IDs.
+     */
+    //this.threadID = System.identityHashCode(Thread.currentThread());
+
+    sequenceNumber = allocateSeqNum();
+  }
+
+
+  /**
+   * Determined with the serialver tool of the Sun J2SE 1.4.
+   */
+  static final long serialVersionUID = 5372048053134512534L;
+
+  /*private void readObject(java.io.ObjectInputStream in)
+    throws java.io.IOException, java.lang.ClassNotFoundException
+  {
+    in.defaultReadObject();
+
+    /* We assume that future versions will be downwards compatible,
+     * so we can ignore the versions.
+     */
+    /*byte majorVersion = in.readByte();
+    byte minorVersion = in.readByte();
+
+    int numParams = in.readInt();
+    if (numParams >= 0)
+    {
+      parameters = new Object[numParams];
+      for (int i = 0; i < numParams; i++)
+       parameters[i] = in.readObject();
+    }
+  }*/
+
+
+  /**
+   * @serialData The default fields, followed by a major byte version
+   * number, followed by a minor byte version number, followed by
+   * information about the log record parameters.  If
+   * <code>parameters</code> is <code>null</code>, the integer -1 is
+   * written, otherwise the length of the <code>parameters</code>
+   * array (which can be zero), followed by the result of calling
+   * {@link Object#toString() toString()} on the parameter (or
+   * <code>null</code> if the parameter is <code>null</code>).
+   *
+   * <p><strong>Specification Note:</strong> The Javadoc for the
+   * Sun reference implementation does not specify the version
+   * number. FIXME: Reverse-engineer the JDK and file a bug
+   * report with Sun, asking for amendment of the specification.
+   */
+  /*private void writeObject(java.io.ObjectOutputStream out)
+    throws java.io.IOException
+  {
+    out.defaultWriteObject();
+
+    /* Major, minor version number: The Javadoc for J2SE1.4 does not
+     * specify the values.
+     */
+    /*out.writeByte(0);
+    out.writeByte(0);
+
+    if (parameters == null)
+      out.writeInt(-1);
+    else
+    {
+      out.writeInt(parameters.length);
+      for (int i = 0; i < parameters.length; i++)
+      {
+       if (parameters[i] == null)
+         out.writeObject(null);
+       else
+         out.writeObject(parameters[i].toString());
+      }
+    }
+  }*/
+
+
+  /**
+   * Returns the name of the logger where this <code>LogRecord</code>
+   * has originated.
+   *
+   * @return the name of the source {@link Logger}, or
+   *         <code>null</code> if this <code>LogRecord</code>
+   *         does not originate from a <code>Logger</code>.
+   */
+  public String getLoggerName()
+  {
+    return loggerName;
+  }
+
+
+  /**
+   * Sets the name of the logger where this <code>LogRecord</code>
+   * has originated.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param name the name of the source logger, or <code>null</code> to
+   *             indicate that this <code>LogRecord</code> does not
+   *             originate from a <code>Logger</code>.
+   */
+  public void setLoggerName(String name)
+  {
+    loggerName = name;
+  }
+
+
+  /**
+   * Returns the resource bundle that is used when the message
+   * of this <code>LogRecord</code> needs to be localized.
+   *
+   * @return the resource bundle used for localization,
+   *         or <code>null</code> if this message does not need
+   *         to be localized.
+   */
+  /*public ResourceBundle getResourceBundle()
+  {
+    return bundle;
+  }*/
+
+
+  /**
+   * Sets the resource bundle that is used when the message
+   * of this <code>LogRecord</code> needs to be localized.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param bundle  the resource bundle to be used, or
+   *                <code>null</code> to indicate that this
+   *                message does not need to be localized.
+   */
+  /*public void setResourceBundle(ResourceBundle bundle)
+  {
+    this.bundle = bundle;
+
+    /* FIXME: Is there a way to infer the name
+     * of a resource bundle from a ResourceBundle object?
+     */
+    /*this.resourceBundleName = null;
+  }*/
+
+
+  /**
+   * Returns the name of the resource bundle that is used when the
+   * message of this <code>LogRecord</code> needs to be localized.
+   *
+   * @return the name of the resource bundle used for localization,
+   *         or <code>null</code> if this message does not need
+   *         to be localized.
+   */
+  /*public String getResourceBundleName()
+  {
+    return resourceBundleName;
+  }*/
+
+
+  /**
+   * Sets the name of the resource bundle that is used when the
+   * message of this <code>LogRecord</code> needs to be localized.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param name the name of the resource bundle to be used, or
+   *             <code>null</code> to indicate that this message
+   *             does not need to be localized.
+   */
+  /*public void setResourceBundleName(String name)
+  {
+    resourceBundleName = name;
+    bundle = null;
+    
+    try
+    {
+      if (resourceBundleName != null)
+       bundle = ResourceBundle.getBundle(resourceBundleName);
+    }
+    catch (java.util.MissingResourceException _)
+    {
+    }
+  }*/
+
+
+  /**
+   * Returns the level of the LogRecord.
+   *
+   * <p>Applications should be aware of the possibility that the
+   *  result is not necessarily one of the standard logging levels,
+   *  since the logging framework allows to create custom subclasses
+   *  of <code>java.util.logging.Level</code>.  Therefore, filters
+   *  should perform checks like <code>theRecord.getLevel().intValue()
+   *  == Level.INFO.intValue()</code> instead of <code>theRecord.getLevel()
+   *  == Level.INFO</code>.
+   */
+  public Level getLevel()
+  {
+    return level;
+  }
+
+
+  /**
+   * Sets the severity level of this <code>LogRecord</code> to a new
+   * value.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param level the new severity level, for example
+   *              <code>Level.WARNING</code>.
+   */
+  public void setLevel(Level level)
+  {
+    this.level = level;
+  }
+
+
+  /**
+   * The last used sequence number for any LogRecord.
+   */
+  private static long lastSeqNum;
+
+
+  /**
+   * Allocates a sequence number for a new LogRecord.  This class
+   * method is only called by the LogRecord constructor.
+   */
+  private static synchronized long allocateSeqNum()
+  {
+    lastSeqNum += 1;
+    return lastSeqNum;
+  }
+
+
+  /**
+   * Returns the sequence number of this <code>LogRecord</code>.
+   */
+  public long getSequenceNumber()
+  {
+    return sequenceNumber;
+  }
+
+
+  /**
+   * Sets the sequence number of this <code>LogRecord</code> to a new
+   * value.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param seqNum the new sequence number.
+   */
+  public void setSequenceNumber(long seqNum)
+  {
+    this.sequenceNumber = seqNum;
+  }
+
+
+  /**
+   * Returns the name of the class where the event being logged
+   * has had its origin.  This information can be passed as
+   * parameter to some logging calls, and in certain cases, the
+   * logging framework tries to determine an approximation
+   * (which may or may not be accurate).
+   * 
+   * @return the name of the class that issued the logging request,
+   *         or <code>null</code> if this information could not
+   *         be obtained.
+   */
+  public String getSourceClassName()
+  {
+    if (sourceClassName != null)
+      return sourceClassName;
+
+    /*  FIXME: Should infer this information from the call stack. */
+    return null;
+  }
+
+
+  /**
+   * Sets the name of the class where the event being logged
+   * has had its origin.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   * 
+   * @param sourceClassName the name of the class that issued the
+   *          logging request, or <code>null</code> to indicate that
+   *          this information could not be obtained.
+   */
+  public void setSourceClassName(String sourceClassName)
+  {
+    this.sourceClassName = sourceClassName;
+  }
+
+
+  /**
+   * Returns the name of the method where the event being logged
+   * has had its origin.  This information can be passed as
+   * parameter to some logging calls, and in certain cases, the
+   * logging framework tries to determine an approximation
+   * (which may or may not be accurate).
+   * 
+   * @return the name of the method that issued the logging request,
+   *         or <code>null</code> if this information could not
+   *         be obtained.
+   */
+  public String getSourceMethodName()
+  {
+    if (sourceMethodName != null)
+      return sourceMethodName;
+
+    /* FIXME: Should infer this information from the call stack. */
+    return null;
+  }
+
+
+  /**
+   * Sets the name of the method where the event being logged
+   * has had its origin.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   * 
+   * @param sourceMethodName the name of the method that issued the
+   *          logging request, or <code>null</code> to indicate that
+   *          this information could not be obtained.
+   */
+  public void setSourceMethodName(String sourceMethodName)
+  {
+    this.sourceMethodName = sourceMethodName;
+  }
+
+
+  /**
+   * Returns the message for this <code>LogRecord</code> before
+   * any localization or parameter substitution.
+   *
+   * <p>A {@link Logger} will try to localize the message
+   * if a resource bundle has been associated with this
+   * <code>LogRecord</code>.  In this case, the logger will call
+   * <code>getMessage()</code> and use the result as the key
+   * for looking up the localized message in the bundle.
+   * If no bundle has been associated, or if the result of
+   * <code>getMessage()</code> is not a valid key in the
+   * bundle, the logger will use the raw message text as
+   * returned by this method.
+   *
+   * @return the message text, or <code>null</code> if there
+   *         is no message text.
+   */
+  public String getMessage()
+  {
+    return message;
+  }
+
+
+  /**
+   * Sets the message for this <code>LogRecord</code>.
+   *
+   * <p>A <code>Logger</code> will try to localize the message
+   * if a resource bundle has been associated with this
+   * <code>LogRecord</code>.  In this case, the logger will call
+   * <code>getMessage()</code> and use the result as the key
+   * for looking up the localized message in the bundle.
+   * If no bundle has been associated, or if the result of
+   * <code>getMessage()</code> is not a valid key in the
+   * bundle, the logger will use the raw message text as
+   * returned by this method.
+   *
+   * <p>It is possible to set the message to either an empty String or
+   * <code>null</code>, although this does not make the the message
+   * very helpful to human users.
+   *
+   * @param message the message text (which will be used as key
+   *                for looking up the localized message text
+   *                if a resource bundle has been associated). 
+   */
+  public void setMessage(String message)
+  {
+    this.message = message;
+  }
+
+
+  /**
+   * Returns the parameters to the log message.
+   *
+   * @return the parameters to the message, or <code>null</code> if
+   *         the message has no parameters.
+   */
+  public Object[] getParameters()
+  {
+    return parameters;
+  }
+
+
+  /**
+   * Sets the parameters to the log message.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param parameters the parameters to the message, or <code>null</code>
+   *                   to indicate that the message has no parameters.
+   */
+  public void setParameters(Object[] parameters)
+  {
+    this.parameters = parameters;
+  }
+
+
+  /**
+   * Returns an identifier for the thread in which this
+   * <code>LogRecord</code> was created.  The identifier is not
+   * necessarily related to any thread identifiers used by the
+   * operating system.
+   *
+   * @return an identifier for the source thread.
+   */
+  /*public int getThreadID()
+  {
+    return threadID;
+  }*/
+
+
+  /**
+   * Sets the identifier indicating in which thread this
+   * <code>LogRecord</code> was created.  The identifier is not
+   * necessarily related to any thread identifiers used by the
+   * operating system.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param threadID the identifier for the source thread.
+   */
+  /*public void setThreadID(int threadID)
+  {
+    this.threadID = threadID;
+  }*/
+
+
+  /**
+   * Returns the time when this <code>LogRecord</code> was created.
+   *
+   * @return the time of creation in milliseconds since the beginning
+   *         of January 1, 1970.
+   */
+  public long getMillis()
+  {
+    return millis;
+  }
+
+
+  /**
+   * Sets the time when this <code>LogRecord</code> was created.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param millis the time of creation in milliseconds since the
+   *               beginning of January 1, 1970.
+   */
+  public void setMillis(long millis)
+  {
+    this.millis = millis;
+  }
+
+
+  /**
+   * Returns the Throwable associated with this <code>LogRecord</code>,
+   * or <code>null</code> if the logged event is not related to an exception
+   * or error.
+   */
+  public Throwable getThrown()
+  {
+    return thrown;
+  }
+
+
+  /**
+   * Associates this <code>LogRecord</code> with an exception or error.
+   *
+   * <p>As soon as a <code>LogRecord</code> has been handed over
+   * to the logging framework, applications should not modify it
+   * anymore.  Therefore, this method should only be called on
+   * freshly constructed LogRecords.
+   *
+   * @param thrown the exception or error to associate with, or
+   *               <code>null</code> if this <code>LogRecord</code>
+   *               should be made unrelated to an exception or error.
+   */
+  public void setThrown(Throwable thrown)
+  {
+    this.thrown = thrown;
+  }
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Logger.java b/Robust/src/ClassLibrary/MGC/gnu/Logger.java
new file mode 100644 (file)
index 0000000..26e949d
--- /dev/null
@@ -0,0 +1,1198 @@
+/* Logger.java -- a class for logging messages
+   Copyright (C) 2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/*import gnu.java.lang.CPStringBuilder;
+
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.security.AccessController;
+import java.security.PrivilegedAction;*/
+
+/**
+ * A Logger is used for logging information about events. Usually, there is a
+ * seprate logger for each subsystem or component, although there is a shared
+ * instance for components that make only occasional use of the logging
+ * framework.
+ * <p>
+ * It is common to name a logger after the name of a corresponding Java package.
+ * Loggers are organized into a hierarchical namespace; for example, the logger
+ * <code>"org.gnu.foo"</code> is the <em>parent</em> of logger
+ * <code>"org.gnu.foo.bar"</code>.
+ * <p>
+ * A logger for a named subsystem can be obtained through {@link
+ * java.util.logging.Logger#getLogger(java.lang.String)}. However, only code
+ * which has been granted the permission to control the logging infrastructure
+ * will be allowed to customize that logger. Untrusted code can obtain a
+ * private, anonymous logger through {@link #getAnonymousLogger()} if it wants
+ * to perform any modifications to the logger.
+ * <p>
+ * FIXME: Write more documentation.
+ * 
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class Logger
+{
+  static final Logger root = new Logger("", null);
+
+  /**
+   * A logger provided to applications that make only occasional use of the
+   * logging framework, typically early prototypes. Serious products are
+   * supposed to create and use their own Loggers, so they can be controlled
+   * individually.
+   */
+  public static final Logger globalLog;
+
+  /**
+   * Use to lock methods on this class instead of calling synchronize on methods
+   * to avoid deadlocks. Yeah, no kidding, we got them :)
+   */
+  private static final Object[] lock = new Object[0];
+  
+  static
+    {
+      // Our class might be initialized from an unprivileged context
+      globalLog = new Logger("global", null);/*(Logger) AccessController.doPrivileged(new PrivilegedAction()
+      {
+        public Object run()
+        {
+          return getLogger("global");
+        }
+      })*/;
+    }
+
+  /**
+   * The name of the Logger, or <code>null</code> if the logger is anonymous.
+   * <p>
+   * A previous version of the GNU Classpath implementation granted untrusted
+   * code the permission to control any logger whose name was null. However,
+   * test code revealed that the Sun J2SE 1.4 reference implementation enforces
+   * the security control for any logger that was not created through
+   * getAnonymousLogger, even if it has a null name. Therefore, a separate flag
+   * {@link Logger#anonymous} was introduced.
+   */
+  private final String name;
+
+  /**
+   * The name of the resource bundle used for localization.
+   * <p>
+   * This variable cannot be declared as <code>final</code> because its value
+   * can change as a result of calling getLogger(String,String).
+   */
+  private String resourceBundleName;
+
+  /**
+   * The resource bundle used for localization.
+   * <p>
+   * This variable cannot be declared as <code>final</code> because its value
+   * can change as a result of calling getLogger(String,String).
+   */
+  //private ResourceBundle resourceBundle;
+
+  //private Filter filter;
+
+  //private final List handlerList = new java.util.ArrayList(4);
+
+  //private Handler[] handlers = new Handler[0];
+
+  /**
+   * Indicates whether or not this logger is anonymous. While a
+   * LoggingPermission is required for any modifications to a normal logger,
+   * untrusted code can obtain an anonymous logger and modify it according to
+   * its needs.
+   * <p>
+   * A previous version of the GNU Classpath implementation granted access to
+   * every logger whose name was null. However, test code revealed that the Sun
+   * J2SE 1.4 reference implementation enforces the security control for any
+   * logger that was not created through getAnonymousLogger, even if it has a
+   * null name.
+   */
+  private boolean anonymous;
+
+  private boolean useParentHandlers;
+
+  private Level level;
+
+  private Logger parent;
+
+  /**
+   * Constructs a Logger for a subsystem. Most applications do not need to
+   * create new Loggers explicitly; instead, they should call the static factory
+   * methods {@link #getLogger(java.lang.String,java.lang.String) getLogger}
+   * (with ResourceBundle for localization) or
+   * {@link #getLogger(java.lang.String) getLogger} (without ResourceBundle),
+   * respectively.
+   * 
+   * @param name the name for the logger, for example "java.awt" or
+   *            "com.foo.bar". The name should be based on the name of the
+   *            package issuing log records and consist of dot-separated Java
+   *            identifiers.
+   * @param resourceBundleName the name of a resource bundle for localizing
+   *            messages, or <code>null</code> to indicate that messages do
+   *            not need to be localized.
+   * @throws java.util.MissingResourceException if
+   *             <code>resourceBundleName</code> is not <code>null</code>
+   *             and no such bundle could be located.
+   */
+  protected Logger(String name, String resourceBundleName)
+      //throws MissingResourceException
+  {
+    this.name = name;
+    this.resourceBundleName = resourceBundleName;
+
+    /*if (resourceBundleName == null)
+      resourceBundle = null;
+    else
+      resourceBundle = ResourceBundle.getBundle(resourceBundleName);*/
+
+    level = null;
+
+    /*
+     * This is null when the root logger is being constructed, and the root
+     * logger afterwards.
+     */
+    parent = root;
+
+    useParentHandlers = (parent != null);
+  }
+
+  /**
+   * Finds a registered logger for a subsystem, or creates one in case no logger
+   * has been registered yet.
+   * 
+   * @param name the name for the logger, for example "java.awt" or
+   *            "com.foo.bar". The name should be based on the name of the
+   *            package issuing log records and consist of dot-separated Java
+   *            identifiers.
+   * @throws IllegalArgumentException if a logger for the subsystem identified
+   *             by <code>name</code> has already been created, but uses a a
+   *             resource bundle for localizing messages.
+   * @throws NullPointerException if <code>name</code> is <code>null</code>.
+   * @return a logger for the subsystem specified by <code>name</code> that
+   *         does not localize messages.
+   */
+  public static Logger getLogger(String name)
+  {
+    return getLogger(name, null);
+  }
+
+  /**
+   * Finds a registered logger for a subsystem, or creates one in case no logger
+   * has been registered yet.
+   * <p>
+   * If a logger with the specified name has already been registered, the
+   * behavior depends on the resource bundle that is currently associated with
+   * the existing logger.
+   * <ul>
+   * <li>If the existing logger uses the same resource bundle as specified by
+   * <code>resourceBundleName</code>, the existing logger is returned.</li>
+   * <li>If the existing logger currently does not localize messages, the
+   * existing logger is modified to use the bundle specified by
+   * <code>resourceBundleName</code>. The existing logger is then returned.
+   * Therefore, all subsystems currently using this logger will produce
+   * localized messages from now on.</li>
+   * <li>If the existing logger already has an associated resource bundle, but
+   * a different one than specified by <code>resourceBundleName</code>, an
+   * <code>IllegalArgumentException</code> is thrown.</li>
+   * </ul>
+   * 
+   * @param name the name for the logger, for example "java.awt" or
+   *            "org.gnu.foo". The name should be based on the name of the
+   *            package issuing log records and consist of dot-separated Java
+   *            identifiers.
+   * @param resourceBundleName the name of a resource bundle for localizing
+   *            messages, or <code>null</code> to indicate that messages do
+   *            not need to be localized.
+   * @return a logger for the subsystem specified by <code>name</code>.
+   * @throws java.util.MissingResourceException if
+   *             <code>resourceBundleName</code> is not <code>null</code>
+   *             and no such bundle could be located.
+   * @throws IllegalArgumentException if a logger for the subsystem identified
+   *             by <code>name</code> has already been created, but uses a
+   *             different resource bundle for localizing messages.
+   * @throws NullPointerException if <code>name</code> is <code>null</code>.
+   */
+  public static Logger getLogger(String name, String resourceBundleName)
+  {
+    LogManager lm = LogManager.getLogManager();
+    Logger result;
+
+    if (name == null)
+      throw new /*NullPointer*/Exception("NullPointerException");
+
+    /*
+     * Without synchronized(lm), it could happen that another thread would
+     * create a logger between our calls to getLogger and addLogger. While
+     * addLogger would indicate this by returning false, we could not be sure
+     * that this other logger was still existing when we called getLogger a
+     * second time in order to retrieve it -- note that LogManager is only
+     * allowed to keep weak references to registered loggers, so Loggers can be
+     * garbage collected at any time in general, and between our call to
+     * addLogger and our second call go getLogger in particular. Of course, we
+     * assume here that LogManager.addLogger etc. are synchronizing on the
+     * global LogManager object. There is a comment in the implementation of
+     * LogManager.addLogger referring to this comment here, so that any change
+     * in the synchronization of LogManager will be reflected here.
+     */
+    synchronized (lock)
+      {
+        synchronized (lm)
+          {
+            result = lm.getLogger(name);
+            if (result == null)
+              {
+                boolean couldBeAdded;
+
+                result = new Logger(name, resourceBundleName);
+                couldBeAdded = lm.addLogger(result);
+                if (! couldBeAdded)
+                  throw new /*IllegalState*/Exception("cannot register new logger");
+              }
+            /*else
+              {
+                /*
+                 * The logger already exists. Make sure it uses the same
+                 * resource bundle for localizing messages.
+                 */
+                /*String existingBundleName = result.getResourceBundleName();
+
+                /*
+                 * The Sun J2SE 1.4 reference implementation will return the
+                 * registered logger object, even if it does not have a resource
+                 * bundle associated with it. However, it seems to change the
+                 * resourceBundle of the registered logger to the bundle whose
+                 * name was passed to getLogger.
+                 */
+                /*if ((existingBundleName == null) &&
+                    (resourceBundleName != null))
+                  {
+                    /*
+                     * If ResourceBundle.getBundle throws an exception, the
+                     * existing logger will be unchanged. This would be
+                     * different if the assignment to resourceBundleName came
+                     * first.
+                     */
+                    /*result.resourceBundle =
+                      ResourceBundle.getBundle(resourceBundleName);
+
+                    result.resourceBundleName = resourceBundleName;
+                    return result;
+                  }
+
+                if ((existingBundleName != resourceBundleName)
+                    && ((existingBundleName == null)
+                        || !existingBundleName.equals(resourceBundleName)))
+                  {
+                    throw new IllegalArgumentException();
+                  }
+              }*/
+          }
+      }
+
+    return result;
+  }
+
+  /**
+   * Creates a new, unnamed logger. Unnamed loggers are not registered in the
+   * namespace of the LogManager, and no special security permission is required
+   * for changing their state. Therefore, untrusted applets are able to modify
+   * their private logger instance obtained through this method.
+   * <p>
+   * The parent of the newly created logger will the the root logger, from which
+   * the level threshold and the handlers are inherited.
+   */
+  /*public static Logger getAnonymousLogger()
+  {
+    return getAnonymousLogger(null);
+  }*/
+
+  /**
+   * Creates a new, unnamed logger. Unnamed loggers are not registered in the
+   * namespace of the LogManager, and no special security permission is required
+   * for changing their state. Therefore, untrusted applets are able to modify
+   * their private logger instance obtained through this method.
+   * <p>
+   * The parent of the newly created logger will the the root logger, from which
+   * the level threshold and the handlers are inherited.
+   * 
+   * @param resourceBundleName the name of a resource bundle for localizing
+   *            messages, or <code>null</code> to indicate that messages do
+   *            not need to be localized.
+   * @throws java.util.MissingResourceException if
+   *             <code>resourceBundleName</code> is not <code>null</code>
+   *             and no such bundle could be located.
+   */
+  /*public static Logger getAnonymousLogger(String resourceBundleName)
+      throws MissingResourceException
+  {
+    Logger result;
+
+    result = new Logger(null, resourceBundleName);
+    result.anonymous = true;
+    return result;
+  }*/
+
+  /**
+   * Returns the name of the resource bundle that is being used for localizing
+   * messages.
+   * 
+   * @return the name of the resource bundle used for localizing messages, or
+   *         <code>null</code> if the parent's resource bundle is used for
+   *         this purpose.
+   */
+  /*public String getResourceBundleName()
+  {
+    synchronized (lock)
+      {
+        return resourceBundleName;
+      }
+  }*/
+
+  /**
+   * Returns the resource bundle that is being used for localizing messages.
+   * 
+   * @return the resource bundle used for localizing messages, or
+   *         <code>null</code> if the parent's resource bundle is used for
+   *         this purpose.
+   */
+  /*public ResourceBundle getResourceBundle()
+  {
+    synchronized (lock)
+      {
+        return resourceBundle;
+      }
+  }*/
+
+  /**
+   * Returns the severity level threshold for this <code>Handler</code>. All
+   * log records with a lower severity level will be discarded; a log record of
+   * the same or a higher level will be published unless an installed
+   * <code>Filter</code> decides to discard it.
+   * 
+   * @return the severity level below which all log messages will be discarded,
+   *         or <code>null</code> if the logger inherits the threshold from
+   *         its parent.
+   */
+  public Level getLevel()
+  {
+    synchronized (lock)
+      {
+        return level;
+      }
+  }
+
+  /**
+   * Returns whether or not a message of the specified level would be logged by
+   * this logger.
+   * 
+   * @throws NullPointerException if <code>level</code> is <code>null</code>.
+   */
+  public boolean isLoggable(Level level)
+  {
+    synchronized (lock)
+      {
+        if (this.level != null)
+          return this.level.intValue() <= level.intValue();
+
+        if (parent != null)
+          return parent.isLoggable(level);
+        else
+          return false;
+      }
+  }
+
+  /**
+   * Sets the severity level threshold for this <code>Handler</code>. All log
+   * records with a lower severity level will be discarded immediately. A log
+   * record of the same or a higher level will be published unless an installed
+   * <code>Filter</code> decides to discard it.
+   * 
+   * @param level the severity level below which all log messages will be
+   *            discarded, or <code>null</code> to indicate that the logger
+   *            should inherit the threshold from its parent.
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method
+   *             {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   */
+  public void setLevel(Level level)
+  {
+    synchronized (lock)
+      {
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();*/
+
+        this.level = level;
+      }
+  }
+
+  /*public Filter getFilter()
+  {
+    synchronized (lock)
+      {
+        return filter;
+      }
+  }*/
+
+  /**
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method
+   *             {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   */
+  /*public void setFilter(Filter filter) throws SecurityException
+  {
+    synchronized (lock)
+      {
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();
+
+        this.filter = filter;
+      }
+  }*/
+
+  /**
+   * Returns the name of this logger.
+   * 
+   * @return the name of this logger, or <code>null</code> if the logger is
+   *         anonymous.
+   */
+  public String getName()
+  {
+    /*
+     * Note that the name of a logger cannot be changed during its lifetime, so
+     * no synchronization is needed.
+     */
+    return name;
+  }
+
+  /**
+   * Passes a record to registered handlers, provided the record is considered
+   * as loggable both by {@link #isLoggable(Level)} and a possibly installed
+   * custom {@link #setFilter(Filter) filter}.
+   * <p>
+   * If the logger has been configured to use parent handlers, the record will
+   * be forwarded to the parent of this logger in addition to being processed by
+   * the handlers registered with this logger.
+   * <p>
+   * The other logging methods in this class are convenience methods that merely
+   * create a new LogRecord and pass it to this method. Therefore, subclasses
+   * usually just need to override this single method for customizing the
+   * logging behavior.
+   * 
+   * @param record the log record to be inspected and possibly forwarded.
+   */
+  public void log(LogRecord record)
+  {
+    System.println("Unimplemented Logger.log(LogRecord)");
+    /*synchronized (lock)
+      {
+        if (!isLoggable(record.getLevel()))
+          return;
+
+        if ((filter != null) && ! filter.isLoggable(record))
+          return;
+
+        /*
+         * If no logger name has been set for the log record, use the name of
+         * this logger.
+         */
+        /*if (record.getLoggerName() == null)
+          record.setLoggerName(name);
+
+        /*
+         * Avoid that some other thread is changing the logger hierarchy while
+         * we are traversing it.
+         */
+        /*synchronized (LogManager.getLogManager())
+          {
+            Logger curLogger = this;
+
+            do
+              {
+                /*
+                 * The Sun J2SE 1.4 reference implementation seems to call the
+                 * filter only for the logger whose log method is called, never
+                 * for any of its parents. Also, parent loggers publish log
+                 * record whatever their level might be. This is pretty weird,
+                 * but GNU Classpath tries to be as compatible as possible to
+                 * the reference implementation.
+                 */
+                /*for (int i = 0; i < curLogger.handlers.length; i++)
+                  curLogger.handlers[i].publish(record);
+
+                if (curLogger.getUseParentHandlers() == false)
+                  break;
+
+                curLogger = curLogger.getParent();
+              }
+            while (parent != null);
+          }
+      }*/
+  }
+
+  public void log(Level level, String message)
+  {
+    if (isLoggable(level))
+      log(level, message, (Object[]) null);
+  }
+
+  public void log(Level level, String message, Object param)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(level))
+          {
+            /*StackTraceElement*/ Object caller = getCallerStackFrame();
+            logp(level, /*caller != null ? caller.getClassName() : */"<unknown>",
+                 /*caller != null ? caller.getMethodName() : */"<unknown>",
+                 message, param);
+          }
+      }
+  }
+
+  public void log(Level level, String message, Object[] params)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(level))
+          {
+            /*StackTraceElement*/ Object caller = getCallerStackFrame();
+            logp(level, /*caller != null ? caller.getClassName() : */"<unknown>",
+                 /*caller != null ? caller.getMethodName() : */"<unknown>",
+                 message, params);
+
+          }
+      }
+  }
+
+  public void log(Level level, String message, Throwable thrown)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(level))
+          {
+            /*StackTraceElement*/ Object caller = getCallerStackFrame();
+            logp(level, /*caller != null ? caller.getClassName() : */"<unknown>",
+                 /*caller != null ? caller.getMethodName() : */"<unknown>",
+                 message, thrown);
+          }
+      }
+  }
+
+  public void logp(Level level, String sourceClass, String sourceMethod,
+                   String message)
+  {
+    synchronized (lock)
+      {
+        logp(level, sourceClass, sourceMethod, message, (Object[]) null);
+      }
+  }
+
+  public void logp(Level level, String sourceClass, String sourceMethod,
+                   String message, Object param)
+  {
+    synchronized (lock)
+      {
+        logp(level, sourceClass, sourceMethod, message, new Object[] { param });
+      }
+
+  }
+
+  /*private ResourceBundle findResourceBundle()
+  {
+    synchronized (lock)
+      {
+        if (resourceBundle != null)
+          return resourceBundle;
+
+        if (parent != null)
+          return parent.findResourceBundle();
+
+        return null;
+      }
+  }*/
+
+  private void logImpl(Level level, String sourceClass, String sourceMethod,
+                       String message, Object[] params)
+  {
+    synchronized (lock)
+      {
+        LogRecord rec = new LogRecord(level, message);
+
+        //rec.setResourceBundle(findResourceBundle());
+        rec.setSourceClassName(sourceClass);
+        rec.setSourceMethodName(sourceMethod);
+        rec.setParameters(params);
+
+        log(rec);
+      }
+  }
+
+  public void logp(Level level, String sourceClass, String sourceMethod,
+                   String message, Object[] params)
+  {
+    synchronized (lock)
+      {
+        logImpl(level, sourceClass, sourceMethod, message, params);
+      }
+  }
+
+  public void logp(Level level, String sourceClass, String sourceMethod,
+                   String message, Throwable thrown)
+  {
+    synchronized (lock)
+      {
+        LogRecord rec = new LogRecord(level, message);
+
+        //rec.setResourceBundle(resourceBundle);
+        rec.setSourceClassName(sourceClass);
+        rec.setSourceMethodName(sourceMethod);
+        rec.setThrown(thrown);
+
+        log(rec);
+      }
+  }
+
+  public void logrb(Level level, String sourceClass, String sourceMethod,
+                    String bundleName, String message)
+  {
+    synchronized (lock)
+      {
+        logrb(level, sourceClass, sourceMethod, bundleName, message,
+              (Object[]) null);
+      }
+  }
+
+  public void logrb(Level level, String sourceClass, String sourceMethod,
+                    String bundleName, String message, Object param)
+  {
+    synchronized (lock)
+      {
+        logrb(level, sourceClass, sourceMethod, bundleName, message,
+              new Object[] { param });
+      }
+  }
+
+  public void logrb(Level level, String sourceClass, String sourceMethod,
+                    String bundleName, String message, Object[] params)
+  {
+    synchronized (lock)
+      {
+        LogRecord rec = new LogRecord(level, message);
+
+        //rec.setResourceBundleName(bundleName);
+        rec.setSourceClassName(sourceClass);
+        rec.setSourceMethodName(sourceMethod);
+        rec.setParameters(params);
+
+        log(rec);
+      }
+  }
+
+  public void logrb(Level level, String sourceClass, String sourceMethod,
+                    String bundleName, String message, Throwable thrown)
+  {
+    synchronized (lock)
+      {
+        LogRecord rec = new LogRecord(level, message);
+
+        //rec.setResourceBundleName(bundleName);
+        rec.setSourceClassName(sourceClass);
+        rec.setSourceMethodName(sourceMethod);
+        rec.setThrown(thrown);
+
+        log(rec);
+      }
+  }
+
+  public void entering(String sourceClass, String sourceMethod)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          logp(Level.FINER, sourceClass, sourceMethod, "ENTRY");
+      }
+  }
+
+  public void entering(String sourceClass, String sourceMethod, Object param)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          logp(Level.FINER, sourceClass, sourceMethod, "ENTRY {0}", param);
+      }
+  }
+
+  public void entering(String sourceClass, String sourceMethod, Object[] params)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          {
+            //CPStringBuilder buf = new CPStringBuilder(80);
+            //buf.append("ENTRY");
+            String buf = "ENTRY";
+            for (int i = 0; i < params.length; i++)
+              {
+                buf += " {" + i + "}"; //buf.append(" {");
+                //buf.append(i);
+                //buf.append('}');
+              }
+
+            logp(Level.FINER, sourceClass, sourceMethod, buf.toString(), params);
+          }
+      }
+  }
+
+  public void exiting(String sourceClass, String sourceMethod)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          logp(Level.FINER, sourceClass, sourceMethod, "RETURN");
+      }
+  }
+
+  public void exiting(String sourceClass, String sourceMethod, Object result)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          logp(Level.FINER, sourceClass, sourceMethod, "RETURN {0}", result);
+      }
+  }
+
+  public void throwing(String sourceClass, String sourceMethod, Throwable thrown)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          logp(Level.FINER, sourceClass, sourceMethod, "THROW", thrown);
+      }
+  }
+
+  /**
+   * Logs a message with severity level SEVERE, indicating a serious failure
+   * that prevents normal program execution. Messages at this level should be
+   * understandable to an inexperienced, non-technical end user. Ideally, they
+   * explain in simple words what actions the user can take in order to resolve
+   * the problem.
+   * 
+   * @see Level#SEVERE
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void severe(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.SEVERE))
+          log(Level.SEVERE, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level WARNING, indicating a potential problem
+   * that does not prevent normal program execution. Messages at this level
+   * should be understandable to an inexperienced, non-technical end user.
+   * Ideally, they explain in simple words what actions the user can take in
+   * order to resolve the problem.
+   * 
+   * @see Level#WARNING
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void warning(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.WARNING))
+          log(Level.WARNING, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level INFO. {@link Level#INFO} is intended for
+   * purely informational messages that do not indicate error or warning
+   * situations. In the default logging configuration, INFO messages will be
+   * written to the system console. For this reason, the INFO level should be
+   * used only for messages that are important to end users and system
+   * administrators. Messages at this level should be understandable to an
+   * inexperienced, non-technical user.
+   * 
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void info(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.INFO))
+          log(Level.INFO, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level CONFIG. {@link Level#CONFIG} is intended
+   * for static configuration messages, for example about the windowing
+   * environment, the operating system version, etc.
+   * 
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void config(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.CONFIG))
+          log(Level.CONFIG, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level FINE. {@link Level#FINE} is intended for
+   * messages that are relevant for developers using the component generating
+   * log messages. Examples include minor, recoverable failures, or possible
+   * inefficiencies.
+   * 
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void fine(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINE))
+          log(Level.FINE, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level FINER. {@link Level#FINER} is intended
+   * for rather detailed tracing, for example entering a method, returning from
+   * a method, or throwing an exception.
+   * 
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void finer(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINER))
+          log(Level.FINER, message);
+      }
+  }
+
+  /**
+   * Logs a message with severity level FINEST. {@link Level#FINEST} is intended
+   * for highly detailed tracing, for example reaching a certain point inside
+   * the body of a method.
+   * 
+   * @param message the message text, also used as look-up key if the logger is
+   *            localizing messages with a resource bundle. While it is possible
+   *            to pass <code>null</code>, this is not recommended, since a
+   *            logging message without text is unlikely to be helpful.
+   */
+  public void finest(String message)
+  {
+    synchronized (lock)
+      {
+        if (isLoggable(Level.FINEST))
+          log(Level.FINEST, message);
+      }
+  }
+
+  /**
+   * Adds a handler to the set of handlers that get notified when a log record
+   * is to be published.
+   * 
+   * @param handler the handler to be added.
+   * @throws NullPointerException if <code>handler</code> is <code>null</code>.
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method
+   *             {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   */
+  public void addHandler(StreamHandler handler) //throws SecurityException
+  {
+    System.println("Unimplemented Logger.addHandler(StreamHandler)");
+    /*synchronized (lock)
+      {
+        if (handler == null)
+          throw new NullPointerException();
+
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();
+
+        if (! handlerList.contains(handler))
+          {
+            handlerList.add(handler);
+            handlers = getHandlers();
+          }
+      }*/
+  }
+
+  /**
+   * Removes a handler from the set of handlers that get notified when a log
+   * record is to be published.
+   * 
+   * @param handler the handler to be removed.
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method {@link
+   *             #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   * @throws NullPointerException if <code>handler</code> is <code>null</code>.
+   */
+  /*public void removeHandler(Handler handler) throws SecurityException
+  {
+    synchronized (lock)
+      {
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();
+
+        if (handler == null)
+          throw new NullPointerException();
+
+        handlerList.remove(handler);
+        handlers = getHandlers();
+      }
+  }*/
+
+  /**
+   * Returns the handlers currently registered for this Logger. When a log
+   * record has been deemed as being loggable, it will be passed to all
+   * registered handlers for publication. In addition, if the logger uses parent
+   * handlers (see {@link #getUseParentHandlers() getUseParentHandlers} and
+   * {@link #setUseParentHandlers(boolean) setUseParentHandlers}, the log
+   * record will be passed to the parent's handlers.
+   */
+  /*public Handler[] getHandlers()
+  {
+    synchronized (lock)
+      {
+        /*
+         * We cannot return our internal handlers array because we do not have
+         * any guarantee that the caller would not change the array entries.
+         */
+        /*return (Handler[]) handlerList.toArray(new Handler[handlerList.size()]);
+      }
+  }*/
+
+  /**
+   * Returns whether or not this Logger forwards log records to handlers
+   * registered for its parent loggers.
+   * 
+   * @return <code>false</code> if this Logger sends log records merely to
+   *         Handlers registered with itself; <code>true</code> if this Logger
+   *         sends log records not only to Handlers registered with itself, but
+   *         also to those Handlers registered with parent loggers.
+   */
+  /*public boolean getUseParentHandlers()
+  {
+    synchronized (lock)
+      {
+        return useParentHandlers;
+      }
+  }*/
+
+  /**
+   * Sets whether or not this Logger forwards log records to handlers registered
+   * for its parent loggers.
+   * 
+   * @param useParentHandlers <code>false</code> to let this Logger send log
+   *            records merely to Handlers registered with itself;
+   *            <code>true</code> to let this Logger send log records not only
+   *            to Handlers registered with itself, but also to those Handlers
+   *            registered with parent loggers.
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method
+   *             {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   */
+  /*public void setUseParentHandlers(boolean useParentHandlers)
+  {
+    synchronized (lock)
+      {
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();
+
+        this.useParentHandlers = useParentHandlers;
+      }
+  }*/
+
+  /**
+   * Returns the parent of this logger. By default, the parent is assigned by
+   * the LogManager by inspecting the logger's name.
+   * 
+   * @return the parent of this logger (as detemined by the LogManager by
+   *         inspecting logger names), the root logger if no other logger has a
+   *         name which is a prefix of this logger's name, or <code>null</code>
+   *         for the root logger.
+   */
+  public Logger getParent()
+  {
+    synchronized (lock)
+      {
+        return parent;
+      }
+  }
+
+  /**
+   * Sets the parent of this logger. Usually, applications do not call this
+   * method directly. Instead, the LogManager will ensure that the tree of
+   * loggers reflects the hierarchical logger namespace. Basically, this method
+   * should not be public at all, but the GNU implementation follows the API
+   * specification.
+   * 
+   * @throws NullPointerException if <code>parent</code> is <code>null</code>.
+   * @throws SecurityException if this logger is not anonymous, a security
+   *             manager exists, and the caller is not granted the permission to
+   *             control the logging infrastructure by having
+   *             LoggingPermission("control"). Untrusted code can obtain an
+   *             anonymous logger through the static factory method
+   *             {@link #getAnonymousLogger(java.lang.String) getAnonymousLogger}.
+   */
+  public void setParent(Logger parent)
+  {
+    synchronized (lock)
+      {
+        if (parent == null)
+          throw new /*NullPointer*/Exception("NullPointerException");
+
+        if (this == root)
+          throw new /*IllegalArgument*/Exception(
+                                             "the root logger can only have a null parent");
+
+        /*
+         * An application is allowed to control an anonymous logger without
+         * having the permission to control the logging infrastructure.
+         */
+        /*if (! anonymous)
+          LogManager.getLogManager().checkAccess();*/
+
+        this.parent = parent;
+      }
+  }
+
+  /**
+   * Gets the StackTraceElement of the first class that is not this class. That
+   * should be the initial caller of a logging method.
+   * 
+   * @return caller of the initial logging method or null if unknown.
+   */
+  private Object/*StackTraceElement*/ getCallerStackFrame()
+  {
+    /*Throwable t = new Throwable();
+    StackTraceElement[] stackTrace = t.getStackTrace();
+    int index = 0;
+
+    // skip to stackentries until this class
+    while (index < stackTrace.length
+           && ! stackTrace[index].getClassName().equals(getClass().getName()))
+      index++;
+
+    // skip the stackentries of this class
+    while (index < stackTrace.length
+           && stackTrace[index].getClassName().equals(getClass().getName()))
+      index++;
+
+    return index < stackTrace.length ? stackTrace[index] : null;*/
+    System.println("Logger.getCallerStackFrame() invoked");
+    return null;
+  }
+
+  /**
+   * Reset and close handlers attached to this logger. This function is package
+   * private because it must only be available to the LogManager.
+   */
+  /*void resetLogger()
+  {
+    for (int i = 0; i < handlers.length; i++)
+      {
+        handlers[i].close();
+        handlerList.remove(handlers[i]);
+      }
+    handlers = getHandlers();
+  }*/
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Long.java b/Robust/src/ClassLibrary/MGC/gnu/Long.java
new file mode 100644 (file)
index 0000000..e0e06cf
--- /dev/null
@@ -0,0 +1,832 @@
+/* Long.java -- object wrapper for long
+   Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang;
+
+/**
+ * Instances of class <code>Long</code> represent primitive
+ * <code>long</code> values.
+ *
+ * Additionally, this class provides various helper functions and variables
+ * related to longs.
+ *
+ * @author Paul Fisher
+ * @author John Keiser
+ * @author Warren Levy
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @author Ian Rogers
+ * @since 1.0
+ * @status updated to 1.5
+ */
+public final class Long //extends Number implements Comparable<Long>
+{
+  /**
+   * Compatible with JDK 1.0.2+.
+   */
+  private static final long serialVersionUID = 4290774380558885855L;
+
+  /**
+   * The minimum value a <code>long</code> can represent is
+   * -9223372036854775808L (or -2<sup>63</sup>).
+   */
+  public static final long MIN_VALUE = 0x8000000000000000L;
+
+  /**
+   * The maximum value a <code>long</code> can represent is
+   * 9223372036854775807 (or 2<sup>63</sup> - 1).
+   */
+  public static final long MAX_VALUE = 0x7fffffffffffffffL;
+
+  /**
+   * The primitive type <code>long</code> is represented by this
+   * <code>Class</code> object.
+   * @since 1.1
+   */
+  //public static final Class<Long> TYPE = (Class<Long>) VMClassLoader.getPrimitiveClass ('J');
+
+  /**
+   * The number of bits needed to represent a <code>long</code>.
+   * @since 1.5
+   */
+  public static final int SIZE = 64;
+
+  // This caches some Long values, and is used by boxing
+  // conversions via valueOf().  We cache at least -128..127;
+  // these constants control how much we actually cache.
+  private static final int MIN_CACHE = -128;
+  private static final int MAX_CACHE = 127;
+  private static final Long[] longCache = new Long[MAX_CACHE - MIN_CACHE + 1];
+  static
+  {
+    for (int i=MIN_CACHE; i <= MAX_CACHE; i++)
+      longCache[i - MIN_CACHE] = new Long(i);
+  }
+
+  /**
+   * The immutable value of this Long.
+   *
+   * @serial the wrapped long
+   */
+  private final long value;
+
+  /**
+   * Create a <code>Long</code> object representing the value of the
+   * <code>long</code> argument.
+   *
+   * @param value the value to use
+   */
+  public Long(long value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Create a <code>Long</code> object representing the value of the
+   * argument after conversion to a <code>long</code>.
+   *
+   * @param s the string to convert
+   * @throws NumberFormatException if the String does not contain a long
+   * @see #valueOf(String)
+   */
+  public Long(String s)
+  {
+    value = parseLong(s, 10, false);
+  }
+
+  /**
+   * Return the size of a string large enough to hold the given number
+   *
+   * @param num the number we want the string length for (must be positive)
+   * @param radix the radix (base) that will be used for the string
+   * @return a size sufficient for a string of num
+   */
+  private static int stringSize(long num, int radix) {
+    int exp;
+    if (radix < 4)
+      {
+        exp = 1;
+      }
+    else if (radix < 8)
+      {
+        exp = 2;
+      }
+    else if (radix < 16)
+      {
+        exp = 3;
+      }
+    else if (radix < 32)
+      {
+        exp = 4;
+      }
+    else
+      {
+        exp = 5;
+      }
+    int size=0;
+    do
+      {
+        num >>>= exp;
+        size++;
+      }
+    while(num != 0);
+    return size;
+  }
+
+  /**
+   * Converts the <code>long</code> to a <code>String</code> using
+   * the specified radix (base). If the radix exceeds
+   * <code>Character.MIN_RADIX</code> or <code>Character.MAX_RADIX</code>, 10
+   * is used instead. If the result is negative, the leading character is
+   * '-' ('\\u002D'). The remaining characters come from
+   * <code>Character.forDigit(digit, radix)</code> ('0'-'9','a'-'z').
+   *
+   * @param num the <code>long</code> to convert to <code>String</code>
+   * @param radix the radix (base) to use in the conversion
+   * @return the <code>String</code> representation of the argument
+   */
+  /*public static String toString(long num, int radix)
+  {
+    if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
+      radix = 10;
+
+    // Is the value negative?
+    boolean isNeg = num < 0;
+
+    // Is the string a single character?
+    if (!isNeg && num < radix)
+      return new String(digits, (int)num, 1, true);
+
+    // Compute string size and allocate buffer
+    // account for a leading '-' if the value is negative
+    int size;
+    int i;
+    char[] buffer;
+    if (isNeg)
+      {
+        num = -num;
+
+        // When the value is MIN_VALUE, it overflows when made positive
+        if (num < 0)
+          {
+            i = size = stringSize(MAX_VALUE, radix) + 2;
+            buffer = new char[size];
+            buffer[--i] = digits[(int) (-(num + radix) % radix)];
+            num = -(num / radix);
+          }
+        else
+          {
+            i = size = stringSize(num, radix) + 1;
+            buffer = new char[size];
+          }
+      }
+    else
+      {
+        i = size = stringSize(num, radix);
+        buffer = new char[size];
+      }
+
+    do
+      {
+        buffer[--i] = digits[(int) (num % radix)];
+        num /= radix;
+      }
+    while (num > 0);
+
+    if (isNeg)
+      buffer[--i] = '-';
+
+    // Package constructor avoids an array copy.
+    return new String(buffer, i, size - i, true);
+  }*/
+
+  /**
+   * Converts the <code>long</code> to a <code>String</code> assuming it is
+   * unsigned in base 16.
+   *
+   * @param l the <code>long</code> to convert to <code>String</code>
+   * @return the <code>String</code> representation of the argument
+   */
+  /*public static String toHexString(long l)
+  {
+    return toUnsignedString(l, 4);
+  }*/
+
+  /**
+   * Converts the <code>long</code> to a <code>String</code> assuming it is
+   * unsigned in base 8.
+   *
+   * @param l the <code>long</code> to convert to <code>String</code>
+   * @return the <code>String</code> representation of the argument
+   */
+  /*public static String toOctalString(long l)
+  {
+    return toUnsignedString(l, 3);
+  }*/
+
+  /**
+   * Converts the <code>long</code> to a <code>String</code> assuming it is
+   * unsigned in base 2.
+   *
+   * @param l the <code>long</code> to convert to <code>String</code>
+   * @return the <code>String</code> representation of the argument
+   */
+  /*public static String toBinaryString(long l)
+  {
+    return toUnsignedString(l, 1);
+  }*/
+
+  /**
+   * Converts the <code>long</code> to a <code>String</code> and assumes
+   * a radix of 10.
+   *
+   * @param num the <code>long</code> to convert to <code>String</code>
+   * @return the <code>String</code> representation of the argument
+   * @see #toString(long, int)
+   */
+  public static String toString(long num)
+  {
+    //return toString(num, 10);
+    return String.valueOf(num);
+  }
+
+  /**
+   * Converts the specified <code>String</code> into an <code>int</code>
+   * using the specified radix (base). The string must not be <code>null</code>
+   * or empty. It may begin with an optional '-', which will negate the answer,
+   * provided that there are also valid digits. Each digit is parsed as if by
+   * <code>Character.digit(d, radix)</code>, and must be in the range
+   * <code>0</code> to <code>radix - 1</code>. Finally, the result must be
+   * within <code>MIN_VALUE</code> to <code>MAX_VALUE</code>, inclusive.
+   * Unlike Double.parseDouble, you may not have a leading '+'; and 'l' or
+   * 'L' as the last character is only valid in radices 22 or greater, where
+   * it is a digit and not a type indicator.
+   *
+   * @param str the <code>String</code> to convert
+   * @param radix the radix (base) to use in the conversion
+   * @return the <code>String</code> argument converted to <code>long</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>long</code>
+   */
+  public static long parseLong(String str, int radix)
+  {
+    return parseLong(str, radix, false);
+  }
+
+  /**
+   * Converts the specified <code>String</code> into a <code>long</code>.
+   * This function assumes a radix of 10.
+   *
+   * @param s the <code>String</code> to convert
+   * @return the <code>int</code> value of <code>s</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>long</code>
+   * @see #parseLong(String, int)
+   */
+  public static long parseLong(String s)
+  {
+    return parseLong(s, 10, false);
+  }
+
+  /**
+   * Creates a new <code>Long</code> object using the <code>String</code>
+   * and specified radix (base).
+   *
+   * @param s the <code>String</code> to convert
+   * @param radix the radix (base) to convert with
+   * @return the new <code>Long</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>long</code>
+   * @see #parseLong(String, int)
+   */
+  public static Long valueOf(String s, int radix)
+  {
+    return valueOf(parseLong(s, radix, false));
+  }
+
+  /**
+   * Creates a new <code>Long</code> object using the <code>String</code>,
+   * assuming a radix of 10.
+   *
+   * @param s the <code>String</code> to convert
+   * @return the new <code>Long</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>long</code>
+   * @see #Long(String)
+   * @see #parseLong(String)
+   */
+  public static Long valueOf(String s)
+  {
+    return valueOf(parseLong(s, 10, false));
+  }
+
+  /**
+   * Returns a <code>Long</code> object wrapping the value.
+   *
+   * @param val the value to wrap
+   * @return the <code>Long</code>
+   * @since 1.5
+   */
+  public static Long valueOf(long val)
+  {
+    if (val < MIN_CACHE || val > MAX_CACHE)
+      return new Long(val);
+    else
+      return longCache[((int)val) - MIN_CACHE];
+  }
+
+  /**
+   * Convert the specified <code>String</code> into a <code>Long</code>.
+   * The <code>String</code> may represent decimal, hexadecimal, or
+   * octal numbers.
+   *
+   * <p>The extended BNF grammar is as follows:<br>
+   * <pre>
+   * <em>DecodableString</em>:
+   *      ( [ <code>-</code> ] <em>DecimalNumber</em> )
+   *    | ( [ <code>-</code> ] ( <code>0x</code> | <code>0X</code>
+   *              | <code>#</code> ) <em>HexDigit</em> { <em>HexDigit</em> } )
+   *    | ( [ <code>-</code> ] <code>0</code> { <em>OctalDigit</em> } )
+   * <em>DecimalNumber</em>:
+   *        <em>DecimalDigit except '0'</em> { <em>DecimalDigit</em> }
+   * <em>DecimalDigit</em>:
+   *        <em>Character.digit(d, 10) has value 0 to 9</em>
+   * <em>OctalDigit</em>:
+   *        <em>Character.digit(d, 8) has value 0 to 7</em>
+   * <em>DecimalDigit</em>:
+   *        <em>Character.digit(d, 16) has value 0 to 15</em>
+   * </pre>
+   * Finally, the value must be in the range <code>MIN_VALUE</code> to
+   * <code>MAX_VALUE</code>, or an exception is thrown. Note that you cannot
+   * use a trailing 'l' or 'L', unlike in Java source code.
+   *
+   * @param str the <code>String</code> to interpret
+   * @return the value of the String as a <code>Long</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>long</code>
+   * @throws NullPointerException if <code>s</code> is null
+   * @since 1.2
+   */
+  public static Long decode(String str)
+  {
+    return valueOf(parseLong(str, 10, true));
+  }
+
+  /**
+   * Return the value of this <code>Long</code> as a <code>byte</code>.
+   *
+   * @return the byte value
+   */
+  public byte byteValue()
+  {
+    return (byte) value;
+  }
+
+  /**
+   * Return the value of this <code>Long</code> as a <code>short</code>.
+   *
+   * @return the short value
+   */
+  public short shortValue()
+  {
+    return (short) value;
+  }
+
+  /**
+   * Return the value of this <code>Long</code> as an <code>int</code>.
+   *
+   * @return the int value
+   */
+  public int intValue()
+  {
+    return (int) value;
+  }
+
+  /**
+   * Return the value of this <code>Long</code>.
+   *
+   * @return the long value
+   */
+  public long longValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Long</code> as a <code>float</code>.
+   *
+   * @return the float value
+   */
+  public float floatValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Long</code> as a <code>double</code>.
+   *
+   * @return the double value
+   */
+  public double doubleValue()
+  {
+    return value;
+  }
+
+  /**
+   * Converts the <code>Long</code> value to a <code>String</code> and
+   * assumes a radix of 10.
+   *
+   * @return the <code>String</code> representation
+   */
+  public String toString()
+  {
+    //return toString(value, 10);
+    return String.valueOf(value);
+  }
+
+  /**
+   * Return a hashcode representing this Object. <code>Long</code>'s hash
+   * code is calculated by <code>(int) (value ^ (value &gt;&gt; 32))</code>.
+   *
+   * @return this Object's hash code
+   */
+  public int hashCode()
+  {
+    return (int) (value ^ (value >>> 32));
+  }
+
+  /**
+   * Returns <code>true</code> if <code>obj</code> is an instance of
+   * <code>Long</code> and represents the same long value.
+   *
+   * @param obj the object to compare
+   * @return whether these Objects are semantically equal
+   */
+  public boolean equals(Object obj)
+  {
+    return obj instanceof Long && value == ((Long) obj).value;
+  }
+
+  /**
+   * Get the specified system property as a <code>Long</code>. The
+   * <code>decode()</code> method will be used to interpret the value of
+   * the property.
+   *
+   * @param nm the name of the system property
+   * @return the system property as a <code>Long</code>, or null if the
+   *         property is not found or cannot be decoded
+   * @throws SecurityException if accessing the system property is forbidden
+   * @see System#getProperty(String)
+   * @see #decode(String)
+   */
+  public static Long getLong(String nm)
+  {
+    return getLong(nm, null);
+  }
+
+  /**
+   * Get the specified system property as a <code>Long</code>, or use a
+   * default <code>long</code> value if the property is not found or is not
+   * decodable. The <code>decode()</code> method will be used to interpret
+   * the value of the property.
+   *
+   * @param nm the name of the system property
+   * @param val the default value
+   * @return the value of the system property, or the default
+   * @throws SecurityException if accessing the system property is forbidden
+   * @see System#getProperty(String)
+   * @see #decode(String)
+   */
+  public static Long getLong(String nm, long val)
+  {
+    Long result = getLong(nm, null);
+    return result == null ? valueOf(val) : result;
+  }
+
+  /**
+   * Get the specified system property as a <code>Long</code>, or use a
+   * default <code>Long</code> value if the property is not found or is
+   * not decodable. The <code>decode()</code> method will be used to
+   * interpret the value of the property.
+   *
+   * @param nm the name of the system property
+   * @param def the default value
+   * @return the value of the system property, or the default
+   * @throws SecurityException if accessing the system property is forbidden
+   * @see System#getProperty(String)
+   * @see #decode(String)
+   */
+  public static Long getLong(String nm, Long def)
+  {
+    if (nm == null || "".equals(nm))
+      return def;
+    nm = null;//System.getProperty(nm);
+    if (nm == null)
+      return def;
+    /*try
+      {
+        return decode(nm);
+      }
+    catch (NumberFormatException e)
+      {
+        return def;
+      }*/
+  }
+
+  /**
+   * Compare two Longs numerically by comparing their <code>long</code>
+   * values. The result is positive if the first is greater, negative if the
+   * second is greater, and 0 if the two are equal.
+   *
+   * @param l the Long to compare
+   * @return the comparison
+   * @since 1.2
+   */
+  public int compareTo(Long l)
+  {
+    if (value == l.value)
+      return 0;
+    // Returns just -1 or 1 on inequality; doing math might overflow the long.
+    return value > l.value ? 1 : -1;
+  }
+
+  /**
+   * Return the number of bits set in x.
+   * @param x value to examine
+   * @since 1.5
+   */
+  public static int bitCount(long x)
+  {
+    // Successively collapse alternating bit groups into a sum.
+    x = ((x >> 1) & 0x5555555555555555L) + (x & 0x5555555555555555L);
+    x = ((x >> 2) & 0x3333333333333333L) + (x & 0x3333333333333333L);
+    int v = (int) ((x >>> 32) + x);
+    v = ((v >> 4) & 0x0f0f0f0f) + (v & 0x0f0f0f0f);
+    v = ((v >> 8) & 0x00ff00ff) + (v & 0x00ff00ff);
+    return ((v >> 16) & 0x0000ffff) + (v & 0x0000ffff);
+  }
+
+  /**
+   * Rotate x to the left by distance bits.
+   * @param x the value to rotate
+   * @param distance the number of bits by which to rotate
+   * @since 1.5
+   */
+  public static long rotateLeft(long x, int distance)
+  {
+    // This trick works because the shift operators implicitly mask
+    // the shift count.
+    return (x << distance) | (x >>> - distance);
+  }
+
+  /**
+   * Rotate x to the right by distance bits.
+   * @param x the value to rotate
+   * @param distance the number of bits by which to rotate
+   * @since 1.5
+   */
+  public static long rotateRight(long x, int distance)
+  {
+    // This trick works because the shift operators implicitly mask
+    // the shift count.
+    return (x << - distance) | (x >>> distance);
+  }
+
+  /**
+   * Find the highest set bit in value, and return a new value
+   * with only that bit set.
+   * @param value the value to examine
+   * @since 1.5
+   */
+  public static long highestOneBit(long value)
+  {
+    value |= value >>> 1;
+    value |= value >>> 2;
+    value |= value >>> 4;
+    value |= value >>> 8;
+    value |= value >>> 16;
+    value |= value >>> 32;
+    return value ^ (value >>> 1);
+  }
+
+  /**
+   * Return the number of leading zeros in value.
+   * @param value the value to examine
+   * @since 1.5
+   */
+  public static int numberOfLeadingZeros(long value)
+  {
+    value |= value >>> 1;
+    value |= value >>> 2;
+    value |= value >>> 4;
+    value |= value >>> 8;
+    value |= value >>> 16;
+    value |= value >>> 32;
+    return bitCount(~value);
+  }
+
+  /**
+   * Find the lowest set bit in value, and return a new value
+   * with only that bit set.
+   * @param value the value to examine
+   * @since 1.5
+   */
+  public static long lowestOneBit(long value)
+  {
+    // Classic assembly trick.
+    return value & - value;
+  }
+
+  /**
+   * Find the number of trailing zeros in value.
+   * @param value the value to examine
+   * @since 1.5
+   */
+  public static int numberOfTrailingZeros(long value)
+  {
+    return bitCount((value & -value) - 1);
+  }
+
+  /**
+   * Return 1 if x is positive, -1 if it is negative, and 0 if it is
+   * zero.
+   * @param x the value to examine
+   * @since 1.5
+   */
+  public static int signum(long x)
+  {
+    return (int) ((x >> 63) | (-x >>> 63));
+
+    // The LHS propagates the sign bit through every bit in the word;
+    // if X < 0, every bit is set to 1, else 0.  if X > 0, the RHS
+    // negates x and shifts the resulting 1 in the sign bit to the
+    // LSB, leaving every other bit 0.
+
+    // Hacker's Delight, Section 2-7
+  }
+
+  /**
+   * Reverse the bytes in val.
+   * @since 1.5
+   */
+  /*public static long reverseBytes(long val)
+  {
+    int hi = Integer.reverseBytes((int) val);
+    int lo = Integer.reverseBytes((int) (val >>> 32));
+    return (((long) hi) << 32) | lo;
+  }*/
+
+  /**
+   * Reverse the bits in val.
+   * @since 1.5
+   */
+  /*public static long reverse(long val)
+  {
+    long hi = Integer.reverse((int) val) & 0xffffffffL;
+    long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
+    return (hi << 32) | lo;
+  }*/
+
+  /**
+   * Helper for converting unsigned numbers to String.
+   *
+   * @param num the number
+   * @param exp log2(digit) (ie. 1, 3, or 4 for binary, oct, hex)
+   */
+  /*private static String toUnsignedString(long num, int exp)
+  {
+    // Compute string length
+    int size = 1;
+    long copy = num >>> exp;
+    while (copy != 0)
+      {
+        size++;
+        copy >>>= exp;
+      }
+    // Quick path for single character strings
+    if (size == 1)
+      return new String(digits, (int)num, 1, true);
+
+    // Encode into buffer
+    int mask = (1 << exp) - 1;
+    char[] buffer = new char[size];
+    int i = size;
+    do
+      {
+        buffer[--i] = digits[(int) num & mask];
+        num >>>= exp;
+      }
+    while (num != 0);
+
+    // Package constructor avoids an array copy.
+    return new String(buffer, i, size - i, true);
+  }*/
+
+  /**
+   * Helper for parsing longs.
+   *
+   * @param str the string to parse
+   * @param radix the radix to use, must be 10 if decode is true
+   * @param decode if called from decode
+   * @return the parsed long value
+   * @throws NumberFormatException if there is an error
+   * @throws NullPointerException if decode is true and str is null
+   * @see #parseLong(String, int)
+   * @see #decode(String)
+   */
+  private static long parseLong(String str, int radix, boolean decode)
+  {
+    if (! decode && str == null)
+      throw new /*NumberFormat*/Exception("NumberFormatException");
+    int index = 0;
+    int len = str.length();
+    boolean isNeg = false;
+    if (len == 0)
+      throw new /*NumberFormat*/Exception("NumberFormatException");
+    int ch = str.charAt(index);
+    if (ch == '-')
+      {
+        if (len == 1)
+          throw new /*NumberFormat*/Exception("NumberFormatException");
+        isNeg = true;
+        ch = str.charAt(++index);
+      }
+    if (decode)
+      {
+        if (ch == '0')
+          {
+            if (++index == len)
+              return 0;
+            if ((str.charAt(index) & ~('x' ^ 'X')) == 'X')
+              {
+                radix = 16;
+                index++;
+              }
+            else
+              radix = 8;
+          }
+        else if (ch == '#')
+          {
+            radix = 16;
+            index++;
+          }
+      }
+    if (index == len)
+      throw new /*NumberFormat*/Exception("NumberFormatException");
+
+    long max = MAX_VALUE / radix;
+    // We can't directly write `max = (MAX_VALUE + 1) / radix'.
+    // So instead we fake it.
+    if (isNeg && MAX_VALUE % radix == radix - 1)
+      ++max;
+
+    long val = 0;
+    while (index < len)
+      {
+       if (val < 0 || val > max)
+         throw new /*NumberFormat*/Exception("NumberFormatException");
+
+        ch = Character.digit(str.charAt(index++), radix);
+        val = val * radix + ch;
+        if (ch < 0 || (val < 0 && (! isNeg || val != MIN_VALUE)))
+          throw new /*NumberFormat*/Exception("NumberFormatException");
+      }
+    return isNeg ? -val : val;
+  }
+}
index 8b6717eb7910c58cd2b0fa947278c332cf853582..eca1618afcb86e99a329abb9c2d7350bbec30419 100644 (file)
@@ -354,7 +354,7 @@ public class MPN
                    zds[j-ny+i] = (int) carry;
                    carry >>>= 32;
                  }
-               zds[j] += carry;
+               zds[j] += (int)carry;
                num = carry - 1;
              }
          }
index 85b5b47af43b6386508263ea278a25520d78da63..5209446d149efd74a981ef5d8c7a90c7dcfc4059 100644 (file)
@@ -71,7 +71,7 @@ public class PrintStream extends FilterOutputStream //implements Appendable
 
   // Line separator string.
   private static final char[] line_separator
-    = {}/*SystemProperties.getProperty("line.separator", "\n").toCharArray()*/;
+    = {'\n'}/*SystemProperties.getProperty("line.separator", "\n").toCharArray()*/;
 
   /**
    *  Encoding name
@@ -449,10 +449,10 @@ public class PrintStream extends FilterOutputStream //implements Appendable
    * printed is determined by the system property <xmp>line.separator</xmp>
    * and is not necessarily the Unix '\n' newline character.
    */
-  /*public void println ()
+  public void println ()
   {
     print(line_separator, 0, line_separator.length, false);
-  }*/
+  }
 
   /**
    * This methods prints a boolean value to the stream.  <code>true</code>
diff --git a/Robust/src/ClassLibrary/MGC/gnu/PrintWriter.java b/Robust/src/ClassLibrary/MGC/gnu/PrintWriter.java
new file mode 100644 (file)
index 0000000..6ea297f
--- /dev/null
@@ -0,0 +1,648 @@
+/* PrintWriter.java -- prints primitive values and objects to a stream as text
+   Copyright (C) 1998, 1999, 2000, 2001, 2005  Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+/* Written using "Java Class Libraries", 2nd edition, plus online
+ * API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ * However, should use native methods for conversion.
+ */
+
+/**
+ * This class prints Java primitive values and objects to a stream as
+ * text.  None of the methods in this class throw an exception.  However,
+ * errors can be detected by calling the <code>checkError()</code> method.
+ * Additionally, this stream can be designated as "autoflush" when 
+ * created so that any writes are automatically flushed to the underlying
+ * output sink whenever one of the <code>println</code> methods is
+ * called.  (Note that this differs from the <code>PrintStream</code>
+ * class which also auto-flushes when it encounters a newline character
+ * in the chars written).
+ *
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @date April 17, 1998.  
+ */
+public class PrintWriter extends Writer
+{
+  /**
+   * <code>true</code> if auto-flush is enabled, <code>false</code> otherwise
+   */
+  private boolean autoflush;
+
+  /**
+   * This boolean indicates whether or not an error has ever occurred
+   * on this stream.
+   */
+  private boolean error;
+  
+  /**
+   * Indicates whether or not the stream has been closed.
+   */
+  private boolean closed;
+
+  /**
+   * This is the underlying <code>Writer</code> we are sending output
+   * to
+   */
+  protected Writer out;
+
+  /**
+   * This method intializes a new <code>PrintWriter</code> object to write
+   * to the specified output sink.  The form of the constructor does not
+   * enable auto-flush functionality.
+   *
+   * @param wr The <code>Writer</code> to write to.
+   */
+  public PrintWriter(Writer wr)
+  {
+    //super(wr.lock);
+    this.out = wr;
+  }
+
+  /**
+   * This method intializes a new <code>PrintWriter</code> object to write
+   * to the specified output sink.  This constructor also allows "auto-flush"
+   * functionality to be specified where the stream will be flushed after
+   * every line is terminated or newline character is written.
+   *
+   * @param wr The <code>Writer</code> to write to.
+   * @param autoflush <code>true</code> to flush the stream after every 
+   * line, <code>false</code> otherwise
+   */
+  public PrintWriter(Writer wr, boolean autoflush)
+  {
+    //super(wr.lock);
+    this.out = wr;
+    this.autoflush = autoflush;
+  }
+
+  /**
+   * This method initializes a new <code>PrintWriter</code> object to write
+   * to the specified <code>OutputStream</code>.  Characters will be converted
+   * to chars using the system default encoding.  Auto-flush functionality
+   * will not be enabled.
+   *
+   * @param out The <code>OutputStream</code> to write to
+   */
+  /*public PrintWriter(OutputStream out)
+  {
+    super();
+    this.out = new OutputStreamWriter(out);
+    this.lock = this.out;
+  }*/
+
+  /**
+   * This method initializes a new <code>PrintWriter</code> object to write
+   * to the specified <code>OutputStream</code>.  Characters will be converted
+   * to chars using the system default encoding.  This form of the 
+   * constructor allows auto-flush functionality to be enabled if desired
+   *
+   * @param out The <code>OutputStream</code> to write to
+   * @param autoflush <code>true</code> to flush the stream after every 
+   * <code>println</code> call, <code>false</code> otherwise.
+   */
+  /*public PrintWriter(OutputStream out, boolean autoflush)
+  {
+    this(out);
+    this.autoflush = autoflush;
+  }*/
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the default encoding.
+   * @param file name of the file to write to
+   * @throws FileNotFoundException if the file cannot be written or created
+   * 
+   * @since 1.5
+   */
+  /*public PrintWriter(String file) throws FileNotFoundException
+  {
+    this(new FileOutputStream(file));
+  }*/
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the specified encoding.
+   * @param file name of the file to write to
+   * @param enc the encoding to use
+   * @throws FileNotFoundException if the file cannot be written or created
+   * @throws UnsupportedEncodingException if the encoding is not supported
+   * 
+   * @since 1.5
+   */
+  /*public PrintWriter(String file, String enc) 
+    throws FileNotFoundException, UnsupportedEncodingException
+  {
+    this(new OutputStreamWriter(new FileOutputStream(file), enc));
+  }*/
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the default encoding.
+   * @param file the file to write to
+   * @throws FileNotFoundException if the file cannot be written or created
+   * 
+   * @since 1.5
+   */
+  /*public PrintWriter(File file) throws FileNotFoundException
+  {
+    this(new FileOutputStream(file));
+  }*/
+
+  /**
+   * This initializes a new PrintWriter object to write to the specified
+   * file.  It creates a FileOutputStream object and wraps it in an
+   * OutputStreamWriter using the specified encoding.
+   * @param file the file to write to
+   * @param enc the encoding to use
+   * @throws FileNotFoundException if the file cannot be written or created
+   * @throws UnsupportedEncodingException if the encoding is not supported
+   * 
+   * @since 1.5
+   */
+  /*public PrintWriter(File file, String enc) 
+    throws FileNotFoundException, UnsupportedEncodingException
+  {
+    this(new OutputStreamWriter(new FileOutputStream(file), enc));
+  }*/
+
+  /**
+   * This method can be called by subclasses to indicate that an error
+   * has occurred and should be reported by <code>checkError</code>.
+   */
+  protected void setError()
+  {
+    error = true;
+  }
+
+  /**
+   * This method checks to see if an error has occurred on this stream.  Note
+   * that once an error has occurred, this method will continue to report
+   * <code>true</code> forever for this stream.  Before checking for an
+   * error condition, this method flushes the stream.
+   *
+   * @return <code>true</code> if an error has occurred, 
+   * <code>false</code> otherwise
+   */
+  public boolean checkError()
+  {
+    if (! closed)
+      flush();
+    return error;
+  }
+
+  /**
+   * This method flushes any buffered chars to the underlying stream and
+   * then flushes that stream as well.
+   */
+  public void flush()
+  {
+    /*try
+      {
+       out.flush();
+      }
+    catch (IOException ex)
+      {
+       error = true;
+      }*/
+    System.printString("Unimplemented flush() in PrintWriter\n");
+  }
+
+  /**
+   * This method closes this stream and all underlying streams.
+   */
+  public void close()
+  {
+    /*try
+      {
+        out.close();
+        closed = true;
+      }
+    catch (IOException ex)
+      {
+       error = true;
+      }*/
+    System.printString("Unimplemented close() in PrintWriter\n");
+  }
+
+  /**
+   * This method prints a <code>String</code> to the stream.  The actual
+   * value printed depends on the system default encoding.
+   *
+   * @param str The <code>String</code> to print.
+   */
+  public void print(String str)
+  {
+    write(str == null ? "null" : str);
+  }
+
+  /**
+   * This method prints a char to the stream.  The actual value printed is
+   * determined by the character encoding in use.
+   *
+   * @param ch The <code>char</code> value to be printed
+   */
+  public void print(char ch)
+  {
+    write((int) ch);
+  }
+
+  /**
+   * This method prints an array of characters to the stream.  The actual
+   * value printed depends on the system default encoding.
+   *
+   * @param charArray The array of characters to print.
+   */
+  public void print(char[] charArray)
+  {
+    write(charArray, 0, charArray.length);
+  }
+
+  /**
+   * This methods prints a boolean value to the stream.  <code>true</code>
+   * values are printed as "true" and <code>false</code> values are printed
+   * as "false".
+   *
+   * @param bool The <code>boolean</code> value to print
+   */
+  public void print(boolean bool)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write (bool ? "true" : "false");
+  }
+
+  /**
+   * This method prints an integer to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * @param inum The <code>int</code> value to be printed
+   */
+  public void print(int inum)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write(Integer.toString(inum));
+  }
+
+  /**
+   * This method prints a long to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * @param lnum The <code>long</code> value to be printed
+   */
+  /*public void print(long lnum)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write(Long.toString(lnum));
+  }*/
+
+  /**
+   * This method prints a float to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * @param fnum The <code>float</code> value to be printed
+   */
+  /*public void print(float fnum)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write(Float.toString(fnum));
+  }*/
+
+  /**
+   * This method prints a double to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * @param dnum The <code>double</code> value to be printed
+   */
+  /*public void print(double dnum)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write(Double.toString(dnum));
+  }*/
+
+  /**
+   * This method prints an <code>Object</code> to the stream.  The actual
+   * value printed is determined by calling the <code>String.valueOf()</code>
+   * method.
+   *
+   * @param obj The <code>Object</code> to print.
+   */
+  public void print(Object obj)
+  {
+    // We purposely call write() and not print() here.  This preserves
+    // compatibility with JDK 1.2.
+    write(obj == null ? "null" : obj.toString());
+  }
+
+  /**
+   * This is the system dependent line separator
+   */
+  private static final char[] line_separator
+    = {"\n"}; //System.getProperty("line.separator", "\n").toCharArray(); 
+
+  /**
+   * This method prints a line separator sequence to the stream.  The value
+   * printed is determined by the system property <xmp>line.separator</xmp>
+   * and is not necessarily the Unix '\n' newline character.
+   */
+  public void println()
+  {
+    synchronized (lock)
+      {
+       try
+         {
+           write(line_separator, 0, line_separator.length);
+           if (autoflush)
+             out.flush();
+         }
+       catch (/*IO*/Exception ex)
+         {
+           error = true;
+         }
+      }
+  }
+
+  /**
+   * This methods prints a boolean value to the stream.  <code>true</code>
+   * values are printed as "true" and <code>false</code> values are printed
+   * as "false".
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param bool The <code>boolean</code> value to print
+   */
+  public void println(boolean bool)
+  {
+    synchronized (lock)
+      {
+       print(bool);
+       println();
+      }
+  }
+
+  /**
+   * This method prints an integer to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param inum The <code>int</code> value to be printed
+   */
+  public void println(int inum)
+  {
+    synchronized (lock)
+      {
+       print(inum);
+       println();
+      }
+  }
+
+  /**
+   * This method prints a long to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param lnum The <code>long</code> value to be printed
+   */
+  /*public void println(long lnum)
+  {
+    synchronized (lock)
+      {
+       print(lnum);
+       println();
+      }
+  }*/
+
+  /**
+   * This method prints a float to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param fnum The <code>float</code> value to be printed
+   */
+  /*public void println(float fnum)
+  {
+    synchronized (lock)
+      {
+       print(fnum);
+       println();
+      }
+  }*/
+
+  /**
+   * This method prints a double to the stream.  The value printed is
+   * determined using the <code>String.valueOf()</code> method.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param dnum The <code>double</code> value to be printed
+   */
+  /*public void println(double dnum)
+  {
+    synchronized (lock)
+      {
+       print(dnum);
+       println();
+      }
+  }*/
+
+  /**
+   * This method prints an <code>Object</code> to the stream.  The actual
+   * value printed is determined by calling the <code>String.valueOf()</code>
+   * method.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param obj The <code>Object</code> to print.
+   */
+  public void println(Object obj)
+  {
+    synchronized (lock)
+      {
+       print(obj);
+       println();
+      }
+  }
+
+  /**
+   * This method prints a <code>String</code> to the stream.  The actual
+   * value printed depends on the system default encoding.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param str The <code>String</code> to print.
+   */
+  public void println(String str)
+  {
+    synchronized (lock)
+      {
+       print(str);
+       println();
+      }
+  }
+
+  /**
+   * This method prints a char to the stream.  The actual value printed is
+   * determined by the character encoding in use.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param ch The <code>char</code> value to be printed
+   */
+  public void println(char ch)
+  {
+    synchronized (lock)
+      {
+       print(ch);
+       println();
+      }
+  }
+
+  /**
+   * This method prints an array of characters to the stream.  The actual
+   * value printed depends on the system default encoding.
+   *
+   * This method prints a line termination sequence after printing the value.
+   *
+   * @param charArray The array of characters to print.
+   */
+  public void println(char[] charArray)
+  {
+    synchronized (lock)
+      {
+       print(charArray);
+       println();
+      }
+  }
+
+  /**
+   * This method writes a single char to the stream. 
+   * 
+   * @param ch The char to be written, passed as a int
+   */
+  public void write(int ch)
+  {
+    try
+      {
+       out.write(ch);
+      }
+    catch (/*IO*/Exception ex)
+      {
+       error = true;
+      }
+  }
+
+  /**
+   * This method writes <code>count</code> chars from the specified array 
+   * starting at index <code>offset</code> into the array.
+   *
+   * @param charArray The array of chars to write
+   * @param offset The index into the array to start writing from
+   * @param count The number of chars to write
+  */
+  public void write(char[] charArray, int offset, int count)
+  {
+    try
+      {
+       out.write(charArray, offset, count);
+      }
+    catch (/*IO*/Exception ex)
+      {
+       error = true;
+      }
+  }
+
+  /**
+   * This method writes <code>count</code> chars from the specified
+   * <code>String</code> to the output starting at character position
+   * <code>offset</code> into the <code>String</code>
+   *
+   * @param str The <code>String</code> to write chars from
+   * @param offset The offset into the <code>String</code> to start writing from
+   * @param count The number of chars to write.
+   */
+  public void write(String str, int offset, int count)
+  {
+    try
+      {
+       out.write(str, offset, count);
+      }
+    catch (/*IO*/Exception ex)
+      {
+       error = true;
+      }
+  }
+
+  /**
+   * This method write all the chars in the specified array to the output.
+   *
+   * @param charArray The array of characters to write
+   */
+  public void write(char[] charArray)
+  {
+    write(charArray, 0, charArray.length);
+  }  
+
+  /**
+   * This method writes the contents of the specified <code>String</code>
+   * to the underlying stream.
+   *
+   * @param str The <code>String</code> to write
+   */
+  public void write(String str)
+  {
+    write(str, 0, str.length());
+  }  
+
+  /** @since 1.5 */
+  public PrintWriter append(char c)
+  {
+    write(c);
+    return this;
+  }
+}
+
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Properties.java b/Robust/src/ClassLibrary/MGC/gnu/Properties.java
new file mode 100644 (file)
index 0000000..9773788
--- /dev/null
@@ -0,0 +1,825 @@
+/* Properties.java -- a set of persistent properties
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+/**
+ * A set of persistent properties, which can be saved or loaded from a stream.
+ * A property list may also contain defaults, searched if the main list
+ * does not contain a property for a given key.
+ *
+ * An example of a properties file for the german language is given
+ * here.  This extends the example given in ListResourceBundle.
+ * Create a file MyResource_de.properties with the following contents
+ * and put it in the CLASSPATH.  (The character
+ * <code>\</code><code>u00e4</code> is the german umlaut)
+ *
+ * 
+<pre>s1=3
+s2=MeineDisk
+s3=3. M\<code></code>u00e4rz 96
+s4=Die Diskette ''{1}'' enth\<code></code>u00e4lt {0} in {2}.
+s5=0
+s6=keine Dateien
+s7=1
+s8=eine Datei
+s9=2
+s10={0,number} Dateien
+s11=Das Formatieren schlug fehl mit folgender Exception: {0}
+s12=FEHLER
+s13=Ergebnis
+s14=Dialog
+s15=Auswahlkriterium
+s16=1,3</pre>
+ *
+ * <p>Although this is a sub class of a hash table, you should never
+ * insert anything other than strings to this property, or several
+ * methods, that need string keys and values, will fail.  To ensure
+ * this, you should use the <code>get/setProperty</code> method instead
+ * of <code>get/put</code>.
+ *
+ * Properties are saved in ISO 8859-1 encoding, using Unicode escapes with
+ * a single <code>u</code> for any character which cannot be represented.
+ *
+ * @author Jochen Hoenicke
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @see PropertyResourceBundle
+ * @status updated to 1.4
+ */
+public class Properties //extends Hashtable//<Object, Object>
+{
+  // WARNING: Properties is a CORE class in the bootstrap cycle. See the
+  // comments in vm/reference/java/lang/Runtime for implications of this fact.
+
+  /**
+   * The property list that contains default values for any keys not
+   * in this property list.
+   *
+   * @serial the default properties
+   */
+  Hashtable proptbl;
+  
+  protected Properties defaults;
+
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = 4112578634029874840L;
+
+  /**
+   * Creates a new empty property list with no default values.
+   */
+  public Properties()
+  {
+    proptbl = new Hashtable();
+  }
+
+  /**
+   * Create a new empty property list with the specified default values.
+   *
+   * @param defaults a Properties object containing the default values
+   */
+  public Properties(Properties defaults)
+  {
+    proptbl = new Hashtable();
+    this.defaults = defaults;
+  }
+
+  /**
+   * Adds the given key/value pair to this properties.  This calls
+   * the hashtable method put.
+   *
+   * @param key the key for this property
+   * @param value the value for this property
+   * @return The old value for the given key
+   * @see #getProperty(String)
+   * @since 1.2
+   */
+  public Object setProperty(String key, String value)
+  {
+    return proptbl.put(key, value);
+  }
+  
+  public Object put(String key, String value)
+  {
+    return proptbl.put(key, value);
+  }
+
+  /**
+   * Reads a property list from a character stream.  The stream should
+   * have the following format: <br>
+   *
+   * An empty line or a line starting with <code>#</code> or
+   * <code>!</code> is ignored.  An backslash (<code>\</code>) at the
+   * end of the line makes the line continueing on the next line
+   * (but make sure there is no whitespace after the backslash).
+   * Otherwise, each line describes a key/value pair. <br>
+   *
+   * The chars up to the first whitespace, = or : are the key.  You
+   * can include this caracters in the key, if you precede them with
+   * a backslash (<code>\</code>). The key is followed by optional
+   * whitespaces, optionally one <code>=</code> or <code>:</code>,
+   * and optionally some more whitespaces.  The rest of the line is
+   * the resource belonging to the key. <br>
+   *
+   * Escape sequences <code>\t, \n, \r, \\, \", \', \!, \#, \ </code>(a
+   * space), and unicode characters with the
+   * <code>\\u</code><em>xxxx</em> notation are detected, and
+   * converted to the corresponding single character. <br>
+   *
+   * 
+<pre># This is a comment
+key     = value
+k\:5      \ a string starting with space and ending with newline\n
+# This is a multiline specification; note that the value contains
+# no white space.
+weekdays: Sunday,Monday,Tuesday,Wednesday,\\
+          Thursday,Friday,Saturday
+# The safest way to include a space at the end of a value:
+label   = Name:\\u0020</pre>
+   *
+   * @param inReader the input {@link java.io.Reader}.
+   * @throws IOException if an error occurred when reading the input
+   * @throws NullPointerException if in is null
+   * @since 1.6
+   */
+  /*public void load(Reader inReader) throws IOException
+  {
+    BufferedReader reader = new BufferedReader(inReader);
+    String line;
+
+    while ((line = reader.readLine()) != null)
+      {
+        char c = 0;
+        int pos = 0;
+       // Leading whitespaces must be deleted first.
+        while (pos < line.length()
+               && Character.isWhitespace(c = line.charAt(pos)))
+          pos++;
+
+        // If empty line or begins with a comment character, skip this line.
+        if ((line.length() - pos) == 0
+           || line.charAt(pos) == '#' || line.charAt(pos) == '!')
+          continue;
+
+        // The characters up to the next Whitespace, ':', or '='
+        // describe the key.  But look for escape sequences.
+       // Try to short-circuit when there is no escape char.
+       int start = pos;
+       boolean needsEscape = line.indexOf('\\', pos) != -1;
+        CPStringBuilder key = needsEscape ? new CPStringBuilder() : null;
+        while (pos < line.length()
+               && ! Character.isWhitespace(c = line.charAt(pos++))
+               && c != '=' && c != ':')
+          {
+            if (needsEscape && c == '\\')
+              {
+                if (pos == line.length())
+                  {
+                    // The line continues on the next line.  If there
+                    // is no next line, just treat it as a key with an
+                    // empty value.
+                    line = reader.readLine();
+                   if (line == null)
+                     line = "";
+                    pos = 0;
+                    while (pos < line.length()
+                           && Character.isWhitespace(c = line.charAt(pos)))
+                      pos++;
+                  }
+                else
+                  {
+                    c = line.charAt(pos++);
+                    switch (c)
+                      {
+                      case 'n':
+                        key.append('\n');
+                        break;
+                      case 't':
+                        key.append('\t');
+                        break;
+                      case 'r':
+                        key.append('\r');
+                        break;
+                      case 'u':
+                        if (pos + 4 <= line.length())
+                          {
+                            char uni = (char) Integer.parseInt
+                              (line.substring(pos, pos + 4), 16);
+                            key.append(uni);
+                            pos += 4;
+                          }        // else throw exception?
+                        break;
+                      default:
+                        key.append(c);
+                        break;
+                      }
+                  }
+              }
+            else if (needsEscape)
+              key.append(c);
+          }
+
+        boolean isDelim = (c == ':' || c == '=');
+
+       String keyString;
+       if (needsEscape)
+         keyString = key.toString();
+       else if (isDelim || Character.isWhitespace(c))
+         keyString = line.substring(start, pos - 1);
+       else
+         keyString = line.substring(start, pos);
+
+        while (pos < line.length()
+               && Character.isWhitespace(c = line.charAt(pos)))
+          pos++;
+
+        if (! isDelim && (c == ':' || c == '='))
+          {
+            pos++;
+            while (pos < line.length()
+                   && Character.isWhitespace(c = line.charAt(pos)))
+              pos++;
+          }
+
+       // Short-circuit if no escape chars found.
+       if (!needsEscape)
+         {
+           put(keyString, line.substring(pos));
+           continue;
+         }
+
+       // Escape char found so iterate through the rest of the line.
+        StringBuilder element = new StringBuilder(line.length() - pos);
+        while (pos < line.length())
+          {
+            c = line.charAt(pos++);
+            if (c == '\\')
+              {
+                if (pos == line.length())
+                  {
+                    // The line continues on the next line.
+                    line = reader.readLine();
+
+                   // We might have seen a backslash at the end of
+                   // the file.  The JDK ignores the backslash in
+                   // this case, so we follow for compatibility.
+                   if (line == null)
+                     break;
+
+                    pos = 0;
+                    while (pos < line.length()
+                           && Character.isWhitespace(c = line.charAt(pos)))
+                      pos++;
+                    element.ensureCapacity(line.length() - pos +
+                                           element.length());
+                  }
+                else
+                  {
+                    c = line.charAt(pos++);
+                    switch (c)
+                      {
+                      case 'n':
+                        element.append('\n');
+                        break;
+                      case 't':
+                        element.append('\t');
+                        break;
+                      case 'r':
+                        element.append('\r');
+                        break;
+                      case 'u':
+                        if (pos + 4 <= line.length())
+                          {
+                            char uni = (char) Integer.parseInt
+                              (line.substring(pos, pos + 4), 16);
+                            element.append(uni);
+                            pos += 4;
+                          }        // else throw exception?
+                        break;
+                      default:
+                        element.append(c);
+                        break;
+                      }
+                  }
+              }
+            else
+              element.append(c);
+          }
+        put(keyString, element.toString());
+      }
+  }*/
+
+  /**
+   * Reads a property list from the supplied input stream.
+   * This method has the same functionality as {@link #load(Reader)}
+   * but the character encoding is assumed to be ISO-8859-1.
+   * Unicode characters not within the Latin1 set supplied by
+   * ISO-8859-1 should be escaped using '\\uXXXX' where XXXX
+   * is the UTF-16 code unit in hexadecimal.
+   *
+   * @param inStream the byte stream to read the property list from.
+   * @throws IOException if an I/O error occurs.
+   * @see #load(Reader)
+   * @since 1.2
+   */
+  public void load(InputStream inStream) throws IOException
+  {
+    //load(new InputStreamReader(inStream, "ISO-8859-1"));
+    System.println("Properties.load(InputStream) invoked");
+  }
+
+  /**
+   * Calls <code>store(OutputStream out, String header)</code> and
+   * ignores the IOException that may be thrown.
+   *
+   * @param out the stream to write to
+   * @param header a description of the property list
+   * @throws ClassCastException if this property contains any key or
+   *         value that are not strings
+   * @deprecated use {@link #store(OutputStream, String)} instead
+   */
+  //@Deprecated
+  /*public void save(OutputStream out, String header)
+  {
+    try
+      {
+        store(out, header);
+      }
+    catch (IOException ex)
+      {
+      }
+  }*/
+
+  /**
+   * Writes the key/value pairs to the given output stream, in a format
+   * suitable for <code>load</code>.<br>
+   *
+   * If header is not null, this method writes a comment containing
+   * the header as first line to the stream.  The next line (or first
+   * line if header is null) contains a comment with the current date.
+   * Afterwards the key/value pairs are written to the stream in the
+   * following format.<br>
+   *
+   * Each line has the form <code>key = value</code>.  Newlines,
+   * Returns and tabs are written as <code>\n,\t,\r</code> resp.
+   * The characters <code>\, !, #, =</code> and <code>:</code> are
+   * preceeded by a backslash.  Spaces are preceded with a backslash,
+   * if and only if they are at the beginning of the key.  Characters
+   * that are not in the ascii range 33 to 127 are written in the
+   * <code>\</code><code>u</code>xxxx Form.<br>
+   *
+   * Following the listing, the output stream is flushed but left open.
+   *
+   * @param out the output stream
+   * @param header the header written in the first line, may be null
+   * @throws ClassCastException if this property contains any key or
+   *         value that isn't a string
+   * @throws IOException if writing to the stream fails
+   * @throws NullPointerException if out is null
+   * @since 1.2
+   */
+  public void store(OutputStream out, String header)// throws IOException
+  {
+    // The spec says that the file must be encoded using ISO-8859-1.
+    /*PrintWriter writer
+      = new PrintWriter(new OutputStreamWriter(out, "ISO-8859-1"));
+    if (header != null)
+      writer.println("#" + header);
+    writer.println ("#" + Calendar.getInstance ().getTime ());
+    
+    Iterator iter = entrySet ().iterator ();
+    int i = size ();
+    CPStringBuilder s = new CPStringBuilder (); // Reuse the same buffer.
+    while (--i >= 0)
+      {
+        Map.Entry entry = (Map.Entry) iter.next ();
+        formatForOutput ((String) entry.getKey (), s, true);
+        s.append ('=');
+        formatForOutput ((String) entry.getValue (), s, false);
+        writer.println (s);
+      }
+
+    writer.flush ();*/
+    System.println("Properties.store() invoked");
+  }
+
+  /**
+   * Gets the property with the specified key in this property list.
+   * If the key is not found, the default property list is searched.
+   * If the property is not found in the default, null is returned.
+   *
+   * @param key The key for this property
+   * @return the value for the given key, or null if not found
+   * @throws ClassCastException if this property contains any key or
+   *         value that isn't a string
+   * @see #defaults
+   * @see #setProperty(String, String)
+   * @see #getProperty(String, String)
+   */
+  public String getProperty(String key)
+  {
+    Hashtable tbl = this.proptbl;
+    // Eliminate tail recursion.
+    Properties prop = this.defaults;
+    while (prop != null)
+      {
+        String value = (String) tbl.get(key);
+        if (value != null)
+          return value;
+        tbl = prop.proptbl;
+        prop = prop.defaults;
+      }
+    String value = (String) tbl.get(key);
+    if (value != null)
+      return value;
+    else 
+      return null;
+  }
+
+  /**
+   * Gets the property with the specified key in this property list.  If
+   * the key is not found, the default property list is searched.  If the
+   * property is not found in the default, the specified defaultValue is
+   * returned.
+   *
+   * @param key The key for this property
+   * @param defaultValue A default value
+   * @return The value for the given key
+   * @throws ClassCastException if this property contains any key or
+   *         value that isn't a string
+   * @see #defaults
+   * @see #setProperty(String, String)
+   */
+  public String getProperty(String key, String defaultValue)
+  {
+    String prop = getProperty(key);
+    if (prop == null)
+      prop = defaultValue;
+    return prop;
+  }
+
+  /**
+   * Returns an enumeration of all keys in this property list, including
+   * the keys in the default property list.
+   *
+   * @return an Enumeration of all defined keys
+   */
+  public Enumeration/*<?>*/ propertyNames()
+  {
+    // We make a new Set that holds all the keys, then return an enumeration
+    // for that. This prevents modifications from ruining the enumeration,
+    // as well as ignoring duplicates.
+    Properties prop = this.defaults;
+    Object[] tarray = keySet().toArray();
+    HashSet s = new HashSet();
+    for(int i = 0; i < tarray.length; i++) {
+      s.add(tarray[i]);
+    }
+    // Eliminate tail recursion.
+    while (prop != null)
+      {
+        tarray = prop.keySet().toArray();
+        for(int i = 0; i < tarray.length; i++) {
+          s.add(tarray[i]);
+        }
+        prop = prop.defaults;
+      }
+    return new Enumeration(); //Collections.enumeration(s);
+  }
+  
+  public Set keySet() {
+    HashMapIterator it = this.proptbl.iterator(0);
+    Set keys = new Vector();
+    while(it.hasNext()) {
+      keys.add(it.next());
+    }
+    return keys;
+  }
+
+  /**
+   * Prints the key/value pairs to the given print stream.  This is 
+   * mainly useful for debugging purposes.
+   *
+   * @param out the print stream, where the key/value pairs are written to
+   * @throws ClassCastException if this property contains a key or a
+   *         value that isn't a string
+   * @see #list(PrintWriter)
+   */
+  /*public void list(PrintStream out)
+  {
+    PrintWriter writer = new PrintWriter (out);
+    list (writer);
+  }*/
+
+  /**
+   * Prints the key/value pairs to the given print writer.  This is
+   * mainly useful for debugging purposes.
+   *
+   * @param out the print writer where the key/value pairs are written to
+   * @throws ClassCastException if this property contains a key or a
+   *         value that isn't a string
+   * @see #list(PrintStream)
+   * @since 1.1
+   */
+  /*public void list(PrintWriter out)
+  {
+    out.println ("-- listing properties --");
+
+    Iterator iter = entrySet ().iterator ();
+    int i = size ();
+    while (--i >= 0)
+      {
+        Map.Entry entry = (Map.Entry) iter.next ();
+        out.print ((String) entry.getKey () + "=");
+
+        // JDK 1.3/1.4 restrict the printed value, but not the key,
+        // to 40 characters, including the truncating ellipsis.
+        String s = (String ) entry.getValue ();
+        if (s != null && s.length () > 40)
+          out.println (s.substring (0, 37) + "...");
+        else
+          out.println (s);
+      }
+    out.flush ();
+  }*/
+
+  /**
+   * Formats a key or value for output in a properties file.
+   * See store for a description of the format.
+   *
+   * @param str the string to format
+   * @param buffer the buffer to add it to
+   * @param key true if all ' ' must be escaped for the key, false if only
+   *        leading spaces must be escaped for the value
+   * @see #store(OutputStream, String)
+   */
+  /*private void formatForOutput(String str, CPStringBuilder buffer, boolean key)
+  {
+    if (key)
+      {
+        buffer.setLength(0);
+        buffer.ensureCapacity(str.length());
+      }
+    else
+      buffer.ensureCapacity(buffer.length() + str.length());
+    boolean head = true;
+    int size = str.length();
+    for (int i = 0; i < size; i++)
+      {
+        char c = str.charAt(i);
+        switch (c)
+          {
+          case '\n':
+            buffer.append("\\n");
+            break;
+          case '\r':
+            buffer.append("\\r");
+            break;
+          case '\t':
+            buffer.append("\\t");
+            break;
+          case ' ':
+            buffer.append(head ? "\\ " : " ");
+            break;
+          case '\\':
+          case '!':
+          case '#':
+          case '=':
+          case ':':
+            buffer.append('\\').append(c);
+            break;
+          default:
+            if (c < ' ' || c > '~')
+              {
+                String hex = Integer.toHexString(c);
+                buffer.append("\\u0000".substring(0, 6 - hex.length()));
+                buffer.append(hex);
+              }
+            else
+              buffer.append(c);
+          }
+        if (c != ' ')
+          head = key;
+      }
+  }*/
+
+  /**
+   * <p>
+   * Encodes the properties as an XML file using the UTF-8 encoding.
+   * The format of the XML file matches the DTD
+   * <a href="http://java.sun.com/dtd/properties.dtd">
+   * http://java.sun.com/dtd/properties.dtd</a>.
+   * </p>
+   * <p>
+   * Invoking this method provides the same behaviour as invoking
+   * <code>storeToXML(os, comment, "UTF-8")</code>.
+   * </p>
+   * 
+   * @param os the stream to output to.
+   * @param comment a comment to include at the top of the XML file, or
+   *                <code>null</code> if one is not required.
+   * @throws IOException if the serialization fails.
+   * @throws NullPointerException if <code>os</code> is null.
+   * @since 1.5
+   */
+  /*public void storeToXML(OutputStream os, String comment)
+    throws IOException
+  {
+    storeToXML(os, comment, "UTF-8");
+  }*/
+
+  /**
+   * <p>
+   * Encodes the properties as an XML file using the supplied encoding.
+   * The format of the XML file matches the DTD
+   * <a href="http://java.sun.com/dtd/properties.dtd">
+   * http://java.sun.com/dtd/properties.dtd</a>.
+   * </p>
+   * 
+   * @param os the stream to output to.
+   * @param comment a comment to include at the top of the XML file, or
+   *                <code>null</code> if one is not required.
+   * @param encoding the encoding to use for the XML output.
+   * @throws IOException if the serialization fails.
+   * @throws NullPointerException if <code>os</code> or <code>encoding</code>
+   *                              is null.
+   * @since 1.5
+   */
+  /*public void storeToXML(OutputStream os, String comment, String encoding)
+    throws IOException
+  {
+    if (os == null)
+      throw new NullPointerException("Null output stream supplied.");
+    if (encoding == null)
+      throw new NullPointerException("Null encoding supplied.");
+    try
+      {
+       DOMImplementationRegistry registry = 
+         DOMImplementationRegistry.newInstance();
+       DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
+       DocumentType doctype =
+         domImpl.createDocumentType("properties", null,
+                                    "http://java.sun.com/dtd/properties.dtd");
+       Document doc = domImpl.createDocument(null, "properties", doctype);
+       Element root = doc.getDocumentElement();
+       if (comment != null)
+         {
+           Element commentElement = doc.createElement("comment");
+           commentElement.appendChild(doc.createTextNode(comment));
+           root.appendChild(commentElement);
+         }
+       Iterator iterator = entrySet().iterator();
+       while (iterator.hasNext())
+         {
+           Map.Entry entry = (Map.Entry) iterator.next();
+           Element entryElement = doc.createElement("entry");
+           entryElement.setAttribute("key", (String) entry.getKey());
+           entryElement.appendChild(doc.createTextNode((String)
+                                                       entry.getValue()));
+           root.appendChild(entryElement);
+         }
+       DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
+       LSSerializer serializer = loadAndSave.createLSSerializer();
+       LSOutput output = loadAndSave.createLSOutput();
+       output.setByteStream(os);
+       output.setEncoding(encoding);
+       serializer.write(doc, output);
+      }
+    catch (ClassNotFoundException e)
+      {
+       throw (IOException) 
+         new IOException("The XML classes could not be found.").initCause(e);
+      }
+    catch (InstantiationException e)
+      {
+       throw (IOException)
+         new IOException("The XML classes could not be instantiated.")
+         .initCause(e);
+      }
+    catch (IllegalAccessException e)
+      {
+       throw (IOException)
+         new IOException("The XML classes could not be accessed.")
+         .initCause(e);
+      }
+  }*/
+
+  /**
+   * <p>
+   * Decodes the contents of the supplied <code>InputStream</code> as
+   * an XML file, which represents a set of properties.  The format of
+   * the XML file must match the DTD
+   * <a href="http://java.sun.com/dtd/properties.dtd">
+   * http://java.sun.com/dtd/properties.dtd</a>.
+   * </p>
+   *
+   * @param in the input stream from which to receive the XML data.
+   * @throws IOException if an I/O error occurs in reading the input data.
+   * @throws InvalidPropertiesFormatException if the input data does not
+   *                                          constitute an XML properties
+   *                                          file.
+   * @throws NullPointerException if <code>in</code> is null.
+   * @since 1.5
+   */
+  /*public void loadFromXML(InputStream in)
+    throws IOException, InvalidPropertiesFormatException
+  {
+    if (in == null)
+      throw new NullPointerException("Null input stream supplied.");
+    try
+      {
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        // Don't resolve external entity references
+        factory.setProperty("javax.xml.stream.isSupportingExternalEntities",
+                            Boolean.FALSE);
+        XMLStreamReader reader = factory.createXMLStreamReader(in);
+        String name, key = null;
+        CPStringBuilder buf = null;
+        while (reader.hasNext())
+          {
+            switch (reader.next())
+              {
+              case XMLStreamConstants.START_ELEMENT:
+                name = reader.getLocalName();
+                if (buf == null && "entry".equals(name))
+                  {
+                    key = reader.getAttributeValue(null, "key");
+                    if (key == null)
+                      {
+                        String msg = "missing 'key' attribute";
+                        throw new InvalidPropertiesFormatException(msg);
+                      }
+                    buf = new CPStringBuilder();
+                  }
+                else if (!"properties".equals(name) && !"comment".equals(name))
+                  {
+                    String msg = "unexpected element name '" + name + "'";
+                    throw new InvalidPropertiesFormatException(msg);
+                  }
+                break;
+              case XMLStreamConstants.END_ELEMENT:
+                name = reader.getLocalName();
+                if (buf != null && "entry".equals(name))
+                  {
+                    put(key, buf.toString());
+                    buf = null;
+                  }
+                else if (!"properties".equals(name) && !"comment".equals(name))
+                  {
+                    String msg = "unexpected element name '" + name + "'";
+                    throw new InvalidPropertiesFormatException(msg);
+                  }
+                break;
+              case XMLStreamConstants.CHARACTERS:
+              case XMLStreamConstants.SPACE:
+              case XMLStreamConstants.CDATA:
+                if (buf != null)
+                  buf.append(reader.getText());
+                break;
+              }
+          }
+        reader.close();
+      }
+    catch (XMLStreamException e)
+      {
+       throw (InvalidPropertiesFormatException)
+         new InvalidPropertiesFormatException("Error in parsing XML.").
+         initCause(e);
+      }
+  }*/
+
+} // class Properties
index ef2268f2ce7a924258bfa12984a7fb56fbd0a812..16940c30a6db7a9bea0609d6b7087b4f63875519 100644 (file)
@@ -39,7 +39,7 @@ exception statement from your version. */
  
 //import java.nio.CharBuffer;
 
-///* Written using "Java Class Libraries", 2nd edition, plus online
+/* Written using "Java Class Libraries", 2nd edition, plus online
  * API docs for JDK 1.2 beta from http://www.javasoft.com.
  * Status:  Believed complete and correct.
  */
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Runtime.java b/Robust/src/ClassLibrary/MGC/gnu/Runtime.java
new file mode 100644 (file)
index 0000000..a5159d8
--- /dev/null
@@ -0,0 +1,107 @@
+/* Runtime.java -- access to the VM process
+   Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+/**
+ * Runtime represents the Virtual Machine.
+ *
+ * @author John Keiser
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Jeroen Frijters
+ */
+// No idea why this class isn't final, since you can't build a subclass!
+public class Runtime
+{
+  /**
+   * The one and only runtime instance.
+   */
+  private static final Runtime current = new Runtime();
+
+  /**
+   * Not instantiable by a user, this should only create one instance.
+   */
+  private Runtime()
+  {
+    if (current != null)
+      throw new InternalError("Attempt to recreate Runtime");
+  }
+
+  /**
+   * Get the current Runtime object for this JVM. This is necessary to access
+   * the many instance methods of this class.
+   *
+   * @return the current Runtime object
+   */
+  public static Runtime getRuntime()
+  {
+    return current;
+  }
+
+  /**
+   * Returns the number of available processors currently available to the
+   * virtual machine. This number may change over time; so a multi-processor
+   * program want to poll this to determine maximal resource usage.
+   *
+   * @return the number of processors available, at least 1
+   */
+  public native int availableProcessors();
+
+  /**
+   * Find out how much memory is still free for allocating Objects on the heap.
+   *
+   * @return the number of bytes of free memory for more Objects
+   */
+  public native long freeMemory();
+
+  /**
+   * Find out how much memory total is available on the heap for allocating
+   * Objects.
+   *
+   * @return the total number of bytes of memory for Objects
+   */
+  public native long totalMemory();
+
+  /**
+   * Returns the maximum amount of memory the virtual machine can attempt to
+   * use. This may be <code>Long.MAX_VALUE</code> if there is no inherent
+   * limit (or if you really do have a 8 exabyte memory!).
+   *
+   * @return the maximum number of bytes the virtual machine will attempt
+   *         to allocate
+   */
+  public native long maxMemory();
+} // class Runtime
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Set.java b/Robust/src/ClassLibrary/MGC/gnu/Set.java
new file mode 100644 (file)
index 0000000..8e59b91
--- /dev/null
@@ -0,0 +1,265 @@
+/* Set.java -- A collection that prohibits duplicates
+   Copyright (C) 1998, 2001, 2004, 2005
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+/**
+ * A collection that contains no duplicates. In other words, for two set
+ * elements e1 and e2, <code>e1.equals(e2)</code> returns false. There
+ * are additional stipulations on <code>add</code>, <code>equals</code>
+ * and <code>hashCode</code>, as well as the requirements that constructors
+ * do not permit duplicate elements. The Set interface is incompatible with
+ * List; you cannot implement both simultaneously.
+ * <p>
+ *
+ * Note: Be careful about using mutable objects in sets.  In particular,
+ * if a mutable object changes to become equal to another set element, you
+ * have violated the contract.  As a special case of this, a Set is not
+ * allowed to be an element of itself, without risking undefined behavior.
+ *
+ * @author Original author unknown
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @see Collection
+ * @see List
+ * @see SortedSet
+ * @see HashSet
+ * @see TreeSet
+ * @see LinkedHashSet
+ * @see AbstractSet
+ * @see Collections#singleton(Object)
+ * @see Collections#EMPTY_SET
+ * @since 1.2
+ * @status updated to 1.4
+ */
+public interface Set//<E> extends Collection<E>
+{
+  /**
+   * Adds the specified element to the set if it is not already present
+   * (optional operation). In particular, the comparison algorithm is
+   * <code>o == null ? e == null : o.equals(e)</code>. Sets need not permit
+   * all values, and may document what exceptions will be thrown if
+   * a value is not permitted.
+   *
+   * @param o the object to add
+   * @return true if the object was not previously in the set
+   * @throws UnsupportedOperationException if this operation is not allowed
+   * @throws ClassCastException if the class of o prevents it from being added
+   * @throws IllegalArgumentException if some aspect of o prevents it from
+   *         being added
+   * @throws NullPointerException if null is not permitted in this set
+   */
+  boolean add(Object/*E*/ o);
+
+  /**
+   * Adds all of the elements of the given collection to this set (optional
+   * operation). If the argument is also a Set, this returns the mathematical
+   * <i>union</i> of the two. The behavior is unspecified if the set is
+   * modified while this is taking place.
+   *
+   * @param c the collection to add
+   * @return true if the set changed as a result
+   * @throws UnsupportedOperationException if this operation is not allowed
+   * @throws ClassCastException if the class of an element prevents it from
+   *         being added
+   * @throws IllegalArgumentException if something about an element prevents
+   *         it from being added
+   * @throws NullPointerException if null is not permitted in this set, or
+   *         if the argument c is null
+   * @see #add(Object)
+   */
+  //boolean addAll(Collection<? extends E> c);
+
+  /**
+   * Removes all elements from this set (optional operation). This set will
+   * be empty afterwords, unless an exception occurs.
+   *
+   * @throws UnsupportedOperationException if this operation is not allowed
+   */
+  void clear();
+
+  /**
+   * Returns true if the set contains the specified element. In other words,
+   * this looks for <code>o == null ? e == null : o.equals(e)</code>.
+   *
+   * @param o the object to look for
+   * @return true if it is found in the set
+   * @throws ClassCastException if the type of o is not a valid type
+   *         for this set.
+   * @throws NullPointerException if o is null and this set doesn't
+   *         support null values.
+   */
+  boolean contains(Object o);
+
+  /**
+   * Returns true if this set contains all elements in the specified
+   * collection. If the argument is also a set, this is the <i>subset</i>
+   * relationship.
+   *
+   * @param c the collection to check membership in
+   * @return true if all elements in this set are in c
+   * @throws NullPointerException if c is null
+   * @throws ClassCastException if the type of any element in c is not
+   *         a valid type for this set.
+   * @throws NullPointerException if some element of c is null and this
+   *         set doesn't support null values.
+   * @see #contains(Object)
+   */
+  //boolean containsAll(Collection<?> c);
+
+  /**
+   * Compares the specified object to this for equality. For sets, the object
+   * must be a set, the two must have the same size, and every element in
+   * one must be in the other.
+   *
+   * @param o the object to compare to
+   * @return true if it is an equal set
+   */
+  //boolean equals(Object o);
+
+  /**
+   * Returns the hash code for this set. In order to satisfy the contract of
+   * equals, this is the sum of the hashcode of all elements in the set.
+   *
+   * @return the sum of the hashcodes of all set elements
+   * @see #equals(Object)
+   */
+  //int hashCode();
+
+  /**
+   * Returns true if the set contains no elements.
+   *
+   * @return true if the set is empty
+   */
+  boolean isEmpty();
+
+  /**
+   * Returns an iterator over the set.  The iterator has no specific order,
+   * unless further specified.
+   *
+   * @return a set iterator
+   */
+  //Iterator<E> iterator();
+
+  /**
+   * Removes the specified element from this set (optional operation). If
+   * an element e exists, <code>o == null ? e == null : o.equals(e)</code>,
+   * it is removed from the set.
+   *
+   * @param o the object to remove
+   * @return true if the set changed (an object was removed)
+   * @throws UnsupportedOperationException if this operation is not allowed
+   * @throws ClassCastException if the type of o is not a valid type
+   *         for this set.
+   * @throws NullPointerException if o is null and this set doesn't allow
+   *         the removal of a null value.
+   */
+  boolean remove(Object o);
+
+  /**
+   * Removes from this set all elements contained in the specified collection
+   * (optional operation). If the argument is a set, this returns the
+   * <i>asymmetric set difference</i> of the two sets.
+   *
+   * @param c the collection to remove from this set
+   * @return true if this set changed as a result
+   * @throws UnsupportedOperationException if this operation is not allowed
+   * @throws NullPointerException if c is null
+   * @throws ClassCastException if the type of any element in c is not
+   *         a valid type for this set.
+   * @throws NullPointerException if some element of c is null and this
+   *         set doesn't support removing null values.
+   * @see #remove(Object)
+   */
+  //boolean removeAll(Collection<?> c);
+
+  /**
+   * Retains only the elements in this set that are also in the specified
+   * collection (optional operation). If the argument is also a set, this
+   * performs the <i>intersection</i> of the two sets.
+   *
+   * @param c the collection to keep
+   * @return true if this set was modified
+   * @throws UnsupportedOperationException if this operation is not allowed
+   * @throws NullPointerException if c is null
+   * @throws ClassCastException if the type of any element in c is not
+   *         a valid type for this set.
+   * @throws NullPointerException if some element of c is null and this
+   *         set doesn't support retaining null values.
+   * @see #remove(Object)
+   */
+  //boolean retainAll(Collection<?> c);
+
+  /**
+   * Returns the number of elements in the set. If there are more
+   * than Integer.MAX_VALUE mappings, return Integer.MAX_VALUE. This is
+   * the <i>cardinality</i> of the set.
+   *
+   * @return the number of elements
+   */
+  int size();
+
+  /**
+   * Returns an array containing the elements of this set. If the set
+   * makes a guarantee about iteration order, the array has the same
+   * order. The array is distinct from the set; modifying one does not
+   * affect the other.
+   *
+   * @return an array of this set's elements
+   * @see #toArray(Object[])
+   */
+  Object[] toArray();
+
+  /**
+   * Returns an array containing the elements of this set, of the same runtime
+   * type of the argument. If the given set is large enough, it is reused,
+   * and null is inserted in the first unused slot. Otherwise, reflection
+   * is used to build a new array. If the set makes a guarantee about iteration
+   * order, the array has the same order. The array is distinct from the set;
+   * modifying one does not affect the other.
+   *
+   * @param a the array to determine the return type; if it is big enough
+   *        it is used and returned
+   * @return an array holding the elements of the set
+   * @throws ArrayStoreException if the runtime type of a is not a supertype
+   *         of all elements in the set
+   * @throws NullPointerException if a is null
+   * @see #toArray()
+   */
+  //<T> T[] toArray(T[] a);
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/Short.java b/Robust/src/ClassLibrary/MGC/gnu/Short.java
new file mode 100644 (file)
index 0000000..887fdb3
--- /dev/null
@@ -0,0 +1,383 @@
+/* Short.java -- object wrapper for short
+   Copyright (C) 1998, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang;
+
+/**
+ * Instances of class <code>Short</code> represent primitive
+ * <code>short</code> values.
+ *
+ * Additionally, this class provides various helper functions and variables
+ * related to shorts.
+ *
+ * @author Paul Fisher
+ * @author John Keiser
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.1
+ * @status updated to 1.5
+ */
+public final class Short 
+{
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = 7515723908773894738L;
+
+  /**
+   * The minimum value a <code>short</code> can represent is -32768 (or
+   * -2<sup>15</sup>).
+   */
+  public static final short MIN_VALUE = -32768;
+
+  /**
+   * The minimum value a <code>short</code> can represent is 32767 (or
+   * 2<sup>15</sup>).
+   */
+  public static final short MAX_VALUE = 32767;
+
+  /**
+   * The primitive type <code>short</code> is represented by this
+   * <code>Class</code> object.
+   */
+  //public static final Class<Short> TYPE = (Class<Short>) VMClassLoader.getPrimitiveClass('S');
+
+  /**
+   * The number of bits needed to represent a <code>short</code>.
+   * @since 1.5
+   */
+  public static final int SIZE = 16;
+
+  // This caches some Short values, and is used by boxing conversions
+  // via valueOf().  We must cache at least -128..127; these constants
+  // control how much we actually cache.
+  private static final int MIN_CACHE = -128;
+  private static final int MAX_CACHE = 127;
+  private static Short[] shortCache = new Short[MAX_CACHE - MIN_CACHE + 1];
+  static
+  {
+    for (short i=MIN_CACHE; i <= MAX_CACHE; i++)
+      shortCache[i - MIN_CACHE] = new Short(i);
+  }
+
+  /**
+   * The immutable value of this Short.
+   *
+   * @serial the wrapped short
+   */
+  private final short value;
+
+  /**
+   * Create a <code>Short</code> object representing the value of the
+   * <code>short</code> argument.
+   *
+   * @param value the value to use
+   */
+  public Short(short value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Create a <code>Short</code> object representing the value of the
+   * argument after conversion to a <code>short</code>.
+   *
+   * @param s the string to convert
+   * @throws NumberFormatException if the String cannot be parsed
+   */
+  public Short(String s)
+  {
+    value = parseShort(s, 10);
+  }
+
+  /**
+   * Converts the <code>short</code> to a <code>String</code> and assumes
+   * a radix of 10.
+   *
+   * @param s the <code>short</code> to convert to <code>String</code>
+   * @return the <code>String</code> representation of the argument
+   */
+  public static String toString(short s)
+  {
+    return String.valueOf((int)s);
+  }
+
+  /**
+   * Converts the specified <code>String</code> into a <code>short</code>.
+   * This function assumes a radix of 10.
+   *
+   * @param s the <code>String</code> to convert
+   * @return the <code>short</code> value of <code>s</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>short</code>
+   */
+  public static short parseShort(String s)
+  {
+    return parseShort(s, 10);
+  }
+
+  /**
+   * Converts the specified <code>String</code> into a <code>short</code>
+   * using the specified radix (base). The string must not be <code>null</code>
+   * or empty. It may begin with an optional '-', which will negate the answer,
+   * provided that there are also valid digits. Each digit is parsed as if by
+   * <code>Character.digit(d, radix)</code>, and must be in the range
+   * <code>0</code> to <code>radix - 1</code>. Finally, the result must be
+   * within <code>MIN_VALUE</code> to <code>MAX_VALUE</code>, inclusive.
+   * Unlike Double.parseDouble, you may not have a leading '+'.
+   *
+   * @param s the <code>String</code> to convert
+   * @param radix the radix (base) to use in the conversion
+   * @return the <code>String</code> argument converted to <code>short</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>short</code>
+   */
+  public static short parseShort(String s, int radix)
+  {
+    int i = Integer.parseInt(s, radix, false);
+    if ((short) i != i)
+      throw new /*NumberFormat*/Exception("NumberFormatException");
+    return (short) i;
+  }
+
+  /**
+   * Creates a new <code>Short</code> object using the <code>String</code>
+   * and specified radix (base).
+   *
+   * @param s the <code>String</code> to convert
+   * @param radix the radix (base) to convert with
+   * @return the new <code>Short</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>short</code>
+   * @see #parseShort(String, int)
+   */
+  public static Short valueOf(String s, int radix)
+  {
+    return valueOf(parseShort(s, radix));
+  }
+
+  /**
+   * Creates a new <code>Short</code> object using the <code>String</code>,
+   * assuming a radix of 10.
+   *
+   * @param s the <code>String</code> to convert
+   * @return the new <code>Short</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>short</code>
+   * @see #Short(String)
+   * @see #parseShort(String)
+   */
+  public static Short valueOf(String s)
+  {
+    return valueOf(parseShort(s, 10));
+  }
+
+  /**
+   * Returns a <code>Short</code> object wrapping the value.
+   * In contrast to the <code>Short</code> constructor, this method
+   * will cache some values.  It is used by boxing conversion.
+   *
+   * @param val the value to wrap
+   * @return the <code>Short</code>
+   * @since 1.5
+   */
+  public static Short valueOf(short val)
+  {
+    if (val < MIN_CACHE || val > MAX_CACHE)
+      return new Short(val);
+    else
+      return shortCache[val - MIN_CACHE];
+  }
+
+  /**
+   * Convert the specified <code>String</code> into a <code>Short</code>.
+   * The <code>String</code> may represent decimal, hexadecimal, or
+   * octal numbers.
+   *
+   * <p>The extended BNF grammar is as follows:<br>
+   * <pre>
+   * <em>DecodableString</em>:
+   *      ( [ <code>-</code> ] <em>DecimalNumber</em> )
+   *    | ( [ <code>-</code> ] ( <code>0x</code> | <code>0X</code>
+   *              | <code>#</code> ) <em>HexDigit</em> { <em>HexDigit</em> } )
+   *    | ( [ <code>-</code> ] <code>0</code> { <em>OctalDigit</em> } )
+   * <em>DecimalNumber</em>:
+   *        <em>DecimalDigit except '0'</em> { <em>DecimalDigit</em> }
+   * <em>DecimalDigit</em>:
+   *        <em>Character.digit(d, 10) has value 0 to 9</em>
+   * <em>OctalDigit</em>:
+   *        <em>Character.digit(d, 8) has value 0 to 7</em>
+   * <em>DecimalDigit</em>:
+   *        <em>Character.digit(d, 16) has value 0 to 15</em>
+   * </pre>
+   * Finally, the value must be in the range <code>MIN_VALUE</code> to
+   * <code>MAX_VALUE</code>, or an exception is thrown.
+   *
+   * @param s the <code>String</code> to interpret
+   * @return the value of the String as a <code>Short</code>
+   * @throws NumberFormatException if <code>s</code> cannot be parsed as a
+   *         <code>short</code>
+   * @throws NullPointerException if <code>s</code> is null
+   * @see Integer#decode(String)
+   */
+  public static Short decode(String s)
+  {
+    int i = Integer.parseInt(s, 10, true);
+    if ((short) i != i)
+      throw new /*NumberFormat*/Exception("NumberFormatException");
+    return valueOf((short) i);
+  }
+
+  /**
+   * Return the value of this <code>Short</code> as a <code>byte</code>.
+   *
+   * @return the byte value
+   */
+  public byte byteValue()
+  {
+    return (byte) value;
+  }
+
+  /**
+   * Return the value of this <code>Short</code>.
+   *
+   * @return the short value
+   */
+  public short shortValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Short</code> as an <code>int</code>.
+   *
+   * @return the int value
+   */
+  public int intValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Short</code> as a <code>long</code>.
+   *
+   * @return the long value
+   */
+  public long longValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Short</code> as a <code>float</code>.
+   *
+   * @return the float value
+   */
+  public float floatValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the value of this <code>Short</code> as a <code>double</code>.
+   *
+   * @return the double value
+   */
+  public double doubleValue()
+  {
+    return value;
+  }
+
+  /**
+   * Converts the <code>Short</code> value to a <code>String</code> and
+   * assumes a radix of 10.
+   *
+   * @return the <code>String</code> representation of this <code>Short</code>
+   */
+  public String toString()
+  {
+    return String.valueOf(value);
+  }
+
+  /**
+   * Return a hashcode representing this Object. <code>Short</code>'s hash
+   * code is simply its value.
+   *
+   * @return this Object's hash code
+   */
+  public int hashCode()
+  {
+    return value;
+  }
+
+  /**
+   * Returns <code>true</code> if <code>obj</code> is an instance of
+   * <code>Short</code> and represents the same short value.
+   *
+   * @param obj the object to compare
+   * @return whether these Objects are semantically equal
+   */
+  public boolean equals(Object obj)
+  {
+    return obj instanceof Short && value == ((Short) obj).value;
+  }
+
+  /**
+   * Compare two Shorts numerically by comparing their <code>short</code>
+   * values. The result is positive if the first is greater, negative if the
+   * second is greater, and 0 if the two are equal.
+   *
+   * @param s the Short to compare
+   * @return the comparison
+   * @since 1.2
+   */
+  public int compareTo(Short s)
+  {
+    return value - s.value;
+  }
+
+  /**
+   * Reverse the bytes in val.
+   * @since 1.5
+   */
+  public static short reverseBytes(short val)
+  {
+    return (short) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+  }
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/SimpleFormatter.java b/Robust/src/ClassLibrary/MGC/gnu/SimpleFormatter.java
new file mode 100644 (file)
index 0000000..dd8abb4
--- /dev/null
@@ -0,0 +1,126 @@
+/* SimpleFormatter.java --
+   A class for formatting log records into short human-readable messages
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/**
+ * A <code>SimpleFormatter</code> formats log records into
+ * short human-readable messages, typically one or two lines.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class SimpleFormatter
+  extends Formatter
+{
+  /**
+   * Constructs a SimpleFormatter.
+   */
+  public SimpleFormatter()
+  {
+  }
+
+
+  /**
+   * An instance of a DateFormatter that is used for formatting
+   * the time of a log record into a human-readable string,
+   * according to the rules of the current locale.  The value
+   * is set after the first invocation of format, since it is
+   * common that a JVM will instantiate a SimpleFormatter without
+   * ever using it.
+   */
+  //private DateFormat dateFormat;
+
+  /**
+   * The character sequence that is used to separate lines in the
+   * generated stream. Somewhat surprisingly, the Sun J2SE 1.4
+   * reference implementation always uses UNIX line endings, even on
+   * platforms that have different line ending conventions (i.e.,
+   * DOS). The GNU implementation does not replicate this bug.
+   *
+   * @see Sun bug parade, bug #4462871,
+   * "java.util.logging.SimpleFormatter uses hard-coded line separator".
+   */
+  //static final String lineSep = System.getProperty("line.separator");
+
+
+  /**
+   * Formats a log record into a String.
+   *
+   * @param record the log record to be formatted.
+   *
+   * @return a short human-readable message, typically one or two
+   *   lines.  Lines are separated using the default platform line
+   *   separator.
+   *
+   * @throws NullPointerException if <code>record</code>
+   *         is <code>null</code>.
+   */
+  public String format(LogRecord record)
+  {
+    /*CPStringBuilder buf = new CPStringBuilder(180);
+
+    if (dateFormat == null)
+      dateFormat = DateFormat.getDateTimeInstance();
+
+    buf.append(dateFormat.format(new Date(record.getMillis())));
+    buf.append(' ');
+    buf.append(record.getSourceClassName());
+    buf.append(' ');
+    buf.append(record.getSourceMethodName());
+    buf.append(lineSep);
+
+    buf.append(record.getLevel());
+    buf.append(": ");
+    buf.append(formatMessage(record));
+
+    buf.append(lineSep);
+
+    Throwable throwable = record.getThrown();
+    if (throwable != null)
+      {
+        StringWriter sink = new StringWriter();
+        throwable.printStackTrace(new PrintWriter(sink, true));
+        buf.append(sink.toString());
+      }
+
+    return buf.toString();*/
+    System.println("Unimplemented SimpleFormatter.format(LogRecord)");
+    return "";
+  }
+}
index f1b7fa2a4a4daaf787517de6ea887f62e9e3b6d6..84c4ef1399d123dc3230faca4a3065079edbb3ba 100644 (file)
@@ -965,7 +965,7 @@ public class SimpleTimeZone extends TimeZone
    * Reads a serialized simple time zone from stream.
    * @see #writeObject
    */
-  private void readObject(java.io.ObjectInputStream input)
+  /*private void readObject(java.io.ObjectInputStream input)
     //throws java.io.IOException, ClassNotFoundException
   {
     input.defaultReadObject();
@@ -994,7 +994,7 @@ public class SimpleTimeZone extends TimeZone
            endDayOfWeek = byteArray[3];
          }
       }
-  }
+  }*/
 
   /**
    * Serializes this object to a stream.  @serialdata The object is
@@ -1012,7 +1012,7 @@ public class SimpleTimeZone extends TimeZone
    * approximative values are written to the required section, as
    * described above.
    */
-  private void writeObject(java.io.ObjectOutputStream output)
+  /*private void writeObject(java.io.ObjectOutputStream output)
     //throws java.io.IOException
   {
     byte[] byteArray = new byte[]
@@ -1021,7 +1021,7 @@ public class SimpleTimeZone extends TimeZone
                          (byte) endDayOfWeek
                        };
 
-    /* calculate the approximation for JDK 1.1 */
+    // calculate the approximation for JDK 1.1 
     switch (startMode)
       {
       case DOM_MODE:
@@ -1048,5 +1048,5 @@ public class SimpleTimeZone extends TimeZone
     // the optional part:
     output.writeInt(byteArray.length);
     output.write(byteArray, 0, byteArray.length);
-  }
+  }*/
 }
diff --git a/Robust/src/ClassLibrary/MGC/gnu/StreamHandler.java b/Robust/src/ClassLibrary/MGC/gnu/StreamHandler.java
new file mode 100644 (file)
index 0000000..11c805e
--- /dev/null
@@ -0,0 +1,516 @@
+/* StreamHandler.java --
+   A class for publishing log messages to instances of java.io.OutputStream
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util.logging;
+
+/**
+ * A <code>StreamHandler</code> publishes <code>LogRecords</code> to
+ * a instances of <code>java.io.OutputStream</code>.
+ *
+ * @author Sascha Brawer (brawer@acm.org)
+ */
+public class StreamHandler
+  extends Handler
+{
+  private OutputStream  out;
+  private Writer        writer;
+
+
+ /**
+  * Indicates the current state of this StreamHandler.  The value
+  * should be one of STATE_FRESH, STATE_PUBLISHED, or STATE_CLOSED.
+  */
+  private int streamState = STATE_FRESH;
+
+
+  /**
+   * streamState having this value indicates that the StreamHandler
+   * has been created, but the publish(LogRecord) method has not been
+   * called yet.  If the StreamHandler has been constructed without an
+   * OutputStream, writer will be null, otherwise it is set to a
+   * freshly created OutputStreamWriter.
+   */
+  private static final int STATE_FRESH = 0;
+
+
+  /**
+   * streamState having this value indicates that the publish(LocRecord)
+   * method has been called at least once.
+   */
+  private static final int STATE_PUBLISHED = 1;
+
+
+  /**
+   * streamState having this value indicates that the close() method
+   * has been called.
+   */
+  private static final int STATE_CLOSED = 2;
+
+
+  /**
+   * Creates a <code>StreamHandler</code> without an output stream.
+   * Subclasses can later use {@link
+   * #setOutputStream(java.io.OutputStream)} to associate an output
+   * stream with this StreamHandler.
+   */
+  public StreamHandler()
+  {
+    this(null, null);
+  }
+
+
+  /**
+   * Creates a <code>StreamHandler</code> that formats log messages
+   * with the specified Formatter and publishes them to the specified
+   * output stream.
+   *
+   * @param out the output stream to which the formatted log messages
+   *     are published.
+   *
+   * @param formatter the <code>Formatter</code> that will be used
+   *     to format log messages.
+   */
+  public StreamHandler(OutputStream out, Formatter formatter)
+  {
+    this(out, "java.util.logging.StreamHandler", Level.INFO,
+        formatter/*, SimpleFormatter.class*/);
+  }
+
+
+  StreamHandler(
+    OutputStream out,
+    String propertyPrefix,
+    Level defaultLevel,
+    Formatter formatter/*, Class defaultFormatterClass*/)
+  {
+    this.level = //LogManager.getLevelProperty(propertyPrefix + ".level",
+                                            defaultLevel;//);
+
+    //this.filter = (Filter) LogManager.getInstanceProperty(
+    //  propertyPrefix + ".filter",
+    //  /* must be instance of */       Filter.class,
+    //  /* default: new instance of */  null);
+
+    //if (formatter != null)
+      this.formatter = formatter;
+    //else
+    //  this.formatter = (Formatter) LogManager.getInstanceProperty(
+       //propertyPrefix + ".formatter",
+    //    /* must be instance of */       Formatter.class,
+    //    /* default: new instance of */  defaultFormatterClass);
+
+    /*try
+    {
+      String enc = LogManager.getLogManager().getProperty(propertyPrefix
+                                                         + ".encoding");
+
+      /* make sure enc actually is a valid encoding */
+      /*if ((enc != null) && (enc.length() > 0))
+        new String(new byte[0], enc);
+
+      this.encoding = enc;
+    }
+    catch (Exception _)
+    {
+    }*/
+
+    if (out != null)
+    {
+      /*try
+      {
+        changeWriter(out, getEncoding());
+      }
+      catch (UnsupportedEncodingException uex)
+      {
+       /* This should never happen, since the validity of the encoding
+        * name has been checked above.
+        */
+       /*throw new RuntimeException(uex.getMessage());
+      }*/
+      writer = new OutputStreamWriter(out);
+    }
+  }
+
+  /*private void checkOpen()
+  {
+    if (streamState == STATE_CLOSED)
+      throw new IllegalStateException(this.toString() + " has been closed");
+  }*/
+
+  /*private void checkFresh()
+  {
+    checkOpen();
+    if (streamState != STATE_FRESH)
+      throw new IllegalStateException("some log records have been published to " + this);
+  }*/
+
+
+  /*private void changeWriter(OutputStream out, String encoding)
+    throws UnsupportedEncodingException
+  {
+    OutputStreamWriter writer;
+
+    /* The logging API says that a null encoding means the default
+     * platform encoding. However, java.io.OutputStreamWriter needs
+     * another constructor for the default platform encoding,
+     * passing null would throw an exception.
+     */
+    /*if (encoding == null)
+      writer = new OutputStreamWriter(out);
+    else
+      writer = new OutputStreamWriter(out, encoding);
+
+    /* Closing the stream has side effects -- do this only after
+     * creating a new writer has been successful.
+     */
+    /*if ((streamState != STATE_FRESH) || (this.writer != null))
+      close();
+
+    this.writer = writer;
+    this.out = out;
+    this.encoding = encoding;
+    streamState = STATE_FRESH;
+  }*/
+
+
+  /**
+   * Sets the character encoding which this handler uses for publishing
+   * log records.  The encoding of a <code>StreamHandler</code> must be
+   * set before any log records have been published.
+   *
+   * @param encoding the name of a character encoding, or <code>null</code>
+   *            for the default encoding.
+   *
+   * @throws SecurityException if a security manager exists and
+   *     the caller is not granted the permission to control the
+   *     the logging infrastructure.
+   *
+   * @exception IllegalStateException if any log records have been
+   *     published to this <code>StreamHandler</code> before.  Please
+   *     be aware that this is a pecularity of the GNU implementation.
+   *     While the API specification indicates that it is an error
+   *     if the encoding is set after records have been published,
+   *     it does not mandate any specific behavior for that case.
+   */
+  /*public void setEncoding(String encoding)
+    throws SecurityException, UnsupportedEncodingException
+  {
+    /* The inherited implementation first checks whether the invoking
+     * code indeed has the permission to control the logging infra-
+     * structure, and throws a SecurityException if this was not the
+     * case.
+     *
+     * Next, it verifies that the encoding is supported and throws
+     * an UnsupportedEncodingExcpetion otherwise. Finally, it remembers
+     * the name of the encoding.
+     */
+    /*super.setEncoding(encoding);
+
+    checkFresh();
+
+    /* If out is null, setEncoding is being called before an output
+     * stream has been set. In that case, we need to check that the
+     * encoding is valid, and remember it if this is the case.  Since
+     * this is exactly what the inherited implementation of
+     * Handler.setEncoding does, we can delegate.
+     */
+    /*if (out != null)
+    {
+      /* The logging API says that a null encoding means the default
+       * platform encoding. However, java.io.OutputStreamWriter needs
+       * another constructor for the default platform encoding, passing
+       * null would throw an exception.
+       */
+      /*if (encoding == null)
+       writer = new OutputStreamWriter(out);
+      else
+       writer = new OutputStreamWriter(out, encoding);
+    }
+  }*/
+
+
+  /**
+   * Changes the output stream to which this handler publishes
+   * logging records.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   *
+   * @throws NullPointerException if <code>out</code>
+   *         is <code>null</code>.
+   */
+  /*protected void setOutputStream(OutputStream out)
+    throws SecurityException
+  {
+    LogManager.getLogManager().checkAccess();
+
+    /* Throw a NullPointerException if out is null. */
+    /*out.getClass();
+
+    try
+    {
+      changeWriter(out, getEncoding());
+    }
+    catch (UnsupportedEncodingException ex)
+    {
+      /* This seems quite unlikely to happen, unless the underlying
+       * implementation of java.io.OutputStreamWriter changes its
+       * mind (at runtime) about the set of supported character
+       * encodings.
+       */
+      /*throw new RuntimeException(ex.getMessage());
+    }
+  }*/
+
+
+  /**
+   * Publishes a <code>LogRecord</code> to the associated output
+   * stream, provided the record passes all tests for being loggable.
+   * The <code>StreamHandler</code> will localize the message of the
+   * log record and substitute any message parameters.
+   *
+   * <p>Most applications do not need to call this method directly.
+   * Instead, they will use use a {@link Logger}, which will create
+   * LogRecords and distribute them to registered handlers.
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.
+   *
+   * <p>If a log record is being published to a
+   * <code>StreamHandler</code> that has been closed earlier, the Sun
+   * J2SE 1.4 reference can be observed to silently ignore the
+   * call. The GNU implementation, however, intentionally behaves
+   * differently by informing the <code>ErrorManager</code> associated
+   * with this <code>StreamHandler</code>.  Since the condition
+   * indicates a programming error, the programmer should be
+   * informed. It also seems extremely unlikely that any application
+   * would depend on the exact behavior in this rather obscure,
+   * erroneous case -- especially since the API specification does not
+   * prescribe what is supposed to happen.
+   * 
+   * @param record the log event to be published.
+   */
+  /*public void publish(LogRecord record)
+  {
+    String formattedMessage;
+
+    if (!isLoggable(record))
+      return;
+
+    if (streamState == STATE_FRESH)
+    {
+      try
+      {
+        writer.write(formatter.getHead(this));
+      }
+      catch (java.io.IOException ex)
+      {
+       reportError(null, ex, ErrorManager.WRITE_FAILURE);
+       return;
+      }
+      catch (Exception ex)
+      {
+       reportError(null, ex, ErrorManager.GENERIC_FAILURE);
+       return;
+      }
+
+      streamState = STATE_PUBLISHED;
+    }
+
+    try
+    {
+      formattedMessage = formatter.format(record);
+    }
+    catch (Exception ex)
+    {
+      reportError(null, ex, ErrorManager.FORMAT_FAILURE);
+      return;
+    }
+
+    try
+    {
+      writer.write(formattedMessage);
+    }
+    catch (Exception ex)
+    {
+      reportError(null, ex, ErrorManager.WRITE_FAILURE);
+    }
+  }*/
+
+
+  /**
+   * Checks whether or not a <code>LogRecord</code> would be logged
+   * if it was passed to this <code>StreamHandler</code> for publication.
+   *
+   * <p>The <code>StreamHandler</code> implementation first checks
+   * whether a writer is present and the handler's level is greater
+   * than or equal to the severity level threshold.  In a second step,
+   * if a {@link Filter} has been installed, its {@link
+   * Filter#isLoggable(LogRecord) isLoggable} method is
+   * invoked. Subclasses of <code>StreamHandler</code> can override
+   * this method to impose their own constraints.
+   *
+   * @param record the <code>LogRecord</code> to be checked.
+   *
+   * @return <code>true</code> if <code>record</code> would
+   *         be published by {@link #publish(LogRecord) publish},
+   *         <code>false</code> if it would be discarded.
+   *
+   * @see #setLevel(Level)
+   * @see #setFilter(Filter)
+   * @see Filter#isLoggable(LogRecord)
+   *
+   * @throws NullPointerException if <code>record</code> is
+   *         <code>null</code>.  */
+  public boolean isLoggable(LogRecord record)
+  {
+    return (writer != null) && super.isLoggable(record);
+  }
+
+
+  /**
+   * Forces any data that may have been buffered to the underlying
+   * output device.
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.
+   *
+   * <p>If a <code>StreamHandler</code> that has been closed earlier
+   * is closed a second time, the Sun J2SE 1.4 reference can be
+   * observed to silently ignore the call. The GNU implementation,
+   * however, intentionally behaves differently by informing the
+   * <code>ErrorManager</code> associated with this
+   * <code>StreamHandler</code>.  Since the condition indicates a
+   * programming error, the programmer should be informed. It also
+   * seems extremely unlikely that any application would depend on the
+   * exact behavior in this rather obscure, erroneous case --
+   * especially since the API specification does not prescribe what is
+   * supposed to happen.
+   */
+  /*public void flush()
+  {
+    try
+    {
+      checkOpen();
+      if (writer != null)
+        writer.flush();
+    }
+    catch (Exception ex)
+    {
+      reportError(null, ex, ErrorManager.FLUSH_FAILURE);
+    }
+  }*/
+
+
+  /**
+   * Closes this <code>StreamHandler</code> after having forced any
+   * data that may have been buffered to the underlying output
+   * device. 
+   *
+   * <p>As soon as <code>close</code> has been called,
+   * a <code>Handler</code> should not be used anymore. Attempts
+   * to publish log records, to flush buffers, or to modify the
+   * <code>Handler</code> in any other way may throw runtime
+   * exceptions after calling <code>close</code>.</p>
+   *
+   * <p>In case of an I/O failure, the <code>ErrorManager</code>
+   * of this <code>Handler</code> will be informed, but the caller
+   * of this method will not receive an exception.</p>
+   *
+   * <p>If a <code>StreamHandler</code> that has been closed earlier
+   * is closed a second time, the Sun J2SE 1.4 reference can be
+   * observed to silently ignore the call. The GNU implementation,
+   * however, intentionally behaves differently by informing the
+   * <code>ErrorManager</code> associated with this
+   * <code>StreamHandler</code>.  Since the condition indicates a
+   * programming error, the programmer should be informed. It also
+   * seems extremely unlikely that any application would depend on the
+   * exact behavior in this rather obscure, erroneous case --
+   * especially since the API specification does not prescribe what is
+   * supposed to happen.
+   *
+   * @throws SecurityException if a security manager exists and
+   *         the caller is not granted the permission to control
+   *         the logging infrastructure.
+   */
+  /*public void close()
+    throws SecurityException
+  {
+    LogManager.getLogManager().checkAccess();
+
+    try
+    {
+      /* Although  flush also calls checkOpen, it catches
+       * any exceptions and reports them to the ErrorManager
+       * as flush failures.  However, we want to report
+       * a closed stream as a close failure, not as a
+       * flush failure here.  Therefore, we call checkOpen()
+       * before flush().
+       */
+      /*checkOpen();
+      flush();
+
+      if (writer != null)
+      {
+       if (formatter != null)
+       {
+         /* Even if the StreamHandler has never published a record,
+          * it emits head and tail upon closing. An earlier version
+          * of the GNU Classpath implementation did not emitted
+          * anything. However, this had caused XML log files to be
+          * entirely empty instead of containing no log records.
+          */
+         /*if (streamState == STATE_FRESH)
+            writer.write(formatter.getHead(this));
+         if (streamState != STATE_CLOSED)
+           writer.write(formatter.getTail(this));
+       }
+       streamState = STATE_CLOSED;
+        writer.close();
+      }
+    }
+    catch (Exception ex)
+    {
+      reportError(null, ex, ErrorManager.CLOSE_FAILURE);
+    }
+  }*/
+}
diff --git a/Robust/src/ClassLibrary/MGC/gnu/StringBuilder.java b/Robust/src/ClassLibrary/MGC/gnu/StringBuilder.java
new file mode 100644 (file)
index 0000000..799551c
--- /dev/null
@@ -0,0 +1,380 @@
+/* StringBuilder.java -- Unsynchronized growable strings
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang;
+
+
+/**
+ * <code>StringBuilder</code> represents a changeable <code>String</code>.
+ * It provides the operations required to modify the
+ * <code>StringBuilder</code>, including insert, replace, delete, append,
+ * and reverse. It like <code>StringBuffer</code>, but is not
+ * synchronized.  It is ideal for use when it is known that the
+ * object will only be used from a single thread.
+ *
+ * <p><code>StringBuilder</code>s are variable-length in nature, so even if
+ * you initialize them to a certain size, they can still grow larger than
+ * that. <em>Capacity</em> indicates the number of characters the
+ * <code>StringBuilder</code> can have in it before it has to grow (growing
+ * the char array is an expensive operation involving <code>new</code>).
+ *
+ * <p>Incidentally, compilers often implement the String operator "+"
+ * by using a <code>StringBuilder</code> operation:<br>
+ * <code>a + b</code><br>
+ * is the same as<br>
+ * <code>new StringBuilder().append(a).append(b).toString()</code>.
+ *
+ * <p>Classpath's StringBuilder is capable of sharing memory with Strings for
+ * efficiency.  This will help when a StringBuilder is converted to a String
+ * and the StringBuilder is not changed after that (quite common when
+ * performing string concatenation).
+ *
+ * @author Paul Fisher
+ * @author John Keiser
+ * @author Tom Tromey
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @see String
+ * @see StringBuffer
+ *
+ * @since 1.5
+ */
+public final class StringBuilder
+{
+  // Implementation note: if you change this class, you usually will
+  // want to change StringBuffer as well.
+  int count;
+
+  /**
+   * The buffer.  Note that this has permissions set this way so that String
+   * can get the value.
+   *
+   * @serial the buffer
+   */
+  char[] value;
+
+  /**
+   * The default capacity of a buffer.
+   */
+  private static final int DEFAULT_CAPACITY = 16;
+
+  /**
+   * For compatability with Sun's JDK
+   */
+  private static final long serialVersionUID = 4383685877147921099L;
+
+  /**
+   * Create a new StringBuilder with default capacity 16.
+   */
+  public StringBuilder()
+  {
+    value = new char[this.DEFAULT_CAPACITY];
+    this.count = 0;
+  }
+
+  /**
+   * Create an empty <code>StringBuilder</code> with the specified initial
+   * capacity.
+   *
+   * @param capacity the initial capacity
+   * @throws NegativeArraySizeException if capacity is negative
+   */
+  public StringBuilder(int capacity)
+  {
+    value = new char[capacity];
+    this.count = 0;
+  }
+
+  /**
+   * Create a new <code>StringBuilder</code> with the characters in the
+   * specified <code>String</code>. Initial capacity will be the size of the
+   * String plus 16.
+   *
+   * @param str the <code>String</code> to convert
+   * @throws NullPointerException if str is null
+   */
+  public StringBuilder(String str)
+  {
+    count = str.count;
+    value = new char[count + DEFAULT_CAPACITY];
+    str.getChars(0, count, value, 0);
+  }
+
+  /**
+   * Get the length of the <code>String</code> this <code>StringBuilder</code>
+   * would create. Not to be confused with the <em>capacity</em> of the
+   * <code>StringBuilder</code>.
+   *
+   * @return the length of this <code>StringBuilder</code>
+   * @see #capacity()
+   * @see #setLength(int)
+   */
+  public int length()
+  {
+    return count;
+  }
+
+  /**
+   * Get the total number of characters this <code>StringBuilder</code> can
+   * support before it must be grown.  Not to be confused with <em>length</em>.
+   *
+   * @return the capacity of this <code>StringBuilder</code>
+   * @see #length()
+   * @see #ensureCapacity(int)
+   */
+  public int capacity()
+  {
+    return value.length;
+  }
+  
+  void ensureCapacity_unsynchronized(int minimumCapacity)
+  {
+    if (minimumCapacity > value.length)
+      {
+        int max = value.length * 2 + 2;
+        minimumCapacity = (minimumCapacity < max ? max : minimumCapacity);
+        char[] nb = new char[minimumCapacity];
+        System.arraycopy(value, 0, nb, 0, count);
+        value = nb;
+      }
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param obj the <code>Object</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(Object)
+   * @see #append(String)
+   */
+  public StringBuilder append(Object obj)
+  {
+    append(String.valueOf(obj));
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> to this <code>StringBuilder</code>. If
+   * str is null, the String "null" is appended.
+   *
+   * @param str the <code>String</code> to append
+   * @return this <code>StringBuilder</code>
+   */
+  public StringBuilder append(String str)
+  {
+    if (str == null)
+      str = "null";
+    int len = str.count;
+    ensureCapacity_unsynchronized(count + len);
+    str.getChars(0, len, value, count);
+    count += len;
+    return this;
+  }
+
+  /**
+   * Append the <code>StringBuilder</code> value of the argument to this
+   * <code>StringBuilder</code>. This behaves the same as
+   * <code>append((Object) stringBuffer)</code>, except it is more efficient.
+   *
+   * @param stringBuffer the <code>StringBuilder</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see #append(Object)
+   */
+  public StringBuilder append(StringBuffer stringBuffer)
+  {
+    if (stringBuffer == null)
+      return append("null");
+    synchronized (stringBuffer)
+    {
+      int len = stringBuffer.count;
+      ensureCapacity(count + len);
+      System.arraycopy(stringBuffer.value, 0, value, count, len);
+      count += len;
+    }
+    return this;
+  }
+  
+  public void ensureCapacity(int minimumCapacity)
+  {
+    ensureCapacity_unsynchronized(minimumCapacity);
+  }
+
+  /**
+   * Append the <code>char</code> array to this <code>StringBuilder</code>.
+   * This is similar (but more efficient) than
+   * <code>append(new String(data))</code>, except in the case of null.
+   *
+   * @param data the <code>char[]</code> to append
+   * @return this <code>StringBuilder</code>
+   * @throws NullPointerException if <code>str</code> is <code>null</code>
+   * @see #append(char[], int, int)
+   */
+  public StringBuilder append(char[] data)
+  {
+    append(data, 0, data.length);
+    return this;
+  }
+
+  /**
+   * Append part of the <code>char</code> array to this
+   * <code>StringBuilder</code>. This is similar (but more efficient) than
+   * <code>append(new String(data, offset, count))</code>, except in the case
+   * of null.
+   *
+   * @param data the <code>char[]</code> to append
+   * @param offset the start location in <code>str</code>
+   * @param count the number of characters to get from <code>str</code>
+   * @return this <code>StringBuilder</code>
+   * @throws NullPointerException if <code>str</code> is <code>null</code>
+   * @throws IndexOutOfBoundsException if offset or count is out of range
+   *         (while unspecified, this is a StringIndexOutOfBoundsException)
+   */
+  public StringBuilder append(char[] data, int offset, int count)
+  {
+    if (offset < 0 || count < 0 || offset > data.length - count)
+      throw new /*StringIndexOutOfBounds*/Exception("StringIndexOutOfBoundsException");
+    ensureCapacity_unsynchronized(this.count + count);
+    System.arraycopy(data, offset, value, this.count, count);
+    this.count += count;
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param bool the <code>boolean</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(boolean)
+   */
+  public StringBuilder append(boolean bool)
+  {
+    append(bool?"true":"false");
+    return this;
+  }
+
+  /**
+   * Append the <code>char</code> to this <code>StringBuilder</code>.
+   *
+   * @param ch the <code>char</code> to append
+   * @return this <code>StringBuilder</code>
+   */
+  public StringBuilder append(char ch)
+  {
+    ensureCapacity_unsynchronized(count + 1);
+    value[count++] = ch;
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param inum the <code>int</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(int)
+   */
+  // This is native in libgcj, for efficiency.
+  public StringBuilder append(int inum)
+  {
+    append(String.valueOf(inum));
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param lnum the <code>long</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(long)
+   */
+  public StringBuilder append(long lnum)
+  {
+    append(String.valueOf(lnum));
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param fnum the <code>float</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(float)
+   */
+  public StringBuilder append(float fnum)
+  {
+    append(String.valueOf((double)fnum));
+    return this;
+  }
+
+  /**
+   * Append the <code>String</code> value of the argument to this
+   * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
+   * to <code>String</code>.
+   *
+   * @param dnum the <code>double</code> to convert and append
+   * @return this <code>StringBuilder</code>
+   * @see String#valueOf(double)
+   */
+  public StringBuilder append(double dnum)
+  {
+    append(String.valueOf(dnum));
+    return this;
+  }
+
+  /**
+   * Convert this <code>StringBuilder</code> to a <code>String</code>. The
+   * String is composed of the characters currently in this StringBuilder. Note
+   * that the result is a copy, and that future modifications to this buffer
+   * do not affect the String.
+   *
+   * @return the characters in this StringBuilder
+   */
+  public String toString()
+  {
+    return new String(this.value, 0, this.count);
+  }
+
+}
index 3efa9d491e31c5d7b3707125929b972e9f4d58c2..898bf430791132c016ffcab55afafa2d6a9cea79 100644 (file)
@@ -128,7 +128,7 @@ public class Throwable //implements Serializable
    * @serial the cause, or null if unknown, or this if not yet set
    * @since 1.4
    */
-  private Throwable cause = this;
+  private Throwable cause = null;//this;
 
   /**
    * The stack trace, in a serialized form.
@@ -146,7 +146,8 @@ public class Throwable //implements Serializable
    */
   public Throwable()
   {
-    this((String) null);
+    //this((String) null);
+    detailMessage = null;
   }
 
   /**
@@ -173,7 +174,8 @@ public class Throwable //implements Serializable
    */
   public Throwable(String message, Throwable cause)
   {
-    this(message);
+    //this(message);
+    detailMessage = message;
     this.cause = cause;
   }
 
@@ -187,7 +189,10 @@ public class Throwable //implements Serializable
    */
   public Throwable(Throwable cause)
   {
-    this(cause == null ? null : cause.toString(), cause);
+    //this(cause == null ? null : cause.toString(), cause);
+    String message = cause == null ? null : cause.toString();
+    detailMessage = message;
+    this.cause = cause;
   }
 
   /**
index db5dd13fb91cc126f5441be2dccc2f2ec065bf1a..78a3a32a62893fca5bbcfd78d3c070c3957caace 100644 (file)
@@ -99,7 +99,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
    */
   private static synchronized TimeZone defaultZone()
   {
-    /* Look up default timezone */
+    // Look up default timezone 
     if (defaultZone0 == null) 
       {
        /*defaultZone0 = (TimeZone) AccessController.doPrivileged
@@ -125,6 +125,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
                return zone;
              }
            });*/
+      defaultZone0 = getTimeZone ("PST");
       }
     
     return defaultZone0; 
@@ -167,6 +168,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
        if (zoneinfo_dir != null && !new File(zoneinfo_dir).isDirectory())
          zoneinfo_dir = null;*/
 
+    zoneinfo_dir = null;
        if (zoneinfo_dir != null)
          {
            aliases0 = new HashMap();
@@ -1304,10 +1306,10 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
    *
    * @return The name of the time zone.
    */
-  public final String getDisplayName()
+  /*public final String getDisplayName()
   {
     return (getDisplayName(false, LONG, Locale.getDefault()));
-  }
+  }*/
 
   /**
    * This method returns a string name of the time zone suitable
@@ -1319,10 +1321,10 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
    *
    * @return The name of the time zone.
    */
-  public final String getDisplayName(Locale locale)
+  /*public final String getDisplayName(Locale locale)
   {
     return (getDisplayName(false, LONG, locale));
-  }
+  }*/
 
   /**
    * This method returns a string name of the time zone suitable
@@ -1335,10 +1337,10 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
    *
    * @return The name of the time zone.
    */
-  public final String getDisplayName(boolean dst, int style)
+  /*public final String getDisplayName(boolean dst, int style)
   {
     return (getDisplayName(dst, style, Locale.getDefault()));
-  }
+  }*/
 
 
   /**
@@ -1497,8 +1499,8 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
          zonename = ID;
 
        // Read the file outside of the critical section, it is expensive.
-       tznew = ZoneInfo.readTZFile (ID, zoneinfo_dir
-                                    + File.separatorChar + zonename);
+       tznew = null;/*ZoneInfo.readTZFile (ID, zoneinfo_dir
+                                    + File.separatorChar + zonename);*/
        if (tznew == null)
          return null;
       }
@@ -1597,7 +1599,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
    * offset. For example <code>{"Phoenix", "Denver"}</code>, since both have
    * GMT-07:00, but differ in daylight savings behaviour.
    */
-  public static String[] getAvailableIDs(int rawOffset)
+  /*public static String[] getAvailableIDs(int rawOffset)
   {
     synchronized (TimeZone.class)
       {
@@ -1645,9 +1647,9 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
       ids[count++] = s[i];
 
     return ids;
-  }
+  }*/
 
-  private static int getAvailableIDs(File d, String prefix, ArrayList list)
+  /*private static int getAvailableIDs(File d, String prefix, ArrayList list)
     {
       String[] files = d.list();
       int count = files.length;
@@ -1677,7 +1679,7 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
            files[i] = prefix + files[i];
        }
       return count;
-    }
+    }*/
 
   /**
    * Gets all available IDs.
@@ -1767,7 +1769,9 @@ public abstract class TimeZone //implements java.io.Serializable, Cloneable
   {
     try
       {
-       return super.clone();
+       //return super.clone();
+      TimeZone tz = new TimeZone();
+      tz.ID = this.ID;
       }
     catch (/*CloneNotSupported*/Exception ex)
       {
diff --git a/Robust/src/ClassLibrary/MGC/gnu/TreeMap.java b/Robust/src/ClassLibrary/MGC/gnu/TreeMap.java
new file mode 100644 (file)
index 0000000..2a0b3f6
--- /dev/null
@@ -0,0 +1,1053 @@
+/* TreeMap.java -- a class providing a basic Red-Black Tree data structure,
+   mapping Object --> Object
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+import java.util.TreeMap.Node;
+
+
+/**
+ * This class provides a red-black tree implementation of the SortedMap
+ * interface.  Elements in the Map will be sorted by either a user-provided
+ * Comparator object, or by the natural ordering of the keys.
+ *
+ * The algorithms are adopted from Corman, Leiserson, and Rivest's
+ * <i>Introduction to Algorithms.</i>  TreeMap guarantees O(log n)
+ * insertion and deletion of elements.  That being said, there is a large
+ * enough constant coefficient in front of that "log n" (overhead involved
+ * in keeping the tree balanced), that TreeMap may not be the best choice
+ * for small collections. If something is already sorted, you may want to
+ * just use a LinkedHashMap to maintain the order while providing O(1) access.
+ *
+ * TreeMap is a part of the JDK1.2 Collections API.  Null keys are allowed
+ * only if a Comparator is used which can deal with them; natural ordering
+ * cannot cope with null.  Null values are always allowed. Note that the
+ * ordering must be <i>consistent with equals</i> to correctly implement
+ * the Map interface. If this condition is violated, the map is still
+ * well-behaved, but you may have suprising results when comparing it to
+ * other maps.<p>
+ *
+ * This implementation is not synchronized. If you need to share this between
+ * multiple threads, do something like:<br>
+ * <code>SortedMap m
+ *       = Collections.synchronizedSortedMap(new TreeMap(...));</code><p>
+ *
+ * The iterators are <i>fail-fast</i>, meaning that any structural
+ * modification, except for <code>remove()</code> called on the iterator
+ * itself, cause the iterator to throw a
+ * <code>ConcurrentModificationException</code> rather than exhibit
+ * non-deterministic behavior.
+ *
+ * @author Jon Zeppieri
+ * @author Bryce McKinlay
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @see Map
+ * @see HashMap
+ * @see Hashtable
+ * @see LinkedHashMap
+ * @see Comparable
+ * @see Comparator
+ * @see Collection
+ * @see Collections#synchronizedSortedMap(SortedMap)
+ * @since 1.2
+ * @status updated to 1.6
+ */
+public class TreeMap//<K, V> extends AbstractMap<K, V>
+  implements Map, SortedMap //NavigableMap<K, V>, Cloneable, Serializable
+{
+  // Implementation note:
+  // A red-black tree is a binary search tree with the additional properties
+  // that all paths to a leaf node visit the same number of black nodes,
+  // and no red node has red children. To avoid some null-pointer checks,
+  // we use the special node nil which is always black, has no relatives,
+  // and has key and value of null (but is not equal to a mapping of null).
+
+  /**
+   * Compatible with JDK 1.2.
+   */
+  private static final long serialVersionUID = 919286545866124006L;
+
+  /**
+   * Color status of a node. Package visible for use by nested classes.
+   */
+  static final int RED = -1,
+                   BLACK = 1;
+
+  /**
+   * Sentinal node, used to avoid null checks for corner cases and make the
+   * delete rebalance code simpler. The rebalance code must never assign
+   * the parent, left, or right of nil, but may safely reassign the color
+   * to be black. This object must never be used as a key in a TreeMap, or
+   * it will break bounds checking of a SubMap.
+   */
+  static final TreeNode nil = new TreeNode(null, null, BLACK);
+  static
+    {
+      // Nil is self-referential, so we must initialize it after creation.
+      nil.parent = nil;
+      nil.left = nil;
+      nil.right = nil;
+    }
+
+  /**
+   * The root node of this TreeMap.
+   */
+  private transient TreeNode root;
+
+  /**
+   * The size of this TreeMap. Package visible for use by nested classes.
+   */
+  transient int size;
+
+  /**
+   * The cache for {@link #entrySet()}.
+   */
+  //private transient Set<Map.Entry<K,V>> entries;
+
+  /**
+   * The cache for {@link #descendingMap()}.
+   */
+  //private transient NavigableMap<K,V> descendingMap;
+
+  /**
+   * The cache for {@link #navigableKeySet()}.
+   */
+  //private transient NavigableSet<K> nKeys;
+
+  /**
+   * Counts the number of modifications this TreeMap has undergone, used
+   * by Iterators to know when to throw ConcurrentModificationExceptions.
+   * Package visible for use by nested classes.
+   */
+  transient int modCount;
+
+  /**
+   * This TreeMap's comparator, or null for natural ordering.
+   * Package visible for use by nested classes.
+   * @serial the comparator ordering this tree, or null
+   */
+  //final Comparator<? super K> comparator;
+
+  /**
+   * Instantiate a new TreeMap with no elements, using the keys' natural
+   * ordering to sort. All entries in the map must have a key which implements
+   * Comparable, and which are <i>mutually comparable</i>, otherwise map
+   * operations may throw a {@link ClassCastException}. Attempts to use
+   * a null key will throw a {@link NullPointerException}.
+   *
+   * @see Comparable
+   */
+  public TreeMap()
+  {
+    /*this((Comparator) null);
+  }
+
+  /**
+   * Instantiate a new TreeMap with no elements, using the provided comparator
+   * to sort. All entries in the map must have keys which are mutually
+   * comparable by the Comparator, otherwise map operations may throw a
+   * {@link ClassCastException}.
+   *
+   * @param c the sort order for the keys of this map, or null
+   *        for the natural order
+   */
+  /*public TreeMap(Comparator<? super K> c)
+  {
+    comparator = c;*/
+    fabricateTree(0);
+  }
+
+  /**
+   * Instantiate a new TreeMap, initializing it with all of the elements in
+   * the provided Map.  The elements will be sorted using the natural
+   * ordering of the keys. This algorithm runs in n*log(n) time. All entries
+   * in the map must have keys which implement Comparable and are mutually
+   * comparable, otherwise map operations may throw a
+   * {@link ClassCastException}.
+   *
+   * @param map a Map, whose entries will be put into this TreeMap
+   * @throws ClassCastException if the keys in the provided Map are not
+   *         comparable
+   * @throws NullPointerException if map is null
+   * @see Comparable
+   */
+  /*public TreeMap(Map<? extends K, ? extends V> map)
+  {
+    this((Comparator) null);
+    putAll(map);
+  }*/
+
+  /**
+   * Instantiate a new TreeMap, initializing it with all of the elements in
+   * the provided SortedMap.  The elements will be sorted using the same
+   * comparator as in the provided SortedMap. This runs in linear time.
+   *
+   * @param sm a SortedMap, whose entries will be put into this TreeMap
+   * @throws NullPointerException if sm is null
+   */
+  /*public TreeMap(SortedMap<K, ? extends V> sm)
+  {
+    this(sm.comparator());
+    int pos = sm.size();
+    Iterator itr = sm.entrySet().iterator();
+
+    fabricateTree(pos);
+    Node node = firstNode();
+
+    while (--pos >= 0)
+      {
+        Map.Entry me = (Map.Entry) itr.next();
+        node.key = me.getKey();
+        node.value = me.getValue();
+        node = successor(node);
+      }
+  }*/
+
+  /**
+   * Clears the Map so it has no keys. This is O(1).
+   */
+  public void clear()
+  {
+    if (size > 0)
+      {
+        modCount++;
+        root = nil;
+        size = 0;
+      }
+  }
+
+  /**
+   * Returns a shallow clone of this TreeMap. The Map itself is cloned,
+   * but its contents are not.
+   *
+   * @return the clone
+   */
+  /*public Object clone()
+  {
+    TreeMap copy = null;
+    try
+      {
+        copy = (TreeMap) super.clone();
+      }
+    catch (CloneNotSupportedException x)
+      {
+      }
+    copy.entries = null;
+    copy.fabricateTree(size);
+
+    Node node = firstNode();
+    Node cnode = copy.firstNode();
+
+    while (node != nil)
+      {
+        cnode.key = node.key;
+        cnode.value = node.value;
+        node = successor(node);
+        cnode = copy.successor(cnode);
+      }
+    return copy;
+  }*/
+
+  /**
+   * Return the comparator used to sort this map, or null if it is by
+   * natural order.
+   *
+   * @return the map's comparator
+   */
+  /*public Comparator<? super K> comparator()
+  {
+    return comparator;
+  }*/
+
+  /**
+   * Returns true if the map contains a mapping for the given key.
+   *
+   * @param key the key to look for
+   * @return true if the key has a mapping
+   * @throws ClassCastException if key is not comparable to map elements
+   * @throws NullPointerException if key is null and the comparator is not
+   *         tolerant of nulls
+   */
+  public boolean containsKey(Object key)
+  {
+    return getNode(key) != nil;
+  }
+
+  /**
+   * Returns true if the map contains at least one mapping to the given value.
+   * This requires linear time.
+   *
+   * @param value the value to look for
+   * @return true if the value appears in a mapping
+   */
+  /*public boolean containsValue(Object value)
+  {
+    Node node = firstNode();
+    while (node != nil)
+      {
+        if (equals(value, node.value))
+          return true;
+        node = successor(node);
+      }
+    return false;
+  }*/
+
+  /**
+   * Returns a "set view" of this TreeMap's entries. The set is backed by
+   * the TreeMap, so changes in one show up in the other.  The set supports
+   * element removal, but not element addition.<p>
+   *
+   * Note that the iterators for all three views, from keySet(), entrySet(),
+   * and values(), traverse the TreeMap in sorted sequence.
+   *
+   * @return a set view of the entries
+   * @see #keySet()
+   * @see #values()
+   * @see Map.Entry
+   */
+  /*public Set<Map.Entry<K,V>> entrySet()
+  {
+    if (entries == null)
+      // Create an AbstractSet with custom implementations of those methods
+      // that can be overriden easily and efficiently.
+      entries = new NavigableEntrySet();
+    return entries;
+  }*/
+
+  /**
+   * Returns the first (lowest) key in the map.
+   *
+   * @return the first key
+   * @throws NoSuchElementException if the map is empty
+   */
+  public Object firstKey()
+  {
+    if (root == nil)
+      throw new /*NoSuchElement*/Exception("NoSuchElementException");
+    return firstNode().key;
+  }
+
+  /**
+   * Return the value in this TreeMap associated with the supplied key,
+   * or <code>null</code> if the key maps to nothing.  NOTE: Since the value
+   * could also be null, you must use containsKey to see if this key
+   * actually maps to something.
+   *
+   * @param key the key for which to fetch an associated value
+   * @return what the key maps to, if present
+   * @throws ClassCastException if key is not comparable to elements in the map
+   * @throws NullPointerException if key is null but the comparator does not
+   *         tolerate nulls
+   * @see #put(Object, Object)
+   * @see #containsKey(Object)
+   */
+  public Object get(Object key)
+  {
+    // Exploit fact that nil.value == null.
+    return getNode(key).value;
+  }
+
+  /**
+   * Returns the last (highest) key in the map.
+   *
+   * @return the last key
+   * @throws NoSuchElementException if the map is empty
+   */
+  public Object lastKey()
+  {
+    if (root == nil)
+      throw new /*NoSuchElement*/Exception("NoSuchElementException empty");
+    return lastNode().key;
+  }
+
+  /**
+   * Puts the supplied value into the Map, mapped by the supplied key.
+   * The value may be retrieved by any object which <code>equals()</code>
+   * this key. NOTE: Since the prior value could also be null, you must
+   * first use containsKey if you want to see if you are replacing the
+   * key's mapping.
+   *
+   * @param key the key used to locate the value
+   * @param value the value to be stored in the Map
+   * @return the prior mapping of the key, or null if there was none
+   * @throws ClassCastException if key is not comparable to current map keys
+   * @throws NullPointerException if key is null, but the comparator does
+   *         not tolerate nulls
+   * @see #get(Object)
+   * @see Object#equals(Object)
+   */
+  public Object put(Object key, Object value)
+  {
+    TreeNode current = root;
+    TreeNode parent = nil;
+    int comparison = 0;
+
+    // Find new node's parent.
+    while (current != nil)
+      {
+        parent = current;
+        comparison = compare(key, current.key);
+        if (comparison > 0)
+          current = current.right;
+        else if (comparison < 0)
+          current = current.left;
+        else // Key already in tree.
+          return current.setValue(value);
+      }
+
+    // Set up new node.
+    TreeNode n = new TreeNode(key, value, RED);
+    n.parent = parent;
+
+    // Insert node in tree.
+    modCount++;
+    size++;
+    if (parent == nil)
+      {
+        // Special case inserting into an empty tree.
+        root = n;
+        return null;
+      }
+    if (comparison > 0)
+      parent.right = n;
+    else
+      parent.left = n;
+
+    // Rebalance after insert.
+    insertFixup(n);
+    return null;
+  }
+
+  /**
+   * Copies all elements of the given map into this TreeMap.  If this map
+   * already has a mapping for a key, the new mapping replaces the current
+   * one.
+   *
+   * @param m the map to be added
+   * @throws ClassCastException if a key in m is not comparable with keys
+   *         in the map
+   * @throws NullPointerException if a key in m is null, and the comparator
+   *         does not tolerate nulls
+   */
+  /*public void putAll(Map<? extends K, ? extends V> m)
+  {
+    Iterator itr = m.entrySet().iterator();
+    int pos = m.size();
+    while (--pos >= 0)
+      {
+        Map.Entry<K,V> e = (Map.Entry<K,V>) itr.next();
+        put(e.getKey(), e.getValue());
+      }
+  }*/
+
+  /**
+   * Removes from the TreeMap and returns the value which is mapped by the
+   * supplied key. If the key maps to nothing, then the TreeMap remains
+   * unchanged, and <code>null</code> is returned. NOTE: Since the value
+   * could also be null, you must use containsKey to see if you are
+   * actually removing a mapping.
+   *
+   * @param key the key used to locate the value to remove
+   * @return whatever the key mapped to, if present
+   * @throws ClassCastException if key is not comparable to current map keys
+   * @throws NullPointerException if key is null, but the comparator does
+   *         not tolerate nulls
+   */
+  public Object remove(Object key)
+  {
+    TreeNode n = getNode(key);
+    if (n == nil)
+      return null;
+    // Note: removeNode can alter the contents of n, so save value now.
+    Object result = n.value;
+    removeNode(n);
+    return result;
+  }
+
+  /**
+   * Returns the number of key-value mappings currently in this Map.
+   *
+   * @return the size
+   */
+  public int size()
+  {
+    return size;
+  }
+
+  /**
+   * Maintain red-black balance after deleting a node.
+   *
+   * @param node the child of the node just deleted, possibly nil
+   * @param parent the parent of the node just deleted, never nil
+   */
+  private void deleteFixup(TreeNode node, TreeNode parent)
+  {
+    // if (parent == nil)
+    //   throw new InternalError();
+    // If a black node has been removed, we need to rebalance to avoid
+    // violating the "same number of black nodes on any path" rule. If
+    // node is red, we can simply recolor it black and all is well.
+    while (node != root && node.color == BLACK)
+      {
+        if (node == parent.left)
+          {
+            // Rebalance left side.
+            TreeNode sibling = parent.right;
+            // if (sibling == nil)
+            //   throw new InternalError();
+            if (sibling.color == RED)
+              {
+                // Case 1: Sibling is red.
+                // Recolor sibling and parent, and rotate parent left.
+                sibling.color = BLACK;
+                parent.color = RED;
+                rotateLeft(parent);
+                sibling = parent.right;
+              }
+
+            if (sibling.left.color == BLACK && sibling.right.color == BLACK)
+              {
+                // Case 2: Sibling has no red children.
+                // Recolor sibling, and move to parent.
+                sibling.color = RED;
+                node = parent;
+                parent = parent.parent;
+              }
+            else
+              {
+                if (sibling.right.color == BLACK)
+                  {
+                    // Case 3: Sibling has red left child.
+                    // Recolor sibling and left child, rotate sibling right.
+                    sibling.left.color = BLACK;
+                    sibling.color = RED;
+                    rotateRight(sibling);
+                    sibling = parent.right;
+                  }
+                // Case 4: Sibling has red right child. Recolor sibling,
+                // right child, and parent, and rotate parent left.
+                sibling.color = parent.color;
+                parent.color = BLACK;
+                sibling.right.color = BLACK;
+                rotateLeft(parent);
+                node = root; // Finished.
+              }
+          }
+        else
+          {
+            // Symmetric "mirror" of left-side case.
+            TreeNode sibling = parent.left;
+            // if (sibling == nil)
+            //   throw new InternalError();
+            if (sibling.color == RED)
+              {
+                // Case 1: Sibling is red.
+                // Recolor sibling and parent, and rotate parent right.
+                sibling.color = BLACK;
+                parent.color = RED;
+                rotateRight(parent);
+                sibling = parent.left;
+              }
+
+            if (sibling.right.color == BLACK && sibling.left.color == BLACK)
+              {
+                // Case 2: Sibling has no red children.
+                // Recolor sibling, and move to parent.
+                sibling.color = RED;
+                node = parent;
+                parent = parent.parent;
+              }
+            else
+              {
+                if (sibling.left.color == BLACK)
+                  {
+                    // Case 3: Sibling has red right child.
+                    // Recolor sibling and right child, rotate sibling left.
+                    sibling.right.color = BLACK;
+                    sibling.color = RED;
+                    rotateLeft(sibling);
+                    sibling = parent.left;
+                  }
+                // Case 4: Sibling has red left child. Recolor sibling,
+                // left child, and parent, and rotate parent right.
+                sibling.color = parent.color;
+                parent.color = BLACK;
+                sibling.left.color = BLACK;
+                rotateRight(parent);
+                node = root; // Finished.
+              }
+          }
+      }
+    node.color = BLACK;
+  }
+
+  /**
+   * Construct a perfectly balanced tree consisting of n "blank" nodes. This
+   * permits a tree to be generated from pre-sorted input in linear time.
+   *
+   * @param count the number of blank nodes, non-negative
+   */
+  private void fabricateTree(final int count)
+  {
+    if (count == 0)
+      {
+       root = nil;
+       size = 0;
+       return;
+      }
+
+    // We color every row of nodes black, except for the overflow nodes.
+    // I believe that this is the optimal arrangement. We construct the tree
+    // in place by temporarily linking each node to the next node in the row,
+    // then updating those links to the children when working on the next row.
+
+    // Make the root node.
+    root = new TreeNode(null, null, BLACK);
+    size = count;
+    TreeNode row = root;
+    int rowsize;
+
+    // Fill each row that is completely full of nodes.
+    for (rowsize = 2; rowsize + rowsize <= count; rowsize <<= 1)
+      {
+        TreeNode parent = row;
+        TreeNode last = null;
+        for (int i = 0; i < rowsize; i += 2)
+          {
+            TreeNode left = new TreeNode(null, null, BLACK);
+            TreeNode right = new TreeNode(null, null, BLACK);
+            left.parent = parent;
+            left.right = right;
+            right.parent = parent;
+            parent.left = left;
+            TreeNode next = parent.right;
+            parent.right = right;
+            parent = next;
+            if (last != null)
+              last.right = left;
+            last = right;
+          }
+        row = row.left;
+      }
+
+    // Now do the partial final row in red.
+    int overflow = count - rowsize;
+    TreeNode parent = row;
+    int i;
+    for (i = 0; i < overflow; i += 2)
+      {
+        TreeNode left = new TreeNode(null, null, RED);
+        TreeNode right = new TreeNode(null, null, RED);
+        left.parent = parent;
+        right.parent = parent;
+        parent.left = left;
+        TreeNode next = parent.right;
+        parent.right = right;
+        parent = next;
+      }
+    // Add a lone left node if necessary.
+    if (i - overflow == 0)
+      {
+        TreeNode left = new TreeNode(null, null, RED);
+        left.parent = parent;
+        parent.left = left;
+        parent = parent.right;
+        left.parent.right = nil;
+      }
+    // Unlink the remaining nodes of the previous row.
+    while (parent != nil)
+      {
+        TreeNode next = parent.right;
+        parent.right = nil;
+        parent = next;
+      }
+  }
+
+  /**
+   * Returns the first sorted node in the map, or nil if empty. Package
+   * visible for use by nested classes.
+   *
+   * @return the first node
+   */
+  final TreeNode firstNode()
+  {
+    // Exploit fact that nil.left == nil.
+    TreeNode node = root;
+    while (node.left != nil)
+      node = node.left;
+    return node;
+  }
+  
+  /**
+   * Return the node following the given one, or nil if there isn't one.
+   * Package visible for use by nested classes.
+   *
+   * @param node the current node, not nil
+   * @return the next node in sorted order
+   */
+  final TreeNode successor(TreeNode node)
+  {
+    if (node.right != nil)
+      {
+        node = node.right;
+        while (node.left != nil)
+          node = node.left;
+        return node;
+      }
+
+    TreeNode parent = node.parent;
+    // Exploit fact that nil.right == nil and node is non-nil.
+    while (node == parent.right)
+      {
+        node = parent;
+        parent = parent.parent;
+      }
+    return parent;
+  }
+
+
+  /**
+   * Return the TreeMap.Node associated with key, or the nil node if no such
+   * node exists in the tree. Package visible for use by nested classes.
+   *
+   * @param key the key to search for
+   * @return the node where the key is found, or nil
+   */
+  final TreeNode getNode(Object key)
+  {
+    TreeNode current = root;
+    while (current != nil)
+      {
+        int comparison = compare(key, current.key);
+        if (comparison > 0)
+          current = current.right;
+        else if (comparison < 0)
+          current = current.left;
+        else
+          return current;
+      }
+    return current;
+  }
+  
+  final int compare(Object o1, Object o2)
+  {
+    if((o1 instanceof Integer) && (o2 instanceof Integer)) {
+      if(((Integer)o1).intValue() > ((Integer)o2).intValue()) {
+        return 1;
+      } else if(((Integer)o1).intValue() > ((Integer)o2).intValue()) {
+        return 0;
+      } else {
+        return -1;
+      }
+    }
+    System.println("Compare non-int values in TreeMap.compare(Object, Object)");
+    return 0;
+  }
+  
+  /**
+   * Maintain red-black balance after inserting a new node.
+   *
+   * @param n the newly inserted node
+   */
+  private void insertFixup(TreeNode n)
+  {
+    // Only need to rebalance when parent is a RED node, and while at least
+    // 2 levels deep into the tree (ie: node has a grandparent). Remember
+    // that nil.color == BLACK.
+    while (n.parent.color == RED && n.parent.parent != nil)
+      {
+        if (n.parent == n.parent.parent.left)
+          {
+            TreeNode uncle = n.parent.parent.right;
+            // Uncle may be nil, in which case it is BLACK.
+            if (uncle.color == RED)
+              {
+                // Case 1. Uncle is RED: Change colors of parent, uncle,
+                // and grandparent, and move n to grandparent.
+                n.parent.color = BLACK;
+                uncle.color = BLACK;
+                uncle.parent.color = RED;
+                n = uncle.parent;
+              }
+            else
+              {
+                if (n == n.parent.right)
+                  {
+                    // Case 2. Uncle is BLACK and x is right child.
+                    // Move n to parent, and rotate n left.
+                    n = n.parent;
+                    rotateLeft(n);
+                  }
+                // Case 3. Uncle is BLACK and x is left child.
+                // Recolor parent, grandparent, and rotate grandparent right.
+                n.parent.color = BLACK;
+                n.parent.parent.color = RED;
+                rotateRight(n.parent.parent);
+              }
+          }
+        else
+          {
+            // Mirror image of above code.
+            TreeNode uncle = n.parent.parent.left;
+            // Uncle may be nil, in which case it is BLACK.
+            if (uncle.color == RED)
+              {
+                // Case 1. Uncle is RED: Change colors of parent, uncle,
+                // and grandparent, and move n to grandparent.
+                n.parent.color = BLACK;
+                uncle.color = BLACK;
+                uncle.parent.color = RED;
+                n = uncle.parent;
+              }
+            else
+              {
+                if (n == n.parent.left)
+                {
+                    // Case 2. Uncle is BLACK and x is left child.
+                    // Move n to parent, and rotate n right.
+                    n = n.parent;
+                    rotateRight(n);
+                  }
+                // Case 3. Uncle is BLACK and x is right child.
+                // Recolor parent, grandparent, and rotate grandparent left.
+                n.parent.color = BLACK;
+                n.parent.parent.color = RED;
+                rotateLeft(n.parent.parent);
+              }
+          }
+      }
+    root.color = BLACK;
+  }
+
+  /**
+   * Returns the last sorted node in the map, or nil if empty.
+   *
+   * @return the last node
+   */
+  public TreeNode lastNode()
+  {
+    // Exploit fact that nil.right == nil.
+    TreeNode node = root;
+    while (node.right != nil)
+      node = node.right;
+    return node;
+  }
+  
+  /**
+   * Remove node from tree. This will increment modCount and decrement size.
+   * Node must exist in the tree. Package visible for use by nested classes.
+   *
+   * @param node the node to remove
+   */
+  final void removeNode(TreeNode node)
+  {
+    TreeNode splice;
+    TreeNode child;
+
+    modCount++;
+    size--;
+
+    // Find splice, the node at the position to actually remove from the tree.
+    if (node.left == nil)
+      {
+        // Node to be deleted has 0 or 1 children.
+        splice = node;
+        child = node.right;
+      }
+    else if (node.right == nil)
+      {
+        // Node to be deleted has 1 child.
+        splice = node;
+        child = node.left;
+      }
+    else
+      {
+        // Node has 2 children. Splice is node's predecessor, and we swap
+        // its contents into node.
+        splice = node.left;
+        while (splice.right != nil)
+          splice = splice.right;
+        child = splice.left;
+        node.key = splice.key;
+        node.value = splice.value;
+      }
+
+    // Unlink splice from the tree.
+    TreeNode parent = splice.parent;
+    if (child != nil)
+      child.parent = parent;
+    if (parent == nil)
+      {
+        // Special case for 0 or 1 node remaining.
+        root = child;
+        return;
+      }
+    if (splice == parent.left)
+      parent.left = child;
+    else
+      parent.right = child;
+
+    if (splice.color == BLACK)
+      deleteFixup(child, parent);
+  }
+
+  /**
+   * Rotate node n to the left.
+   *
+   * @param node the node to rotate
+   */
+  private void rotateLeft(TreeNode node)
+  {
+    TreeNode child = node.right;
+    // if (node == nil || child == nil)
+    //   throw new InternalError();
+
+    // Establish node.right link.
+    node.right = child.left;
+    if (child.left != nil)
+      child.left.parent = node;
+
+    // Establish child->parent link.
+    child.parent = node.parent;
+    if (node.parent != nil)
+      {
+        if (node == node.parent.left)
+          node.parent.left = child;
+        else
+          node.parent.right = child;
+      }
+    else
+      root = child;
+
+    // Link n and child.
+    child.left = node;
+    node.parent = child;
+  }
+
+  /**
+   * Rotate node n to the right.
+   *
+   * @param node the node to rotate
+   */
+  private void rotateRight(TreeNode node)
+  {
+    TreeNode child = node.left;
+    // if (node == nil || child == nil)
+    //   throw new InternalError();
+
+    // Establish node.left link.
+    node.left = child.right;
+    if (child.right != nil)
+      child.right.parent = node;
+
+    // Establish child->parent link.
+    child.parent = node.parent;
+    if (node.parent != nil)
+      {
+        if (node == node.parent.right)
+          node.parent.right = child;
+        else
+          node.parent.left = child;
+      }
+    else
+      root = child;
+
+    // Link n and child.
+    child.right = node;
+    node.parent = child;
+  }
+  
+  public TreeMap subMap(Object fromKey, Object toKey)
+  {
+    new SubMap(fromKey, toKey)
+  }
+  
+  /**
+   * Find the "lowest" node which is &gt;= key. If key is nil, return either
+   * nil or the first node, depending on the parameter first.  Package visible
+   * for use by nested classes.
+   *
+   * @param key the lower bound, inclusive
+   * @param first true to return the first element instead of nil for nil key
+   * @return the next node
+   */
+  final TreeNode lowestGreaterThan(Object key, boolean first)
+  {
+    return lowestGreaterThan(key, first, true);
+  }
+
+  /**
+   * Find the "lowest" node which is &gt; (or equal to, if <code>equal</code>
+   * is true) key. If key is nil, return either nil or the first node, depending
+   * on the parameter first.  Package visible for use by nested classes.
+   *
+   * @param key the lower bound, inclusive
+   * @param first true to return the first element instead of nil for nil key
+   * @param equal true if the key should be returned if found.
+   * @return the next node
+   */
+  final TreeNode lowestGreaterThan(Object key, boolean first, boolean equal)
+  {
+    if (key == nil)
+      return first ? firstNode() : nil;
+
+    TreeNode last = nil;
+    TreeNode current = root;
+    int comparison = 0;
+
+    while (current != nil)
+      {
+        last = current;
+        comparison = compare(key, current.key);
+        if (comparison > 0)
+          current = current.right;
+        else if (comparison < 0)
+          current = current.left;
+        else
+          return (equal ? current : successor(current));
+      }
+    return comparison > 0 ? successor(last) : last;
+  }
+  
+  /* 0=keys, 1=values, 2=entities */
+  public Iterator iterator(int type) {
+    return (Iterator)(new TreeMapIterator(this, type));
+  }
+} // class TreeMap
diff --git a/Robust/src/ClassLibrary/MGC/gnu/TreeMapIterator.java b/Robust/src/ClassLibrary/MGC/gnu/TreeMapIterator.java
new file mode 100644 (file)
index 0000000..dfb4996
--- /dev/null
@@ -0,0 +1,95 @@
+public final class TreeMapIterator implements Iterator
+{
+  /**
+   * The type of this Iterator: {@link #KEYS}, {@link #VALUES},
+   * or {@link #ENTRIES}.
+   */
+  private final int type;
+  /** The number of modifications to the backing Map that we know about. */
+  private int knownMod = modCount;
+  /** The last Entry returned by a next() call. */
+  private TreeNode last;
+  /** The next entry that should be returned by next(). */
+  private TreeNode next;
+  /**
+   * The last node visible to this iterator. This is used when iterating
+   * on a SubMap.
+   */
+  private final TreeNode max;
+  
+  TreeMap map;
+
+  /**
+   * Construct a new TreeIterator with the supplied type.
+   * @param type {@link #KEYS}, {@link #VALUES}, or {@link #ENTRIES}
+   */
+  TreeMapIterator(TreeMap map, int type)
+  {
+    this(type, map, map.firstNode(), nil);
+  }
+
+  /**
+   * Construct a new TreeIterator with the supplied type. Iteration will
+   * be from "first" (inclusive) to "max" (exclusive).
+   *
+   * @param type {@link #KEYS}, {@link #VALUES}, or {@link #ENTRIES}
+   * @param first where to start iteration, nil for empty iterator
+   * @param max the cutoff for iteration, nil for all remaining nodes
+   */
+  TreeIterator(int type, TreeMap map, TreeNode first, TreeNode max)
+  {
+    this.map = map;
+    this.type = type;
+    this.next = first;
+    this.max = max;
+  }
+
+  /**
+   * Returns true if the Iterator has more elements.
+   * @return true if there are more elements
+   */
+  public boolean hasNext()
+  {
+    return next != max;
+  }
+
+  /**
+   * Returns the next element in the Iterator's sequential view.
+   * @return the next element
+   * @throws ConcurrentModificationException if the TreeMap was modified
+   * @throws NoSuchElementException if there is none
+   */
+  public Object next()
+  {
+    if (knownMod != modCount)
+      throw new /*ConcurrentModification*/Exception("ConcurrentModificationException");
+    if (next == max)
+      throw new /*NoSuchElementException*/("NoSuchElementException");
+    last = next;
+    next = map.successor(last);
+
+    if (type == 1/*VALUES*/)
+      return last.value;
+    else if (type == 0/*KEYS*/)
+      return last.key;
+    return last;
+  }
+
+  /**
+   * Removes from the backing TreeMap the last element which was fetched
+   * with the <code>next()</code> method.
+   * @throws ConcurrentModificationException if the TreeMap was modified
+   * @throws IllegalStateException if called when there is no last element
+   */
+  public void remove()
+  {
+    if (last == null)
+      throw new /*IllegalState*/Exception("IllegalStateException");
+    if (knownMod != modCount)
+      throw new /*ConcurrentModification*/Exception("ConcurrentModificationException");
+
+    map.removeNode(last);
+    last = null;
+    knownMod++;
+  }
+} // class TreeMapIterator
\ No newline at end of file
diff --git a/Robust/src/ClassLibrary/MGC/gnu/TreeNode.java b/Robust/src/ClassLibrary/MGC/gnu/TreeNode.java
new file mode 100644 (file)
index 0000000..cccd08a
--- /dev/null
@@ -0,0 +1,35 @@
+import TreeMap.Node;
+
+/**
+   * Class to represent an entry in the tree. Holds a single key-value pair,
+   * plus pointers to parent and child nodes.
+   *
+   * @author Eric Blake (ebb9@email.byu.edu)
+   */
+  public static final class TreeNode//<K, V> extends AbstractMap.SimpleEntry<K, V>
+  {
+    // All fields package visible for use by nested classes.
+    /** The color of this node. */
+    int color;
+    Object key;
+    Object value;
+
+    /** The left child node. */
+    TreeNode left = nil;
+    /** The right child node. */
+    TreeNode right = nil;
+    /** The parent node. */
+    TreeNode parent = nil;
+
+    /**
+     * Simple constructor.
+     * @param key the key
+     * @param value the value
+     */
+    TreeNode(Object key, Object value, int color)
+    {
+      key = key;
+      value = value;
+      this.color = color;
+    }
+  }
\ No newline at end of file
diff --git a/Robust/src/ClassLibrary/MGC/gnu/TreeSubMap.java b/Robust/src/ClassLibrary/MGC/gnu/TreeSubMap.java
new file mode 100644 (file)
index 0000000..1bdea0a
--- /dev/null
@@ -0,0 +1,53 @@
+public final class TreeSubMap
+{
+  TreeMap map;
+  /**
+   * The lower range of this view, inclusive, or nil for unbounded.
+   * Package visible for use by nested classes.
+   */
+  final Object minKey;
+
+  /**
+   * The upper range of this view, exclusive, or nil for unbounded.
+   * Package visible for use by nested classes.
+   */
+  final Object maxKey;
+
+  /**
+   * Create a SubMap representing the elements between minKey (inclusive)
+   * and maxKey (exclusive). If minKey is nil, SubMap has no lower bound
+   * (headMap). If maxKey is nil, the SubMap has no upper bound (tailMap).
+   *
+   * @param minKey the lower bound
+   * @param maxKey the upper bound
+   * @throws IllegalArgumentException if minKey &gt; maxKey
+   */
+  TreeSubMap(TreeMap map, Object minKey, Object maxKey)
+  {
+    this.map = map;
+    if (minKey != nil && maxKey != nil && map.compare(minKey, maxKey) > 0)
+      throw new /*IllegalArgument*/Exception("IllegalArgumentException: fromKey > toKey");
+    this.minKey = minKey;
+    this.maxKey = maxKey;
+  }
+
+  public int size()
+  {
+    TreeNode node = map.lowestGreaterThan(minKey, true);
+    TreeNode max = map.lowestGreaterThan(maxKey, false);
+    int count = 0;
+    while (node != max)
+    {
+      count++;
+      node = map.successor(node);
+    }
+    return count;
+  }
+  
+  /* 0=keys, 1=values, 2=entities */
+  public Iterator iterator(int type) {
+    TreeNode node = map.lowestGreaterThan(minKey, true);
+    TreeNode max = map.lowestGreaterThan(maxKey, false);
+    return (Iterator)(new TreeMapIterator(this.map, type, node, max));
+  }
+} // class SubMap  
\ No newline at end of file
diff --git a/Robust/src/ClassLibrary/Map.java b/Robust/src/ClassLibrary/Map.java
new file mode 100644 (file)
index 0000000..1156a95
--- /dev/null
@@ -0,0 +1,249 @@
+/* Map.java: interface Map -- An object that maps keys to values
+             interface Map.Entry -- an Entry in a Map
+   Copyright (C) 1998, 2001, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+/**
+ * An object that maps keys onto values. Keys cannot be duplicated. This
+ * interface replaces the obsolete {@link Dictionary} abstract class.
+ * <p>
+ *
+ * The map has three collection views, which are backed by the map
+ * (modifications on one show up on the other): a set of keys, a collection
+ * of values, and a set of key-value mappings. Some maps have a guaranteed
+ * order, but not all do.
+ * <p>
+ *
+ * Note: Be careful about using mutable keys.  Behavior is unspecified if
+ * a key's comparison behavior is changed after the fact.  As a corollary
+ * to this rule, don't use a Map as one of its own keys or values, as it makes
+ * hashCode and equals have undefined behavior.
+ * <p>
+ *
+ * All maps are recommended to provide a no argument constructor, which builds
+ * an empty map, and one that accepts a Map parameter and copies the mappings
+ * (usually by putAll), to create an equivalent map.  Unfortunately, Java
+ * cannot enforce these suggestions.
+ * <p>
+ *
+ * The map may be unmodifiable, in which case unsupported operations will
+ * throw an UnsupportedOperationException.  Note that some operations may be
+ * safe, such as putAll(m) where m is empty, even if the operation would
+ * normally fail with a non-empty argument.
+ *
+ * @author Original author unknown
+ * @author Eric Blake (ebb9@email.byu.edu)
+ * @see HashMap
+ * @see TreeMap
+ * @see Hashtable
+ * @see SortedMap
+ * @see Collection
+ * @see Set
+ * @since 1.2
+ * @status updated to 1.4
+ */
+public interface Map//<K, V>
+{
+  /**
+   * Remove all entries from this Map (optional operation).
+   *
+   * @throws UnsupportedOperationException if clear is not supported
+   */
+  //void clear();
+
+  /**
+   * Returns true if this contains a mapping for the given key.
+   *
+   * @param key the key to search for
+   * @return true if the map contains the key
+   * @throws ClassCastException if the key is of an inappropriate type
+   * @throws NullPointerException if key is <code>null</code> but the map
+   *         does not permit null keys
+   */
+  boolean containsKey(Object key);
+
+  /**
+   * Returns true if this contains at least one mapping with the given value.
+   * In other words, returns true if a value v exists where
+   * <code>(value == null ? v == null : value.equals(v))</code>. This usually
+   * requires linear time.
+   *
+   * @param value the value to search for
+   * @return true if the map contains the value
+   * @throws ClassCastException if the type of the value is not a valid type
+   *         for this map.
+   * @throws NullPointerException if the value is null and the map doesn't
+   *         support null values.
+   */
+  //boolean containsValue(Object value);
+
+  /**
+   * Returns a set view of the mappings in this Map.  Each element in the
+   * set is a Map.Entry.  The set is backed by the map, so that changes in
+   * one show up in the other.  Modifications made while an iterator is
+   * in progress cause undefined behavior.  If the set supports removal,
+   * these methods remove the underlying mapping from the map:
+   * <code>Iterator.remove</code>, <code>Set.remove</code>,
+   * <code>removeAll</code>, <code>retainAll</code>, and <code>clear</code>.
+   * Element addition, via <code>add</code> or <code>addAll</code>, is
+   * not supported via this set.
+   *
+   * @return the set view of all mapping entries
+   * @see Map.Entry
+   */
+  //Set<Map.Entry<K, V>> entrySet();
+
+  /**
+   * Compares the specified object with this map for equality. Returns
+   * <code>true</code> if the other object is a Map with the same mappings,
+   * that is,<br>
+   * <code>o instanceof Map && entrySet().equals(((Map) o).entrySet();</code>
+   * This allows comparison of maps, regardless of implementation.
+   *
+   * @param o the object to be compared
+   * @return true if the object equals this map
+   * @see Set#equals(Object)
+   */
+  //boolean equals(Object o);
+
+  /**
+   * Returns the value mapped by the given key. Returns <code>null</code> if
+   * there is no mapping.  However, in Maps that accept null values, you
+   * must rely on <code>containsKey</code> to determine if a mapping exists.
+   *
+   * @param key the key to look up
+   * @return the value associated with the key, or null if key not in map
+   * @throws ClassCastException if the key is an inappropriate type
+   * @throws NullPointerException if this map does not accept null keys
+   * @see #containsKey(Object)
+   */
+  Object get(Object key);
+
+  /**
+   * Associates the given key to the given value (optional operation). If the
+   * map already contains the key, its value is replaced. Be aware that in
+   * a map that permits <code>null</code> values, a null return does not
+   * always imply that the mapping was created.
+   *
+   * @param key the key to map
+   * @param value the value to be mapped
+   * @return the previous value of the key, or null if there was no mapping
+   * @throws UnsupportedOperationException if the operation is not supported
+   * @throws ClassCastException if the key or value is of the wrong type
+   * @throws IllegalArgumentException if something about this key or value
+   *         prevents it from existing in this map
+   * @throws NullPointerException if either the key or the value is null,
+   *         and the map forbids null keys or values
+   * @see #containsKey(Object)
+   */
+  Object put(Object key, Object value);
+
+  /**
+   * Returns the hash code for this map. This is the sum of all hashcodes
+   * for each Map.Entry object in entrySet.  This allows comparison of maps,
+   * regardless of implementation, and satisfies the contract of
+   * Object.hashCode.
+   *
+   * @return the hash code
+   * @see Map.Entry#hashCode()
+   */
+  //int hashCode();
+
+  /**
+   * Returns true if the map contains no mappings.
+   *
+   * @return true if the map is empty
+   */
+  boolean isEmpty();
+  
+  /* 0=keys, 1=values */
+  public Iterator iterator(int type);
+
+  /**
+   * Returns a set view of the keys in this Map.  The set is backed by the
+   * map, so that changes in one show up in the other.  Modifications made
+   * while an iterator is in progress cause undefined behavior.  If the set
+   * supports removal, these methods remove the underlying mapping from
+   * the map: <code>Iterator.remove</code>, <code>Set.remove</code>,
+   * <code>removeAll</code>, <code>retainAll</code>, and <code>clear</code>.
+   * Element addition, via <code>add</code> or <code>addAll</code>, is
+   * not supported via this set.
+   *
+   * @return the set view of all keys
+   */
+  //Set<K> keySet();
+
+  /**
+   * Copies all entries of the given map to this one (optional operation). If
+   * the map already contains a key, its value is replaced.
+   *
+   * @param m the mapping to load into this map
+   * @throws UnsupportedOperationException if the operation is not supported
+   * @throws ClassCastException if a key or value is of the wrong type
+   * @throws IllegalArgumentException if something about a key or value
+   *         prevents it from existing in this map
+   * @throws NullPointerException if the map forbids null keys or values, or
+   *         if <code>m</code> is null.
+   * @see #put(Object, Object)
+   */
+  //void putAll(Map<? extends K, ? extends V> m);
+
+  /**
+   * Removes the mapping for this key if present (optional operation). If
+   * the key is not present, this returns null. Note that maps which permit
+   * null values may also return null if the key was removed.
+   *
+   * @param key the key to remove
+   * @return the value the key mapped to, or null if not present.
+   * @throws UnsupportedOperationException if deletion is unsupported
+   * @throws NullPointerException if the key is null and this map doesn't
+   *         support null keys.
+   * @throws ClassCastException if the type of the key is not a valid type
+   *         for this map.
+   */
+  Object remove(Object o);
+
+  /**
+   * Returns the number of key-value mappings in the map. If there are more
+   * than Integer.MAX_VALUE mappings, return Integer.MAX_VALUE.
+   *
+   * @return the number of mappings
+   */
+  int size();
+}
index 7e6a59f648ed6a1b206cb6245acffb2d37118e78..878eb0b211b22f3ddc4231ee476e80ca30801195 100644 (file)
@@ -133,4 +133,6 @@ public class Math {
   public static native float logf(float a);
   public static native float powf(float a, float b);
   public static native float ceilf(float a);
+  
+  public static native float IEEEremainder(float f1, float f2);
 }
index e306e742c7798a482c34ddce1e938806bad1eeca..b685780a5071f5fb9ec00ae69ec8e1f0ebb7af65 100644 (file)
@@ -112,6 +112,10 @@ public class String {
     return this.lastindexOf(ch, count - 1);
   }
 
+  public int lastIndexOf(char ch) {
+    return this.lastindexOf((int)ch, count - 1);
+  }
+  
   public static String concat2(String s1, String s2) {
     if (s1==null)
       return "null".concat(s2);
@@ -486,4 +490,19 @@ public class String {
     return false;
 
   }
+  
+  public String trim() {
+    int len = count;
+    int st = 0;
+    int off = offset;      /* avoid getfield opcode */
+    char[] val = value;    /* avoid getfield opcode */
+
+    while ((st < len) && (val[off + st] <= ' ')) {
+      st++;
+    }
+    while ((st < len) && (val[off + len - 1] <= ' ')) {
+      len--;
+    }
+    return ((st > 0) || (len < count)) ? substring(st, len) : this;
+  }
 }
index 05443dac8b09140f7439dd32de004347d140277c..74a6c66f548a51ba6d7b87a91aa87b8e50f5a853 100644 (file)
@@ -1,4 +1,12 @@
+import java.util.Properties;
+
 public class System {
+  PrintStream out;
+  
+  public System() {
+    out = new PrintStream("System.out");
+  }
+  
   public static void printInt(int x) {
     String s=String.valueOf(x);
     printString(s);
@@ -31,6 +39,10 @@ public class System {
   public static void println(long o) {
     System.printString(""+o+"\n");
   }
+  
+  public static void println() {
+    System.printString("\n");
+  }
 
   public static void print(String s) {
     System.printString(s);
@@ -82,4 +94,11 @@ public class System {
 
   // for disjoint reachability analysis
   public static void genReach();
+  
+  private static Properties props;
+  private static native Properties initProperties(Properties props);
+  
+  public static Properties getProperties() {
+    return props;
+  }
 }
index 42ab24f9f60f1147bcc4680f78e4ada828a2d8b5..5f506edf469550f02e0af76495e50b6cc9d97b83 100644 (file)
@@ -1,4 +1,4 @@
-public class Vector {
+public class Vector implements Set {
   Object[] array;
   int size;
   int capacityIncrement;
@@ -95,6 +95,14 @@ public class Vector {
     }
     array[size++]=obj;
   }
+  
+  public boolean add(Object obj) {
+    if (size==array.length) {
+      ensureCapacity(size+1);
+    }
+    array[size++]=obj;
+    return true;
+  }
 
   public void insertElementAt(Object obj, int index) {
     if (index<0||index>size) {
@@ -130,4 +138,20 @@ public class Vector {
       removeElementAt(0);
     }
   }
+  
+  public Object[] toArray() {
+    Object[] tarray = new Object[this.size];
+    for(int i = 0; i < this.size; i++) {
+      tarray[i] = this.array[i];
+    }
+    return tarray;
+  }
+  
+  public Vector(Set s) {
+    Object[] sarray = s.toArray();
+    capacityIncrement=0;
+    this.size=sarray.length;
+    array=sarray;
+  }
+  
 }