summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-22 19:07:40 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-22 19:07:40 +0000
commit0081c87563ff74aba8f38e64c77b4bbba15453f7 (patch)
tree78632f35b07ac4cd2c9b28aaaf52fb6f59b19ba1 /libjava
parent26537b78028c2385162b1b8cdee0aea44cdbb6bc (diff)
downloadppe42-gcc-0081c87563ff74aba8f38e64c77b4bbba15453f7.tar.gz
ppe42-gcc-0081c87563ff74aba8f38e64c77b4bbba15453f7.zip
2005-02-22 David Gilbert <david.gilbert@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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95408 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/java/awt/font/TransformAttribute.java37
2 files changed, 40 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index d36ba6f38c5..5c99a783417 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,11 @@
+2005-02-22 David Gilbert <david.gilbert@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-22 Jeroen Frijters <jeroen@frijters.net>
* java/io/Externalizable.java,
diff --git a/libjava/java/awt/font/TransformAttribute.java b/libjava/java/awt/font/TransformAttribute.java
index b2417041961..3bb3c3cf1c3 100644
--- a/libjava/java/awt/font/TransformAttribute.java
+++ b/libjava/java/awt/font/TransformAttribute.java
@@ -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.awt.geom.AffineTransform;
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 @@ public final class TransformAttribute implements Serializable
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 ()
OpenPOWER on IntegriCloud