jdk/src/share/classes/java/awt/BasicStroke.java
author erikj
Thu, 07 Jun 2012 18:05:09 -0700
changeset 12813 c10ab96dcf41
parent 7006 05505fff1342
child 16734 da1901d79073
permissions -rw-r--r--
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI Reviewed-by: ohair, ohrstrom, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7006
05505fff1342 4358979: javax.swing.border should have a DashedBorder
malenkov
parents: 5506
diff changeset
     2
 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
7006
05505fff1342 4358979: javax.swing.border should have a DashedBorder
malenkov
parents: 5506
diff changeset
    28
import java.beans.ConstructorProperties;
05505fff1342 4358979: javax.swing.border should have a DashedBorder
malenkov
parents: 5506
diff changeset
    29
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 7006
diff changeset
    30
import javax.tools.annotation.GenerateNativeHeader;
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 7006
diff changeset
    31
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The <code>BasicStroke</code> class defines a basic set of rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * attributes for the outlines of graphics primitives, which are rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * with a {@link Graphics2D} object that has its Stroke attribute set to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * this <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * The rendering attributes defined by <code>BasicStroke</code> describe
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * the shape of the mark made by a pen drawn along the outline of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * {@link Shape} and the decorations applied at the ends and joins of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * path segments of the <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * These rendering attributes include:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <dl compact>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <dt><i>width</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <dd>The pen width, measured perpendicularly to the pen trajectory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <dt><i>end caps</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <dd>The decoration applied to the ends of unclosed subpaths and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * dash segments.  Subpaths that start and end on the same point are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * still considered unclosed if they do not have a CLOSE segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * See {@link java.awt.geom.PathIterator#SEG_CLOSE SEG_CLOSE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * for more information on the CLOSE segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * The three different decorations are: {@link #CAP_BUTT},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * {@link #CAP_ROUND}, and {@link #CAP_SQUARE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <dt><i>line joins</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <dd>The decoration applied at the intersection of two path segments
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * and at the intersection of the endpoints of a subpath that is closed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * using {@link java.awt.geom.PathIterator#SEG_CLOSE SEG_CLOSE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * The three different decorations are: {@link #JOIN_BEVEL},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * {@link #JOIN_MITER}, and {@link #JOIN_ROUND}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <dt><i>miter limit</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * <dd>The limit to trim a line join that has a JOIN_MITER decoration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * A line join is trimmed when the ratio of miter length to stroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * width is greater than the miterlimit value.  The miter length is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * the diagonal length of the miter, which is the distance between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * the inside corner and the outside corner of the intersection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * The smaller the angle formed by two line segments, the longer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * the miter length and the sharper the angle of intersection.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * default miterlimit value of 10.0f causes all angles less than
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * 11 degrees to be trimmed.  Trimming miters converts
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * the decoration of the line join to bevel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <dt><i>dash attributes</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * <dd>The definition of how to make a dash pattern by alternating
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * between opaque and transparent sections.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * All attributes that specify measurements and distances controlling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * the shape of the returned outline are measured in the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * coordinate system as the original unstroked <code>Shape</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * argument.  When a <code>Graphics2D</code> object uses a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <code>Stroke</code> object to redefine a path during the execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * of one of its <code>draw</code> methods, the geometry is supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * in its original form before the <code>Graphics2D</code> transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * attribute is applied.  Therefore, attributes such as the pen width
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * are interpreted in the user space coordinate system of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * <code>Graphics2D</code> object and are subject to the scaling and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * shearing effects of the user-space-to-device-space transform in that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * particular <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * For example, the width of a rendered shape's outline is determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * not only by the width attribute of this <code>BasicStroke</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * but also by the transform attribute of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * <code>Graphics2D</code> object.  Consider this code:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * <blockquote><tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *      // sets the Graphics2D object's Tranform attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *      g2d.scale(10, 10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *      // sets the Graphics2D object's Stroke attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *      g2d.setStroke(new BasicStroke(1.5f));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * </tt></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * Assuming there are no other scaling transforms added to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * <code>Graphics2D</code> object, the resulting line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * will be approximately 15 pixels wide.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * As the example code demonstrates, a floating-point line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * offers better precision, especially when large transforms are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * used with a <code>Graphics2D</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * When a line is diagonal, the exact width depends on how the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * rendering pipeline chooses which pixels to fill as it traces the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * theoretical widened outline.  The choice of which pixels to turn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * on is affected by the antialiasing attribute because the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * antialiasing rendering pipeline can choose to color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * partially-covered pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * For more information on the user space coordinate system and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * rendering process, see the <code>Graphics2D</code> class comments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * @see Graphics2D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * @author Jim Graham
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 */
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 7006
diff changeset
   114
/* No native methods here, but the constants are needed in the supporting JNI code */
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 7006
diff changeset
   115
@GenerateNativeHeader
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
public class BasicStroke implements Stroke {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Joins path segments by extending their outside edges until
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * they meet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public final static int JOIN_MITER = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Joins path segments by rounding off the corner at a radius
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * of half the line width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public final static int JOIN_ROUND = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Joins path segments by connecting the outer corners of their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * wide outlines with a straight segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public final static int JOIN_BEVEL = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * Ends unclosed subpaths and dash segments with no added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * decoration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public final static int CAP_BUTT = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Ends unclosed subpaths and dash segments with a round
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * decoration that has a radius equal to half of the width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * of the pen.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public final static int CAP_ROUND = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * Ends unclosed subpaths and dash segments with a square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * projection that extends beyond the end of the segment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * to a distance equal to half of the line width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    public final static int CAP_SQUARE = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    float width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    int join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    int cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    float miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    float dash[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    float dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * Constructs a new <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param width the width of this <code>BasicStroke</code>.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *         width must be greater than or equal to 0.0f.  If width is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *         set to 0.0f, the stroke is rendered as the thinnest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *         possible line for the target device and the antialias
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *         hint setting.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @param miterlimit the limit to trim the miter join.  The miterlimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *        must be greater than or equal to 1.0f.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param dash the array representing the dashing pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @param dash_phase the offset to start the dashing pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @throws IllegalArgumentException if <code>miterlimit</code> is less
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *         than 1 and <code>join</code> is JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @throws IllegalArgumentException if <code>dash_phase</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *         is negative and <code>dash</code> is not <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @throws IllegalArgumentException if the length of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *         <code>dash</code> is zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @throws IllegalArgumentException if dash lengths are all zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
7006
05505fff1342 4358979: javax.swing.border should have a DashedBorder
malenkov
parents: 5506
diff changeset
   192
    @ConstructorProperties({ "lineWidth", "endCap", "lineJoin", "miterLimit", "dashArray", "dashPhase" })
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public BasicStroke(float width, int cap, int join, float miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                       float dash[], float dash_phase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        if (width < 0.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            throw new IllegalArgumentException("negative width");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        if (cap != CAP_BUTT && cap != CAP_ROUND && cap != CAP_SQUARE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            throw new IllegalArgumentException("illegal end cap value");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if (join == JOIN_MITER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            if (miterlimit < 1.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                throw new IllegalArgumentException("miter limit < 1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        } else if (join != JOIN_ROUND && join != JOIN_BEVEL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            throw new IllegalArgumentException("illegal line join value");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            if (dash_phase < 0.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                throw new IllegalArgumentException("negative dash phase");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            boolean allzero = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            for (int i = 0; i < dash.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                float d = dash[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                if (d > 0.0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                    allzero = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                } else if (d < 0.0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                    throw new IllegalArgumentException("negative dash length");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            if (allzero) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                throw new IllegalArgumentException("dash lengths all zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        this.width      = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        this.cap        = cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        this.join       = join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        this.miterlimit = miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            this.dash = (float []) dash.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        this.dash_phase = dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @param miterlimit the limit to trim the miter join
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @throws IllegalArgumentException if <code>miterlimit</code> is less
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *         than 1 and <code>join</code> is JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    public BasicStroke(float width, int cap, int join, float miterlimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        this(width, cap, join, miterlimit, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * attributes.  The <code>miterlimit</code> parameter is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * unnecessary in cases where the default is allowable or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * line joins are not specified as JOIN_MITER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public BasicStroke(float width, int cap, int join) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        this(width, cap, join, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * line width and with default values for the cap and join
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public BasicStroke(float width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * Constructs a new <code>BasicStroke</code> with defaults for all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * The default attributes are a solid line of width 1.0, CAP_SQUARE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * JOIN_MITER, a miter limit of 10.0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    public BasicStroke() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        this(1.0f, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Returns a <code>Shape</code> whose interior defines the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * stroked outline of a specified <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * @param s the <code>Shape</code> boundary be stroked
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @return the <code>Shape</code> of the stroked outline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    public Shape createStrokedShape(Shape s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        sun.java2d.pipe.RenderingEngine re =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            sun.java2d.pipe.RenderingEngine.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        return re.createStrokedShape(s, width, cap, join, miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                                     dash, dash_phase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * Returns the line width.  Line width is represented in user space,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * which is the default-coordinate space used by Java 2D.  See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * <code>Graphics2D</code> class comments for more information on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * the user space coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return the line width of this <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @see Graphics2D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    public float getLineWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        return width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * Returns the end cap style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @return the end cap style of this <code>BasicStroke</code> as one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * of the static <code>int</code> values that define possible end cap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    public int getEndCap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        return cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * Returns the line join style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * @return the line join style of the <code>BasicStroke</code> as one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * of the static <code>int</code> values that define possible line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * join styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public int getLineJoin() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        return join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * Returns the limit of miter joins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @return the limit of miter joins of the <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    public float getMiterLimit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        return miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Returns the array representing the lengths of the dash segments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * Alternate entries in the array represent the user space lengths
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * of the opaque and transparent segments of the dashes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * As the pen moves along the outline of the <code>Shape</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * to be stroked, the user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * distance that the pen travels is accumulated.  The distance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * value is used to index into the dash array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * The pen is opaque when its current cumulative distance maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * to an even element of the dash array and transparent otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @return the dash array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    public float[] getDashArray() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        if (dash == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        return (float[]) dash.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * Returns the current dash phase.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * The dash phase is a distance specified in user coordinates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * represents an offset into the dashing pattern. In other words, the dash
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * phase defines the point in the dashing pattern that will correspond to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * the beginning of the stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @return the dash phase as a <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    public float getDashPhase() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        return dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * Returns the hashcode for this stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @return      a hash code for this stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        int hash = Float.floatToIntBits(width);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        hash = hash * 31 + join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        hash = hash * 31 + cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        hash = hash * 31 + Float.floatToIntBits(miterlimit);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            hash = hash * 31 + Float.floatToIntBits(dash_phase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
            for (int i = 0; i < dash.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                hash = hash * 31 + Float.floatToIntBits(dash[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        return hash;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * Returns true if this BasicStroke represents the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * stroking operation as the given argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    * Tests if a specified object is equal to this <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    * by first testing if it is a <code>BasicStroke</code> and then comparing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    * its width, join, cap, miter limit, dash, and dash phase attributes with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    * those of this <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    * @param  obj the specified object to compare to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    *              <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    * @return <code>true</code> if the width, join, cap, miter limit, dash, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    *            dash phase are the same for both objects;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    *            <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        if (!(obj instanceof BasicStroke)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        BasicStroke bs = (BasicStroke) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        if (width != bs.width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        if (join != bs.join) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        if (cap != bs.cap) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        if (miterlimit != bs.miterlimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            if (dash_phase != bs.dash_phase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
            if (!java.util.Arrays.equals(dash, bs.dash)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        else if (bs.dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
}