/[classpath]/classpath/java/awt/font/TransformAttribute.java
ViewVC logotype

Diff of /classpath/java/awt/font/TransformAttribute.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mkoch, Mon Feb 17 08:05:50 2003 UTC revision 1.1.2.1 by gnu_andrew, Sat Feb 19 10:50:32 2005 UTC
# Line 1  Line 1 
1  /* TransformAttribute.java  /* TransformAttribute.java --
2     Copyright (C) 2003 Free Software Foundation, Inc.     Copyright (C) 2003, 2005  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 42  import java.awt.geom.AffineTransform; Line 42  import java.awt.geom.AffineTransform;
42  import java.io.Serializable;  import java.io.Serializable;
43    
44  /**  /**
45     * This class provides a mechanism for using an {@link AffineTransform} as
46     * an <i>immutable</i> attribute (for example, in the
47     * {@link java.text.AttributedString} class).  Any transform passed to
48     * this class is copied before being stored, and any transform handed out
49     * by this class is a copy of the stored transform.  In this way, it is
50     * not possible to modify the stored transform.
51     *
52   * @author Michael Koch   * @author Michael Koch
53   */   */
54  public final class TransformAttribute implements Serializable  public final class TransformAttribute implements Serializable
# Line 50  public final class TransformAttribute im Line 57  public final class TransformAttribute im
57    
58    private AffineTransform affineTransform;    private AffineTransform affineTransform;
59        
60      /**
61       * Creates a new attribute that contains a copy of the given transform.
62       *
63       * @param transform  the transform (<code>null</code> not permitted).
64       *
65       * @throws IllegalArgumentException if <code>transform</code> is
66       *         <code>null</code>.
67       */
68    public TransformAttribute (AffineTransform transform)    public TransformAttribute (AffineTransform transform)
69    {    {
70      if (transform != null)      if (transform == null)
71        {        {
72          this.affineTransform = new AffineTransform (transform);          throw new IllegalArgumentException("Null 'transform' not permitted.");
73        }        }
74        this.affineTransform = new AffineTransform (transform);
75    }    }
76    
77      /**
78       * Returns a copy of the transform contained by this attribute.
79       *
80       * @return A copy of the transform.
81       */
82    public AffineTransform getTransform ()    public AffineTransform getTransform ()
83    {    {
84      return affineTransform;      return (AffineTransform) affineTransform.clone();
85    }    }
86    
87    /**    /**
88       * Returns <code>true</code> if the transform contained by this attribute is
89       * an identity transform, and <code>false</code> otherwise.
90       *
91       * @return <code>true</code> if the transform contained by this attribute is
92       * an identity transform, and <code>false</code> otherwise.
93       *
94     * @since 1.4     * @since 1.4
95     */     */
96    public boolean isIdentity ()    public boolean isIdentity ()

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26