jdk/src/share/classes/java/awt/BasicStroke.java
author henryjen
Tue, 10 Jun 2014 16:18:54 -0700
changeset 24865 09b1d992ca72
parent 22584 eed64ee05369
permissions -rw-r--r--
8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo Reviewed-by: mduigou, lancea, alanb, mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22584
eed64ee05369 8032733: Fix cast lint warnings in client libraries
darcy
parents: 21957
diff changeset
     2
 * Copyright (c) 1997, 2014, 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
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    30
import java.lang.annotation.Native;
12813
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:
21957
97758de70fbd 8028019: AWT Doclint warning/error cleanup
rriggs
parents: 21278
diff changeset
    42
 * <dl>
2
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>
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 16734
diff changeset
    91
 *      // sets the Graphics2D object's Transform attribute
2
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
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
public class BasicStroke implements Stroke {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Joins path segments by extending their outside edges until
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * they meet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   120
    @Native public final static int JOIN_MITER = 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Joins path segments by rounding off the corner at a radius
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * of half the line width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   126
    @Native public final static int JOIN_ROUND = 1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Joins path segments by connecting the outer corners of their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * wide outlines with a straight segment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   132
    @Native public final static int JOIN_BEVEL = 2;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * Ends unclosed subpaths and dash segments with no added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * decoration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   138
    @Native public final static int CAP_BUTT = 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Ends unclosed subpaths and dash segments with a round
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * decoration that has a radius equal to half of the width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * of the pen.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   145
    @Native public final static int CAP_ROUND = 1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * Ends unclosed subpaths and dash segments with a square
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * projection that extends beyond the end of the segment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * to a distance equal to half of the line width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   152
    @Native public final static int CAP_SQUARE = 2;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    float width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    int join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    int cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    float miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    float dash[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    float dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Constructs a new <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @param width the width of this <code>BasicStroke</code>.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *         width must be greater than or equal to 0.0f.  If width is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *         set to 0.0f, the stroke is rendered as the thinnest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *         possible line for the target device and the antialias
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *         hint setting.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param miterlimit the limit to trim the miter join.  The miterlimit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *        must be greater than or equal to 1.0f.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @param dash the array representing the dashing pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param dash_phase the offset to start the dashing pattern
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @throws IllegalArgumentException if <code>miterlimit</code> is less
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *         than 1 and <code>join</code> is JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * @throws IllegalArgumentException if <code>dash_phase</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *         is negative and <code>dash</code> is not <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @throws IllegalArgumentException if the length of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *         <code>dash</code> is zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @throws IllegalArgumentException if dash lengths are all zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     */
7006
05505fff1342 4358979: javax.swing.border should have a DashedBorder
malenkov
parents: 5506
diff changeset
   190
    @ConstructorProperties({ "lineWidth", "endCap", "lineJoin", "miterLimit", "dashArray", "dashPhase" })
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    public BasicStroke(float width, int cap, int join, float miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                       float dash[], float dash_phase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        if (width < 0.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            throw new IllegalArgumentException("negative width");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if (cap != CAP_BUTT && cap != CAP_ROUND && cap != CAP_SQUARE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            throw new IllegalArgumentException("illegal end cap value");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        if (join == JOIN_MITER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            if (miterlimit < 1.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                throw new IllegalArgumentException("miter limit < 1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        } else if (join != JOIN_ROUND && join != JOIN_BEVEL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            throw new IllegalArgumentException("illegal line join value");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            if (dash_phase < 0.0f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                throw new IllegalArgumentException("negative dash phase");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            boolean allzero = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            for (int i = 0; i < dash.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                float d = dash[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                if (d > 0.0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                    allzero = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                } else if (d < 0.0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                    throw new IllegalArgumentException("negative dash length");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            if (allzero) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                throw new IllegalArgumentException("dash lengths all zero");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        this.width      = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        this.cap        = cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        this.join       = join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        this.miterlimit = miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        if (dash != null) {
22584
eed64ee05369 8032733: Fix cast lint warnings in client libraries
darcy
parents: 21957
diff changeset
   228
            this.dash = dash.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        this.dash_phase = dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @param miterlimit the limit to trim the miter join
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @throws IllegalArgumentException if <code>miterlimit</code> is less
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *         than 1 and <code>join</code> is JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public BasicStroke(float width, int cap, int join, float miterlimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        this(width, cap, join, miterlimit, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * attributes.  The <code>miterlimit</code> parameter is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * unnecessary in cases where the default is allowable or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * line joins are not specified as JOIN_MITER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @param cap the decoration of the ends of a <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @param join the decoration applied where path segments meet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @throws IllegalArgumentException if <code>cap</code> is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *         CAP_BUTT, CAP_ROUND or CAP_SQUARE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @throws IllegalArgumentException if <code>join</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *         either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    public BasicStroke(float width, int cap, int join) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        this(width, cap, join, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Constructs a solid <code>BasicStroke</code> with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * line width and with default values for the cap and join
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @param width the width of the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @throws IllegalArgumentException if <code>width</code> is negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public BasicStroke(float width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Constructs a new <code>BasicStroke</code> with defaults for all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * The default attributes are a solid line of width 1.0, CAP_SQUARE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * JOIN_MITER, a miter limit of 10.0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public BasicStroke() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        this(1.0f, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * Returns a <code>Shape</code> whose interior defines the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * stroked outline of a specified <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @param s the <code>Shape</code> boundary be stroked
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @return the <code>Shape</code> of the stroked outline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public Shape createStrokedShape(Shape s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        sun.java2d.pipe.RenderingEngine re =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            sun.java2d.pipe.RenderingEngine.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        return re.createStrokedShape(s, width, cap, join, miterlimit,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                                     dash, dash_phase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * Returns the line width.  Line width is represented in user space,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * which is the default-coordinate space used by Java 2D.  See the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * <code>Graphics2D</code> class comments for more information on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * the user space coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * @return the line width of this <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @see Graphics2D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    public float getLineWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        return width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * Returns the end cap style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @return the end cap style of this <code>BasicStroke</code> as one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * of the static <code>int</code> values that define possible end cap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public int getEndCap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        return cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * Returns the line join style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * @return the line join style of the <code>BasicStroke</code> as one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * of the static <code>int</code> values that define possible line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * join styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    public int getLineJoin() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        return join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * Returns the limit of miter joins.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * @return the limit of miter joins of the <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    public float getMiterLimit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        return miterlimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * Returns the array representing the lengths of the dash segments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Alternate entries in the array represent the user space lengths
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * of the opaque and transparent segments of the dashes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * As the pen moves along the outline of the <code>Shape</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * to be stroked, the user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * distance that the pen travels is accumulated.  The distance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * value is used to index into the dash array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * The pen is opaque when its current cumulative distance maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * to an even element of the dash array and transparent otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @return the dash array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    public float[] getDashArray() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        if (dash == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
22584
eed64ee05369 8032733: Fix cast lint warnings in client libraries
darcy
parents: 21957
diff changeset
   362
        return dash.clone();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * Returns the current dash phase.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * The dash phase is a distance specified in user coordinates that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * represents an offset into the dashing pattern. In other words, the dash
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * phase defines the point in the dashing pattern that will correspond to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * the beginning of the stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @return the dash phase as a <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    public float getDashPhase() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        return dash_phase;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * Returns the hashcode for this stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @return      a hash code for this stroke.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        int hash = Float.floatToIntBits(width);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        hash = hash * 31 + join;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        hash = hash * 31 + cap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        hash = hash * 31 + Float.floatToIntBits(miterlimit);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            hash = hash * 31 + Float.floatToIntBits(dash_phase);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            for (int i = 0; i < dash.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                hash = hash * 31 + Float.floatToIntBits(dash[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        return hash;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * Returns true if this BasicStroke represents the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * stroking operation as the given argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    * Tests if a specified object is equal to this <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    * by first testing if it is a <code>BasicStroke</code> and then comparing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    * its width, join, cap, miter limit, dash, and dash phase attributes with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    * those of this <code>BasicStroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    * @param  obj the specified object to compare to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    *              <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    * @return <code>true</code> if the width, join, cap, miter limit, dash, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    *            dash phase are the same for both objects;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    *            <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        if (!(obj instanceof BasicStroke)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        BasicStroke bs = (BasicStroke) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        if (width != bs.width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        if (join != bs.join) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        if (cap != bs.cap) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        if (miterlimit != bs.miterlimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        if (dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            if (dash_phase != bs.dash_phase) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            if (!java.util.Arrays.equals(dash, bs.dash)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        else if (bs.dash != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
}