[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: tansformattribute fix

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 19 09:39:48 PST 2005


PatchSet 5573 
Date: 2005/02/19 17:29:12
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with  GNU Classpath: tansformattribute fix

2005-02-19  Dalibor Topic  <robilad at kaffe.org>

Resynced with GNU Classpath.

2005-02-18  David Gilbert  <david.gilbert at object-refinery.com>

* java/awt/font/TransformAttribute.java,
(TransformAttribute(AffineTransform)): throw
IllegalArgumentException for null transform.
(getTransform): return a copy of transform.
Added doc comments to all.

Members: 
	ChangeLog:1.3617->1.3618 
	libraries/javalib/java/awt/font/TransformAttribute.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3617 kaffe/ChangeLog:1.3618
--- kaffe/ChangeLog:1.3617	Sat Feb 19 17:26:44 2005
+++ kaffe/ChangeLog	Sat Feb 19 17:29:12 2005
@@ -2,6 +2,18 @@
 
 	Resynced with GNU Classpath.
 	
+	2005-02-18  David Gilbert  <david.gilbert at object-refinery.com>
+
+	* java/awt/font/TransformAttribute.java,
+	(TransformAttribute(AffineTransform)): throw 
+	IllegalArgumentException for null transform.
+	(getTransform): return a copy of transform.
+	Added doc comments to all.
+	
+2005-02-19  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
 	2005-02-18  Sven de Marothy <sven at physto.se>
 
 	* java/util/TimeZone.java,
Index: kaffe/libraries/javalib/java/awt/font/TransformAttribute.java
diff -u kaffe/libraries/javalib/java/awt/font/TransformAttribute.java:1.1 kaffe/libraries/javalib/java/awt/font/TransformAttribute.java:1.2
--- kaffe/libraries/javalib/java/awt/font/TransformAttribute.java:1.1	Fri Aug 15 16:59:01 2003
+++ kaffe/libraries/javalib/java/awt/font/TransformAttribute.java	Sat Feb 19 17:29:16 2005
@@ -1,5 +1,5 @@
-/* TransformAttribute.java
-   Copyright (C) 2003 Free Software Foundation, Inc.
+/* TransformAttribute.java --
+   Copyright (C) 2003, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -42,6 +42,13 @@
 import java.io.Serializable;
 
 /**
+ * This class provides a mechanism for using an {@link AffineTransform} as
+ * an <i>immutable</i> attribute (for example, in the 
+ * {@link java.text.AttributedString} class).  Any transform passed to 
+ * this class is copied before being stored, and any transform handed out
+ * by this class is a copy of the stored transform.  In this way, it is 
+ * not possible to modify the stored transform.
+ * 
  * @author Michael Koch
  */
 public final class TransformAttribute implements Serializable
@@ -50,20 +57,40 @@
 
   private AffineTransform affineTransform;
   
+  /**
+   * Creates a new attribute that contains a copy of the given transform.
+   * 
+   * @param transform  the transform (<code>null</code> not permitted).
+   * 
+   * @throws IllegalArgumentException if <code>transform</code> is 
+   *         <code>null</code>.
+   */
   public TransformAttribute (AffineTransform transform) 
   {
-    if (transform != null)
+    if (transform == null)
       {
-        this.affineTransform = new AffineTransform (transform);
+        throw new IllegalArgumentException("Null 'transform' not permitted.");
       }
+    this.affineTransform = new AffineTransform (transform);
   }
 
+  /**
+   * Returns a copy of the transform contained by this attribute.
+   * 
+   * @return A copy of the transform.
+   */
   public AffineTransform getTransform ()
   {
-    return affineTransform;
+    return (AffineTransform) affineTransform.clone();
   }
 
   /**
+   * Returns <code>true</code> if the transform contained by this attribute is
+   * an identity transform, and <code>false</code> otherwise.
+   * 
+   * @return <code>true</code> if the transform contained by this attribute is
+   * an identity transform, and <code>false</code> otherwise.
+   * 
    * @since 1.4
    */
   public boolean isIdentity ()



More information about the kaffe mailing list