CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
com\flagstone\transform\font\DefineFont2.java387
com\flagstone\transform\font\DefineFont3.java383
    public DefineFont3 add(final Kerning anObject) {
        if (anObject == null) {
            throw new IllegalArgumentException();
        }
        kernings.add(anObject);
        return this;
    }

    /**
     * Returns the encoding scheme used for characters rendered in the font,
     * either ASCII, SJIS or UCS2.
     *
     * @return the encoding used for character codes.
     */
    public CharacterFormat getEncoding() {
        CharacterFormat value;
        switch(encoding) {
        case 0:
            value = CharacterFormat.UCS2;
            break;
        case 1:
            value = CharacterFormat.ANSI;
            break;
        case 2:
            value = CharacterFormat.SJIS;
            break;
        default:
            throw new IllegalStateException();
        }
        return value;
    }

    /**
     * Does the font have a small point size. This is used only with a Unicode
     * font encoding.
     *
     * @return a boolean indicating whether the font will be aligned on pixel
     *         boundaries.
     */
    public boolean isSmall() {
        return small;
    }

    /**
     * Sets the font is small. Used only with Unicode fonts.
     *
     * @param aBool
     *            a boolean flag indicating the font will be aligned on pixel
     *            boundaries.
     */
    public void setSmall(final boolean aBool) {
        small = aBool;
    }

    // End Flash 7

    /**
     * Is the font italicised.
     *
     * @return a boolean indicating whether the font is rendered in italics.
     */
    public boolean isItalic() {
        return italic;
    }

    /**
     * Is the font bold.
     *
     * @return a boolean indicating whether the font is rendered in a bold face.
     */
    public boolean isBold() {
        return bold;
    }

    // Flash 6
    /**
     * Returns the language code identifying the type of spoken language for the
     * font.
     *
     * @return the Language used to determine how line-breaks are inserted
     *         into text rendered using the font. Returns NONE if the object was
     *         decoded from a movie contains Flash 5 or less.
     */
    public Language getLanguage() {
        return Language.fromInt(language);
    }

    /**
     * Sets the language code used to determine the position of line-breaks in
     * text rendered using the font.
     *
     * NOTE: The language attribute is ignored if the object is encoded in a
     * Flash 5 movie.
     *
     * @param lang the Language identifying the spoken language for the text
     * rendered using the font.
     */
    public void setLanguage(final Language lang) {
        language = lang.getValue();
    }

    // End Flash 6

    /**
     * Returns the name of the font family.
     *
     * @return the name of the font.
     */
    public String getName() {
        return name;
    }

    /**
     * Returns the list of shapes used to define the outlines of each font
     * glyph.
     *
     * @return a list of Shape objects
     */
    public List<Shape> getShapes() {
        return shapes;
    }

    /**
     * Returns the list of codes used to identify each glyph in the font. The
     * ordinal position of each Integer representing a code identifies a
     * particular glyph in the shapes list.
     *
     * @return a list of Integer objects that contain the character codes for
     *         each glyph in the font.
     */
    public List<Integer> getCodes() {
        return codes;
    }

    /**
     * Returns the ascent for the font in twips.
     *
     * @return the ascent for the font.
     */
    public int getAscent() {
        return ascent;
    }

    /**
     * Returns the descent for the font in twips.
     *
     * @return the descent for the font.
     */
    public int getDescent() {
        return descent;
    }

    /**
     * Returns the leading for the font in twips.
     *
     * @return the leading for the font.
     */
    public int getLeading() {
        return leading;
    }

    /**
     * Returns the list of advances defined for each glyph in the font.
     *
     * @return a list of Integer objects that contain the advance for each
     *         glyph in the font.
     */
    public List<Integer> getAdvances() {
        return advances;
    }

    /**
     * Returns the list of bounding rectangles defined for each glyph in the
     * font.
     *
     * @return a list of Bounds objects.
     */
    public List<Bounds> getBounds() {
        return bounds;
    }

    /**
     * Returns the list of kerning records that define the spacing between
     * glyph pairs.
     *
     * @return a list of Kerning objects that define the spacing adjustment
     *         between pairs of glyphs.
     */
    public List<Kerning> getKernings() {
        return kernings;
    }

    /**
     * Sets the font character encoding.
     *
     * @param anEncoding
     *            the encoding used to identify characters, either ASCII, SJIS
     *            or UNICODE.
     */
    public void setEncoding(final CharacterFormat anEncoding) {
        switch(anEncoding) {
        case UCS2:
            encoding = 0;
            break;
        case ANSI:
            encoding = 1;
            break;
        case SJIS:
            encoding = 2;
            break;
        default:
            throw new IllegalArgumentException();
        }
    }

    /**
     * Set the font is italicised.
     *
     * @param aBool
     *            a boolean flag indicating whether the font will be rendered in
     *            italics
     */
    public void setItalic(final boolean aBool) {
        italic = aBool;
    }

    /**
     * Set the font is bold.
     *
     * @param aBool
     *            a boolean flag indicating whether the font will be rendered in
     *            bold face.
     */
    public void setBold(final boolean aBool) {
        bold = aBool;
    }

    /**
     * Set the name of the font.
     *
     * @param aString
     *            the name assigned to the font, identifying the font family.
     *            Must not be null.
     */
    public void setName(final String aString) {
        if (aString == null) {
            throw new IllegalArgumentException();
        }
        name = aString;
    }

    /**
     * Set the list of shape records that define the outlines of the characters
     * used from the font.
     *
     * @param list
     *            a list of Shape objects that define the glyphs for the font.
     *            Must not be null.
     */
    public void setShapes(final List<Shape> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        shapes = list;
    }

    /**
     * Sets the codes used to identify each glyph in the font.
     *
     * @param list
     *            sets the code table that maps a particular glyph to a
     *            character code. Must not be null.
     */
    public void setCodes(final List<Integer> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        codes = list;
    }

    /**
     * Sets the ascent for the font in twips.
     *
     * @param aNumber
     *            the ascent for the font in the range -32768..32767.
     */
    public void setAscent(final int aNumber) {
        if ((aNumber < Coder.SHORT_MIN)
                || (aNumber > Coder.SHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    Coder.SHORT_MIN, Coder.SHORT_MAX, aNumber);
        }
        ascent = aNumber;
    }

    /**
     * Sets the descent for the font in twips.
     *
     * @param aNumber
     *            the descent for the font in the range -32768..32767.
     */
    public void setDescent(final int aNumber) {
        if ((aNumber < Coder.SHORT_MIN)
                || (aNumber > Coder.SHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    Coder.SHORT_MIN, Coder.SHORT_MAX, aNumber);
        }
        descent = aNumber;
    }

    /**
     * Sets the leading for the font in twips.
     *
     * @param aNumber
     *            the descent for the font in the range -32768..32767.
     */
    public void setLeading(final int aNumber) {
        if ((aNumber < Coder.SHORT_MIN)
                || (aNumber > Coder.SHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    Coder.SHORT_MIN, Coder.SHORT_MAX, aNumber);
        }
        leading = aNumber;
    }

    /**
     * Sets the list of advances for each glyph in the font.
     *
     * @param list
     *            of Integer objects that define the spacing between glyphs.
     *            Must not be null.
     */
    public void setAdvances(final List<Integer> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        advances = list;
    }

    /**
     * Sets the list of bounding rectangles for each glyph in the font.
     *
     * @param list
     *            a list of Bounds objects that define the bounding rectangles
     *            that enclose each glyph in the font. Must not be null.
     */
    public void setBounds(final List<Bounds> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        bounds = list;
    }

    /**
     * Sets the list of kerning records for pairs of glyphs in the font.
     *
     * @param list
     *            a list of Kerning objects that define an adjustment applied
     *            to the spacing between pairs of glyphs. Must not be null.
     */
    public void setKernings(final List<Kerning> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        kernings = list;
    }

    /** {@inheritDoc} */
    public DefineFont3 copy() {
FileLine
com\flagstone\transform\sound\SoundStreamHead.java196
com\flagstone\transform\sound\SoundStreamHead2.java210
    public SoundStreamHead2(final SoundStreamHead2 object) {
        format = object.format;
        playRate = object.playRate;
        playChannels = object.playChannels;
        playSampleSize = object.playSampleSize;
        streamRate = object.streamRate;
        streamChannels = object.streamChannels;
        streamSampleSize = object.streamSampleSize;
        streamSampleCount = object.streamSampleCount;
        latency = object.latency;
    }

    /**
     * Get the compression format used.
     *
     * @return the format for the sound data.
     */
    public SoundFormat getFormat() {
        return SoundFormat.fromInt(format);
    }

    /**
     * Sets the format for the streaming sound.
     *
     * @param encoding
     *            the compression format for the sound data, must be either
     *            NATIVE_PCM, ADPCM, MP3, PCM or NELLYMOSER from SoundFormat.
     */
    public void setFormat(final SoundFormat encoding) {
        format = encoding.getValue();
    }

    /**
     * Returns the recommended playback rate: 5512, 11025, 22050 or 44100 Hz.
     *
     * @return the playback rate in Hertz.
     */
    public int getPlayRate() {
        return playRate;
    }

    /**
     * Get the recommended number of playback channels = 1 = mono 2 =
     * stereo.
     *
     * @return the number of channels.
     */
    public int getPlayChannels() {
        return playChannels;
    }

    /**
     * Get the recommended playback sample range in bytes: 1 or 2.
     *
     * @return the number of bytes in each sample.
     */
    public int getPlaySampleSize() {
        return playSampleSize;
    }

    /**
     * Get the sample rate: 5512, 11025, 22050 or 44100 Hz in the streaming
     * sound.
     *
     * @return the stream rate in Hertz.
     */
    public float getStreamRate() {
        return streamRate;
    }

    /**
     * Get the number of channels, 1 = mono 2 = stereo, in the streaming
     * sound.
     *
     * @return the number of channels defined in the streaming sound.
     */
    public int getStreamChannels() {
        return streamChannels;
    }

    /**
     * Get the sample size in bytes: 1 or 2 in the streaming sound.
     *
     * @return the number of bytes per sample in the streaming sound.
     */
    public int getStreamSampleSize() {
        return streamSampleSize;
    }

    /**
     * Get the average number of samples in each stream block following.
     *
     * @return the number of sample in each stream block.
     */
    public int getStreamSampleCount() {
        return streamSampleCount;
    }

    /**
     * Sets the recommended playback rate in Hz. Must be either: 5512, 11025,
     * 22050 or 44100.
     *
     * @param rate
     *            the recommended rate for playing the sound.
     */
    public void setPlayRate(final int rate) {
        if ((rate != SoundRate.KHZ_5K) && (rate != SoundRate.KHZ_11K)
                && (rate != SoundRate.KHZ_22K) && (rate != SoundRate.KHZ_44K)) {
            throw new IllegalArgumentValueException(
                    new int[] {SoundRate.KHZ_5K, SoundRate.KHZ_11K,
                            SoundRate.KHZ_22K, SoundRate.KHZ_44K}, rate);
        }
        playRate = rate;
    }

    /**
     * Sets the recommended number of playback channels = 1 = mono 2 = stereo.
     *
     * @param channels
     *            the recommended number of playback channels.
     */
    public void setPlayChannels(final int channels) {
        if ((channels < 1) || (channels > 2)) {
            throw new IllegalArgumentRangeException(1, 2, channels);
        }
        playChannels = channels;
    }

    /**
     * Sets the recommended playback sample size in bytes. Must be wither 1 or
     * 2.
     *
     * @param playSize
     *            the recommended sample size for playing the sound.
     */
    public void setPlaySampleSize(final int playSize) {
        if ((playSize < 1) || (playSize > 2)) {
            throw new IllegalArgumentRangeException(1, 2, playSize);
        }
        playSampleSize = playSize;
    }

    /**
     * Sets the sample rate in Hz for the streaming sound. Must be either: 5512,
     * 11025, 22050 or 44100.
     *
     * @param rate
     *            the rate at which the streaming sound was sampled.
     */
    public void setStreamRate(final int rate) {
        if ((rate != SoundRate.KHZ_5K) && (rate != SoundRate.KHZ_11K)
                && (rate != SoundRate.KHZ_22K) && (rate != SoundRate.KHZ_44K)) {
            throw new IllegalArgumentValueException(
                    new int[] {SoundRate.KHZ_5K, SoundRate.KHZ_11K,
                            SoundRate.KHZ_22K, SoundRate.KHZ_44K}, rate);
        }
        streamRate = rate;
    }

    /**
     * Sets the number of channels in the streaming sound: 1 = mono 2 = stereo.
     *
     * @param channels
     *            the number of channels in the streaming sound.
     */
    public void setStreamChannels(final int channels) {
        if ((channels < 1) || (channels > 2)) {
            throw new IllegalArgumentRangeException(1, 2, channels);
        }
        streamChannels = channels;
    }

    /**
     * Sets the sample size in bytes for the streaming sound. Must be 1 or 2.
     *
     * @param size
     *            the sample size for the sound.
     */
    public void setStreamSampleSize(final int size) {
        if ((size < 1) || (size > 2)) {
            throw new IllegalArgumentRangeException(1, 2, size);
        }
        streamSampleSize = size;
    }

    /**
     * Sets the number of samples in each stream block.
     *
     * @param count
     *            the number of samples in each subsequent SoundStreamBlock
     *            object.
     */
    public void setStreamSampleCount(final int count) {
        if (count < 0) {
            throw new IllegalArgumentRangeException(0,
                    Integer.MAX_VALUE, count);
        }
        streamSampleCount = count;
    }

    /**
     * For MP3 encoded sounds, returns the number of samples to skip when
     * starting to play a sound.
     *
     * @return the number of samples skipped in an MP3 encoded sound Returns 0
     *         for other sound formats.
     */
    public int getLatency() {
        return latency;
    }

    /**
     * Set the number of samples to skip when starting to play an MP3 encoded
     * sound.
     *
     * @param delay
     *            the number of samples to be skipped in an MP3 encoded sound
     *            should be 0 for other sound formats.
     */
    public void setLatency(final int delay) {
        latency = delay;
    }

    /** {@inheritDoc} */
    public SoundStreamHead2 copy() {
FileLine
com\flagstone\transform\linestyle\LineStyle2.java257
com\flagstone\transform\linestyle\MorphLineStyle2.java324
        endColor = aColor;
    }

    /**
     * Get the CapStyle used for the start of the line.
     * @return the CapStyle that specifies how the start of the line is drawn.
     */
    public CapStyle getStartCap() {
        CapStyle style;
        if (startCap == 1) {
            style = CapStyle.NONE;
        } else if (startCap == 2) {
            style = CapStyle.SQUARE;
        } else {
            style = CapStyle.ROUND;
        }
        return style;
    }

    /**
     * Set the CapStyle used for the start of the line.
     * @param style the CapStyle that specifies how the start of the line
     * is drawn.
     */

    public void setStartCap(final CapStyle style) {
        switch (style) {
        case NONE:
            startCap = 1;
            break;
        case SQUARE:
            startCap = 2;
            break;
        default:
            startCap = 0;
            break;
        }
    }

    /**
     * Get the CapStyle used for the end of the line.
     * @return the CapStyle that specifies how the end of the line is drawn.
     */
    public CapStyle getEndCap() {
        CapStyle style;
        if (endCap == 1) {
            style = CapStyle.NONE;
        } else if (endCap == 2) {
            style = CapStyle.SQUARE;
        } else {
            style = CapStyle.ROUND;
        }
        return style;
    }

    /**
     * Set the CapStyle used for the end of the line.
     * @param style the CapStyle that specifies how the end of the line
     * is drawn.
     */
    public void setEndCap(final CapStyle style) {
        switch (style) {
        case NONE:
            endCap = 1;
            break;
        case SQUARE:
            endCap = 2;
            break;
        default:
            endCap = 0;
            break;
        }
    }

    /**
     * Get the JoinStyle used when joining with another line or curve.
     * @return the JoinStyle used to connect with another line or curve.
     */
    public JoinStyle getJoinStyle() {
        JoinStyle style;
        if (endCap == 1) {
            style = JoinStyle.BEVEL;
        } else if (endCap == 2) {
            style = JoinStyle.MITER;
        } else {
            style = JoinStyle.ROUND;
        }
        return style;
    }

    /**
     * Set the JoinStyle used when joining with another line or curve.
     * @param style the JoinStyle used to connect with another line or curve.
     */
    public void setJoinStyle(final JoinStyle style) {
        switch (style) {
        case BEVEL:
            joinStyle = 1;
            break;
        case MITER:
            joinStyle = 2;
            break;
        default:
            joinStyle = 0;
            break;
        }
    }

    /**
     * Is the stroke scaled horizontally if the shape is redrawn.
     * @return true if the stroke is scaled horizontally, false if the stroke
     * thickness does not change.
     */
    public boolean isHorizontal() {
        return horizontal;
    }

    /**
     * Indicates whether the stroke is scaled horizontally if the shape is
     * redrawn.
     * @param scale true if the stroke is scaled horizontally, false if the
     * stroke thickness does not change.
     */
    public void setHorizontal(final boolean scale) {
        horizontal = scale;
    }

    /**
     * Is the stroke scaled vertically if the shape is redrawn.
     * @return true if the stroke is scaled vertically, false if the stroke
     * thickness does not change.
     */
    public boolean isVertical() {
        return vertical;
    }

    /**
     * Indicates whether the stroke is scaled vertically if the shape is
     * redrawn.
     * @param scale true if the stroke is scaled vertically, false if the
     * stroke thickness does not change.
     */
    public void setVertical(final boolean scale) {
        vertical = scale;
    }

    /**
     * Are the end points of the line aligned to pixel boundaries.
     * @return true if the end points are aligned to full pixels, false
     * otherwise.
     */
    public boolean isPixelAligned() {
        return pixelAligned;
    }

    /**
     * Indicates whether the end points of the line aligned to pixel boundaries.
     * @param align true if the end points are aligned to full pixels, false
     * otherwise.
     */
    public void setPixelAligned(final boolean align) {
        pixelAligned = align;
    }

    /**
     * Is the path closed if the end point matches the starting point. If true
     * then the line will be joined, otherwise an end cap is drawn.
     * @return true if the line will be closed, false if the path remains open.
     */
    public boolean isLineClosed() {
        return lineClosed;
    }

    /**
     * Indicates whether the path closed if the end point matches the starting
     * point. If true then the line will be joined, otherwise an end cap is
     * drawn.
     * @param close true if the line will be closed, false if the path remains
     * open.
     */
    public void setLineClosed(final boolean close) {
        lineClosed = close;
    }

    /**
     * Get the limit for drawing miter joins.
     * @return the value controlling how miter joins are drawn.
     */
    public int getMiterLimit() {
        return miterLimit;
    }

    /**
     * Set the limit for drawing miter joins.
     * @param limit the value controlling how miter joins are drawn.
     */
    public void setMiterLimit(final int limit) {
        if ((limit < 0) || (limit > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    0, Coder.USHORT_MAX, limit);
        }
        miterLimit = limit;
    }

    /**
     * Get the FillStyle used for the line stroke.
     * @return the FillStyle used to draw the line.
     */
    public FillStyle getFillStyle() {
        return fillStyle;
    }

    /**
     * Set the FillStyle (morphing fill styles only) used for the line stroke.
     * @param style the FillStyle used to draw the line.
     */
    public void setFillStyle(final FillStyle style) {
        fillStyle = style;
    }

    /** {@inheritDoc} */
    public MorphLineStyle2 copy() {
FileLine
com\flagstone\transform\font\DefineFont2.java756
com\flagstone\transform\font\DefineFont3.java752
        return new DefineFont3(this);
    }

    @Override
    public String toString() {
        return String.format(FORMAT, identifier, encoding, small, italic, bold,
                language, name, shapes, codes, ascent, descent, leading,
                advances, bounds, kernings);
    }

    /** {@inheritDoc} */
    @SuppressWarnings("PMD.NPathComplexity")
    public int prepareToEncode(final Context context) {
        // CHECKSTYLE:OFF
        wideCodes = (context.get(Context.VERSION) > 5)
                || encoding != 1;

        context.put(Context.FILL_SIZE, 1);
        context.put(Context.LINE_SIZE, context.contains(Context.POSTSCRIPT) ? 1
                : 0);
        if (wideCodes) {
            context.put(Context.WIDE_CODES, 1);
        }

        final int count = shapes.size();
        int index = 0;
        int tableEntry;
        int shapeLength;

        if (wideOffsets) {
            tableEntry = (count << 2) + 4;
        } else {
            tableEntry = (count << 1) + 2;
        }

        table = new int[count + 1];

        int glyphLength = 0;

        for (final Shape shape : shapes) {
            table[index++] = tableEntry;
            shapeLength = shape.prepareToEncode(context);
            glyphLength += shapeLength;
            tableEntry += shapeLength;
        }

        table[index++] = tableEntry;

        wideOffsets = (shapes.size() * 2 + glyphLength)
                > Coder.USHORT_MAX;

        length = 5;
        length += context.strlen(name);
        length += 2;
        length += shapes.size() * (wideOffsets ? 4 : 2);
        length += wideOffsets ? 4 : 2;
        length += glyphLength;
        length += shapes.size() * (wideCodes ? 2 : 1);

        if (containsLayoutInfo()) {
            length += 6;
            length += advances.size() * 2;

            for (final Bounds bound : bounds) {
                length += bound.prepareToEncode(context);
            }

            length += 2;
            length += kernings.size() * (wideCodes ? 6 : 4);
        }

        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
        context.remove(Context.WIDE_CODES);

        return (length > Coder.HEADER_LIMIT ? Coder.LONG_HEADER
                : Coder.SHORT_HEADER) + length;
        // CHECKSTYLE:ON
    }

    /** {@inheritDoc} */
    @SuppressWarnings("PMD.NPathComplexity")
FileLine
com\flagstone\transform\filter\GradientBevelFilter.java231
com\flagstone\transform\filter\GradientGlowFilter.java231
    public GradientGlowFilter(final SWFDecoder coder, final Context context)
            throws IOException {
        final int count = coder.readByte();
        final Color[] colors = new Color[count];
        final int[] ratioes = new int[count];

        for (int i = 0; i < count; i++) {
            colors[i] = new Color(coder, context);
        }
        for (int i = 0; i < count; i++) {
            ratioes[i] = coder.readByte();
        }

        gradients = new ArrayList<Gradient>(count);
        for (int i = 0; i < count; i++) {
            gradients.add(new Gradient(ratioes[i], colors[i]));
        }

        blurX = coder.readInt();
        blurY = coder.readInt();
        angle = coder.readInt();
        distance = coder.readInt();
        strength = coder.readSignedShort();

        final int value = coder.readByte();

        passes = value & Coder.NIB0;
        mode = value & MODE_MASK;
    }

    /**
     * Get the list of gradients used to create the glow colour.
     * @return the list of Gradient objects.
     */
    public List<Gradient> getGradients() {
        return gradients;
    }

    /**
     * Get the blur amount in the x-direction.
     * @return the horizontal blur amount.
     */
    public float getBlurX() {
        return blurX / Coder.SCALE_16;
    }

    /**
     * Get the blur amount in the y-direction.
     * @return the vertical blur amount.
     */
    public float getBlurY() {
        return blurY / Coder.SCALE_16;
    }

    /**
     * Get the angle of the glow.
     * @return the angle of the glow in radians.
     */
    public float getAngle() {
        return angle / Coder.SCALE_16;
    }

    /**
     * Get the distance of the glow from the object.
     * @return the width of the glow.
     */
    public float getDistance() {
        return distance / Coder.SCALE_16;
    }

    /**
     * Get the strength of the glow.
     * @return the glow strength.
     */
    public float getStrength() {
        return strength / Coder.SCALE_8;
    }

    /**
     * Get the compositing mode.
     * @return the mode used for compositing, either TOP, INNER or KNOCKOUT.
     */
    public FilterMode getMode() {
        FilterMode value;
        switch (mode) {
        case Coder.BIT4:
            value = FilterMode.TOP;
            break;
        case Coder.BIT6:
            value = FilterMode.KNOCKOUT;
            break;
        case Coder.BIT7:
            value = FilterMode.INNER;
            break;
        default:
            throw new IllegalStateException();
        }
        return value;
    }

    /**
     * Get the number of passes for generating the blur.
     * @return the number of blur passes.
     */
    public int getPasses() {
        return passes;
    }

    @Override
    public String toString() {
        return String.format(FORMAT, gradients.toString(),
                getBlurX(), getBlurY(),
                getAngle(), getDistance(), getStrength(), mode, passes);
    }

    @Override
    public boolean equals(final Object object) {
        boolean result;
FileLine
com\flagstone\transform\shape\ShapeStyle.java560
com\flagstone\transform\shape\ShapeStyle2.java528
            }

            numberOfStyleBits += 8;

            context.put(Context.FILL_SIZE, numberOfFillBits);
            context.put(Context.LINE_SIZE, numberOfLineBits);
            context.put(Context.SHAPE_SIZE, context.get(Context.SHAPE_SIZE)
                    + numberOfStyleBits);

            numberOfBits += numberOfStyleBits;
        }
        return numberOfBits;
        // CHECKSTYLE:ON
    }

    /** {@inheritDoc} */
    @SuppressWarnings({"PMD.NPathComplexity", "PMD.CyclomaticComplexity" })
    public void encode(final SWFEncoder coder, final Context context)
            throws IOException {
        coder.writeBits(0, 1);
        coder.writeBits(hasStyles ? 1 : 0, 1);
        coder.writeBits(hasLine ? 1 : 0, 1);
        coder.writeBits(hasAlt ? 1 : 0, 1);
        coder.writeBits(hasFill ? 1 : 0, 1);
        coder.writeBits(hasMove ? 1 : 0, 1);

        if (hasMove) {
            final int fieldSize = Math.max(Coder.size(moveX), Coder
                    .size(moveY));
            // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
            coder.writeBits(fieldSize, 5);
            coder.writeBits(moveX, fieldSize);
            coder.writeBits(moveY, fieldSize);
        }

        if (hasFill) {
            coder.writeBits(fillStyle, context.get(Context.FILL_SIZE));
        }

        if (hasAlt) {
            coder.writeBits(altFillStyle, context.get(Context.FILL_SIZE));
        }

        if (hasLine) {
            coder.writeBits(lineStyle, context.get(Context.LINE_SIZE));
        }

        if (hasStyles) {
            final boolean countExtended = context
                    .contains(Context.ARRAY_EXTENDED);

            coder.alignToByte();

            if (countExtended && (fillStyles.size() >= EXTENDED)) {
                coder.writeByte(EXTENDED);
                coder.writeShort(fillStyles.size());
            } else {
                coder.writeByte(fillStyles.size());
            }

            for (final FillStyle style : fillStyles) {
                style.encode(coder, context);
            }

            if (countExtended && (lineStyles.size() >= EXTENDED)) {
                coder.writeByte(EXTENDED);
                coder.writeShort(lineStyles.size());
            } else {
                coder.writeByte(lineStyles.size());
            }

            for (final LineStyle2 style : lineStyles) {
FileLine
com\flagstone\transform\font\DefineFont2.java135
com\flagstone\transform\font\DefineFont3.java123
     public DefineFont3(final SWFDecoder coder, final Context context)
            throws IOException {
        length = coder.readUnsignedShort() & Coder.LENGTH_FIELD;
        if (length == Coder.IS_EXTENDED) {
            length = coder.readInt();
        }
        coder.mark();
        identifier = coder.readUnsignedShort();
        shapes = new ArrayList<Shape>();
        codes = new ArrayList<Integer>();
        advances = new ArrayList<Integer>();
        bounds = new ArrayList<Bounds>();
        kernings = new ArrayList<Kerning>();

        final int bits = coder.readByte();
        final boolean containsLayout = (bits & Coder.BIT7) != 0;
        final int format = (bits >> Coder.TO_LOWER_NIB) & Coder.LOWEST3;

        encoding = 0;

        if (format == 1) {
            encoding = 1;
        } else if (format == 2) {
            small = true;
            // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
        } else if (format == 4) {
            encoding = 2;
        }

        wideOffsets = (bits & Coder.BIT3) != 0;
        wideCodes = (bits & Coder.BIT2) != 0;
        italic = (bits & Coder.BIT1) != 0;
        bold = (bits & Coder.BIT0) != 0;

        if (wideCodes) {
            context.put(Context.WIDE_CODES, 1);
        }

        language = coder.readByte();
        final int nameLength = coder.readByte();
        name = coder.readString(nameLength);

        if (name.length() > 0) {
            while (name.charAt(name.length() - 1) == 0) {
                name = name.substring(0, name.length() - 1);
            }
        }

        final int glyphCount = coder.readUnsignedShort();
        final int[] offset = new int[glyphCount + 1];

        if (wideOffsets) {
            for (int i = 0; i < glyphCount; i++) {
                offset[i] = coder.readInt();
            }
        } else {
            for (int i = 0; i < glyphCount; i++) {
                offset[i] = coder.readUnsignedShort();
            }
        }

        // A device font may omit the offset to the start of the glyphs
        // when no layout information is included.

        if (coder.bytesRead() < length) {
FileLine
com\flagstone\transform\shape\ShapeStyle.java492
com\flagstone\transform\shape\ShapeStyle2.java458
        return new ShapeStyle2(this);
    }

    @Override
    public String toString() {
        return String.format(FORMAT, moveX, moveY, fillStyle, altFillStyle,
                lineStyle, fillStyles, lineStyles);
    }

    /** {@inheritDoc} */
    @SuppressWarnings({"PMD.NPathComplexity", "PMD.CyclomaticComplexity" })
    public int prepareToEncode(final Context context) {
        // CHECKSTYLE:OFF
        hasLine = lineStyle != null;
        hasFill = fillStyle != null;
        hasAlt = altFillStyle != null;
        hasMove = (moveX != null) && (moveY != null);
        hasStyles = !lineStyles.isEmpty() || !fillStyles.isEmpty();

        int numberOfBits = 6;

        if (hasMove) {
            final int fieldSize = Math.max(Coder.size(moveX), Coder
                    .size(moveY));
            numberOfBits += 5 + fieldSize * 2;
        }

        numberOfBits += hasFill ? context.get(Context.FILL_SIZE) : 0;
        numberOfBits += hasAlt ? context.get(Context.FILL_SIZE) : 0;
        numberOfBits += (hasLine) ? context.get(Context.LINE_SIZE) : 0;

        context.put(Context.SHAPE_SIZE, context.get(Context.SHAPE_SIZE)
                + numberOfBits);

        if (hasStyles) {
            int numberOfFillBits = Coder.unsignedSize(fillStyles.size());
            int numberOfLineBits = Coder.unsignedSize(lineStyles.size());

            if ((numberOfFillBits == 0)
                    && context.contains(Context.POSTSCRIPT)) {
                numberOfFillBits = 1;
            }

            if ((numberOfLineBits == 0)
                    && context.contains(Context.POSTSCRIPT)) {
                numberOfLineBits = 1;
            }

            final boolean countExtended = context
                    .contains(Context.ARRAY_EXTENDED);

            int numberOfStyleBits = 0;
            final int flushBits = context.get(Context.SHAPE_SIZE);

            numberOfStyleBits += (flushBits % 8 > 0)
            ? 8 - (flushBits % 8) : 0;
            numberOfStyleBits += (countExtended
                    && (fillStyles.size() >= EXTENDED)) ? 24
                    : 8;

            for (final FillStyle style : fillStyles) {
                numberOfStyleBits += style.prepareToEncode(context) * 8;
FileLine
com\flagstone\transform\font\DefineFont2.java885
com\flagstone\transform\font\DefineFont3.java876
        coder.writeByte(language);
        coder.writeByte(context.strlen(name));

        coder.writeString(name);
        coder.writeShort(shapes.size());

        if (wideOffsets) {
            for (int i = 0; i < table.length; i++) {
                coder.writeInt(table[i]);
            }
        } else {
            for (int i = 0; i < table.length; i++) {
                coder.writeShort(table[i]);
            }
        }

        for (final Shape shape : shapes) {
            shape.encode(coder, context);
        }

        if (wideCodes) {
            for (final Integer code : codes) {
                coder.writeShort(code.intValue());
            }
        } else {
            for (final Integer code : codes) {
                coder.writeByte(code.intValue());
            }
        }

        if (containsLayoutInfo()) {
            coder.writeShort(ascent);
            coder.writeShort(descent);
            coder.writeShort(leading);

            for (final Integer advance : advances) {
                coder.writeShort(advance.intValue());
            }

            for (final Bounds bound : bounds) {
                bound.encode(coder, context);
            }

            coder.writeShort(kernings.size());

            for (final Kerning kerning : kernings) {
                kerning.encode(coder, context);
            }
        }

        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
        context.remove(Context.WIDE_CODES);
        if (Constants.DEBUG) {
            coder.check(length);
            coder.unmark();
        }
    }

    /**
     * Does the font contain layout information for the glyphs.
     * @return true if the font contains layout information, false otherwise.
     */
    private boolean containsLayoutInfo() {
        final boolean layout = (ascent != 0) || (descent != 0)
                || (leading != 0) || !advances.isEmpty() || !bounds.isEmpty()
                || !kernings.isEmpty();

        return layout;
    }
}
FileLine
com\flagstone\transform\coder\BigDecoder.java265
com\flagstone\transform\coder\LittleDecoder.java259
    }

    /**
     * Read a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if there is an error reading data from the
     * underlying stream.
     */
    public int readBits(final int numberOfBits, final boolean signed)
            throws IOException {
        int pointer = (index << BYTES_TO_BITS) + offset;

        if (((size << BYTES_TO_BITS) - pointer) < numberOfBits) {
            fill();
            pointer = (index << BYTES_TO_BITS) + offset;
        }

        int value = 0;

        if (numberOfBits > 0) {

            if (pointer + numberOfBits > (size << BYTES_TO_BITS)) {
                throw new ArrayIndexOutOfBoundsException();
            }

            for (int i = BITS_PER_INT; (i > 0)
                    && (index < buffer.length); i -= BITS_PER_BYTE) {
                value |= (buffer[index++] & BYTE_MASK) << (i - BITS_PER_BYTE);
            }

            value <<= offset;

            if (signed) {
                value >>= BITS_PER_INT - numberOfBits;
            } else {
                value >>>= BITS_PER_INT - numberOfBits;
            }

            pointer += numberOfBits;
            index = pointer >>> BITS_TO_BYTES;
            offset = pointer & Coder.LOWEST3;
        }

        return value;
    }

    /**
     * Read an unsigned byte.
     *
     * @return an 8-bit unsigned value.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readByte() throws IOException {
        if (size - index < 1) {
            fill();
        }
        if (index + 1 > size) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return buffer[index++] & BYTE_MASK;
    }

    /**
     * Reads an array of bytes.
     *
     * @param bytes
     *            the array that will contain the bytes read.
     *
     * @return the array of bytes.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public byte[] readBytes(final byte[] bytes) throws IOException {
        final int wanted = bytes.length;
        int dest = 0;
        int read = 0;

        int available;
        int remaining;

        while (read < wanted) {
            available = size - index;
            remaining = wanted - read;
            if (available > remaining) {
                available = remaining;
            }
            System.arraycopy(buffer, index, bytes, dest, available);
            read += available;
            index += available;
            dest += available;

            if (index == size) {
FileLine
com\flagstone\transform\filter\GradientBevelFilter.java50
com\flagstone\transform\filter\GradientGlowFilter.java50
public final class GradientGlowFilter implements Filter {

    /**
     * Builder for creating GradientGlowFilter objects.
     */
    public static final class Builder {
        /** The list of gradients for the colour. */
        private final transient List<Gradient>gradients;
        /** The horizontal blur amount. */
        private transient int blurX;
        /** The vertical blur amount. */
        private transient int blurY;
        /** Angle of gradient glow in radians. */
        private transient int angle;
        /** The distance of the gradient glow. */
        private transient int distance;
        /** The strength of the gradient glow. */
        private transient int strength;
        /** Compositing mode. */
        private transient int mode;
        /** The number of blur passes. */
        private transient int passes;

        /**
         * Creates a new Builder.
         */
        public Builder() {
            gradients = new ArrayList<Gradient>();
        }

        /**
         * Add a Gradient to the list.
         * @param gradient a Gradient object.
         * @return this Builder.
         */
        public Builder addGradient(final Gradient gradient) {
            gradients.add(gradient);
            return this;
        }

        /**
         * Set the blur amounts.
         * @param xAmount the horizontal blur amount.
         * @param yAmount the vertical blur amount.
         * @return this Builder.
         */
        public Builder setBlur(final float xAmount, final float yAmount) {
            blurX = (int) (xAmount * Coder.SCALE_16);
            blurY = (int) (yAmount * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the compositing mode for the shadow.
         * @param filterMode the compositing mode, either INNER, KNOCKOUT or
         * TOP.
         * @return this Builder.
         */
        public Builder setMode(final FilterMode filterMode) {
            switch (filterMode) {
            case TOP:
                 mode = Coder.BIT4;
                break;
            case KNOCKOUT:
                mode = Coder.BIT6;
                break;
            case INNER:
                mode = Coder.BIT7;
                break;
            default:
                throw new IllegalArgumentException();
            }
            return this;
        }

        /**
         * Set the glow angle in radians.
         * @param radians the angle.
         * @return this Builder.
         */
        public Builder setAngle(final float radians) {
            angle = (int) (radians * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the distance of the glow from the object.
         * @param width the width of the glow.
         * @return this Builder.
         */
        public Builder setDistance(final float width) {
            distance = (int) (width * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the glow strength.
         * @param weight the weight of the glow.
         * @return this Builder.
         */
        public Builder setStrength(final float weight) {
            strength = (int) (weight * Coder.SCALE_8);
            return this;
        }

        /**
         * Set the number of passes for creating the blur.
         * @param count the number of blur passes.
         * @return this Builder.
         */
        public Builder setPasses(final int count) {
            passes = count;
            return this;
        }

        /**
         * Create a GradientGlowFilter object using the parameters defined in
         * the Builder.
         * @return a GradientGlowFilter object.
         */
        public GradientGlowFilter build() {
FileLine
com\flagstone\transform\image\DefineImage.java244
com\flagstone\transform\image\DefineImage2.java210
    public DefineImage2(final DefineImage2 object) {
        identifier = object.identifier;
        width = object.width;
        height = object.height;
        pixelSize = object.pixelSize;
        tableSize = object.tableSize;
        image = object.image;
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Get the width of the image in pixels (not twips).
     *
     * @return the width of the image.
     */
    public int getWidth() {
        return width;
    }

    /**
     * Get the height of the image in pixels (not twips).
     *
     * @return the height of the image.
     */
    public int getHeight() {
        return height;
    }

    /**
     * Get the number of bits used to represent each pixel. Either 8 or 32
     * bits. The pixel size is 8-bits for colour-mapped images and 32 bits for
     * images where the colour is specified directly.
     *
     * @return the number of bits for each pixel.
     */
    public int getPixelSize() {
        return pixelSize;
    }

    /**
     * Get the number of entries in the colour table encoded the compressed
     * image. For images where the colour is specified directly in the image
     * then the table size is zero.
     *
     * @return the number of entries in the colour table.
     */
    public int getTableSize() {
        return tableSize;
    }

    /**
     * Get a copy of the compressed colour table and image.
     *
     * @return  a copy of the data.
     */
    public byte[] getImage() {
        return Arrays.copyOf(image, image.length);
    }

    /**
     * Sets the width of the image in pixels.
     *
     * @param aNumber
     *            the width of the image. Must be in the range of 0..65535.
     */
    public void setWidth(final int aNumber) {
        if ((aNumber < 0) || (aNumber > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    0, Coder.USHORT_MAX, aNumber);
        }
        width = aNumber;
    }

    /**
     * Sets the height of the image in pixels.
     *
     * @param aNumber
     *            the height of the image. Must be in the range of 0..65535.
     */
    public void setHeight(final int aNumber) {
        if ((aNumber < 0) || (aNumber > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    0, Coder.USHORT_MAX, aNumber);
        }
        height = aNumber;
    }

    /**
     * Sets the size of the pixel in bits: 8 for colour-mapped images, 32 for
     * direct images.
     *
     * @param size
     *            the size of each pixel in bits: must be either 8 or 32.
     */
    public void setPixelSize(final int size) {
        if ((size != IDX_SIZE) && (size != RGBA_SIZE)) {
FileLine
com\flagstone\transform\sound\SoundStreamHead.java457
com\flagstone\transform\sound\SoundStreamHead2.java473
        bits |= writeRate(playRate);
        bits |= (playSampleSize - 1) << 1;
        bits |= playChannels - 1;
        coder.writeByte(bits);

        bits = format << Coder.TO_UPPER_NIB;
        bits |= writeRate(streamRate);
        bits |= (streamSampleSize - 1) << 1;
        bits |= streamChannels - 1;
        coder.writeByte(bits);
        coder.writeShort(streamSampleCount);

        if ((format == 2) && (latency > 0)) {
            coder.writeShort(latency);
        }
        if (Constants.DEBUG) {
            coder.check(length);
            coder.unmark();
        }
    }

    /**
     * Convert the code representing the rate into actual KHz.
     * @param value the code representing the sound rate.
     * @return the actual rate in KHz.
     */
    private int readRate(final int value) {
        final int rate;
        switch (value) {
        case 0:
            rate = SoundRate.KHZ_5K;
            break;
        case Coder.BIT2:
            rate = SoundRate.KHZ_11K;
            break;
        case Coder.BIT3:
            rate = SoundRate.KHZ_22K;
            break;
        case Coder.BIT2 | Coder.BIT3:
            rate = SoundRate.KHZ_44K;
            break;
        default:
            rate = 0;
            break;
        }
        return rate;
    }

    /**
     * Convert the rate in KHz to the code that represents the rate.
     * @param rate the rate in KHz.
     * @return the code representing the sound rate.
     */
    private int writeRate(final int rate) {
        int value;
        switch (rate) {
        case SoundRate.KHZ_11K:
            value = Coder.BIT2;
            break;
        case SoundRate.KHZ_22K:
            value = Coder.BIT3;
            break;
        case SoundRate.KHZ_44K:
            value = Coder.BIT2 | Coder.BIT3;
            break;
        default:
            value = 0;
            break;
        }
        return value;
    }
}
FileLine
com\flagstone\transform\util\font\TTFDecoder.java931
com\flagstone\transform\util\font\TTFDecoder.java1115
            }

            final Canvas path = new Canvas();

            boolean contourStart = true;
            boolean offPoint = false;

            int contour = 0;

            int xCoord = 0;
            int yCoord = 0;

            int prevX = 0;
            int prevY = 0;

            int initX = 0;
            int initY = 0;

            for (int i = 0; i < numberOfPoints; i++) {
                xCoord = xCoordinates[i] / scale;
                yCoord = yCoordinates[i] / scale;

                if (onCurve[i]) {
                    if (contourStart) {
                        path.moveForFont(xCoord, -yCoord);
                        contourStart = false;
                        initX = xCoord;
                        initY = yCoord;
                    } else if (offPoint) {
                        path.curve(prevX, -prevY, xCoord, -yCoord);
                        offPoint = false;
                    } else {
                        path.line(xCoord, -yCoord);
                    }
                } else {
                    if (offPoint) {
                        path.curve(prevX, -prevY, (xCoord + prevX) / 2,
                                -(yCoord + prevY) / 2);
                    }

                    prevX = xCoord;
                    prevY = yCoord;
                    offPoint = true;
                }

                if (i == endPtsOfContours[contour]) {
                    if (offPoint) {
                        path.curve(xCoord, -yCoord, initX, -initY);
                    } else {
                        path.close();
                    }
                    contourStart = true;
                    offPoint = false;
                    prevX = 0;
                    prevY = 0;
                    contour++;
                }
            }
FileLine
com\flagstone\transform\shape\DefineMorphShape.java574
com\flagstone\transform\shape\DefineMorphShape2.java627
        coder.writeByte(scaling ? 1 : 2);
        coder.writeInt(offset);

        if (fillStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(fillStyles.size());
        } else {
            coder.writeByte(fillStyles.size());
        }

        for (final FillStyle style : fillStyles) {
            style.encode(coder, context);
        }

        if (lineStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(lineStyles.size());
        } else {
            coder.writeByte(lineStyles.size());
        }

        for (final LineStyle style : lineStyles) {
            style.encode(coder, context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        shape.encode(coder, context);

        // Number of Fill and Line bits is zero for end shape.

        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);

        endShape.encode(coder, context);

        context.remove(Context.ARRAY_EXTENDED);
        context.remove(Context.TRANSPARENT);
        if (Constants.DEBUG) {
            coder.check(length);
            coder.unmark();
        }
    }
}
FileLine
com\flagstone\transform\shape\DefineShape3.java414
com\flagstone\transform\shape\DefineShape4.java488
        coder.writeByte(winding | scaling);

        if (fillStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(fillStyles.size());
        } else {
            coder.writeByte(fillStyles.size());
        }

        for (final FillStyle style : fillStyles) {
            style.encode(coder, context);
        }

        if (lineStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(lineStyles.size());
        } else {
            coder.writeByte(lineStyles.size());
        }

        for (final LineStyle style : lineStyles) {
            style.encode(coder, context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        shape.encode(coder, context);

        context.remove(Context.ARRAY_EXTENDED);
        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
        context.remove(Context.TRANSPARENT);
        if (Constants.DEBUG) {
            coder.check(length);
            coder.unmark();
        }
    }
}
FileLine
com\flagstone\transform\linestyle\LineStyle2.java110
com\flagstone\transform\linestyle\MorphLineStyle2.java115
        endWidth = coder.readUnsignedShort();

        int bits = coder.readByte();
        if ((bits & Coder.BIT6) > 0) {
            startCap = 1;
        } else if ((bits & Coder.BIT7) > 0) {
            startCap = 2;
        } else {
            startCap = 0;
        }

        if ((bits & Coder.BIT4) > 0) {
            joinStyle = 1;
            hasMiter = false;
        } else if ((bits & Coder.BIT5) > 0) {
            joinStyle = 2;
            hasMiter = true;
        } else {
            joinStyle = 0;
            hasMiter = false;
        }

        hasFillStyle = (bits & Coder.BIT3) != 0;
        horizontal = (bits & Coder.BIT2) == 0;
        vertical = (bits & Coder.BIT1) == 0;
        pixelAligned = (bits & Coder.BIT0) != 0;

        bits = coder.readByte();
        lineClosed = (bits & Coder.BIT2) == 0;
        endCap = bits & Coder.PAIR0;

        if (hasMiter) {
            coder.readUnsignedShort();
        }

        if (hasFillStyle) {
            final SWFFactory<FillStyle> decoder = context.getRegistry()
                    .getMorphFillStyleDecoder();
FileLine
com\flagstone\transform\coder\BigDecoder.java104
com\flagstone\transform\coder\LittleDecoder.java110
    }

    /**
     * Fill the internal buffer. Any unread bytes are copied to the start of
     * the buffer and the remaining space is filled with data from the
     * underlying stream.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void fill() throws IOException {
        final int diff = size - index;
        pos += index;

        if (index < size) {
            for (int i = 0; i < diff; i++) {
                buffer[i] = buffer[index++];
            }
        }

        int bytesRead = 0;
        int bytesToRead = buffer.length - diff;

        index = diff;
        size = diff;

        do {
            bytesRead = stream.read(buffer, index, bytesToRead);
            if (bytesRead == -1) {
                bytesToRead = 0;
            } else {
                index += bytesRead;
                size += bytesRead;
                bytesToRead -= bytesRead;
            }
        } while (bytesToRead > 0);

        index = 0;
    }

    /**
     * Mark the current position.
     * @return the current position.
     */
    public int mark() {
        return locations.push(pos + index);
    }

    /**
     * Discard the last saved position.
     */
    public void unmark() {
        locations.pop();
    }

    /**
     * Reposition the decoder to the point recorded by the last call to the
     * mark() method.
     *
     * @throws IOException if the internal buffer was filled after mark() was
     * called.
     */
    public void reset() throws IOException {
        int location;

        if (locations.isEmpty()) {
            location = 0;
        } else {
            location = locations.peek();
        }
        if (location - pos < 0) {
            throw new IOException();
        }
        index = location - pos;
    }

    /**
     * Get the number of bytes read from the last saved position.
     *
     * @return the number of bytes read since the mark() method was last called.
     */
    public int bytesRead() {
FileLine
com\flagstone\transform\shape\DefineShape2.java417
com\flagstone\transform\shape\DefineShape3.java412
        context.put(Context.TRANSPARENT, 1);

        bounds.encode(coder, context);

        if (fillStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(fillStyles.size());
        } else {
            coder.writeByte(fillStyles.size());
        }

        for (final FillStyle style : fillStyles) {
            style.encode(coder, context);
        }

        if (lineStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(lineStyles.size());
        } else {
            coder.writeByte(lineStyles.size());
        }

        for (final LineStyle style : lineStyles) {
            style.encode(coder, context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        shape.encode(coder, context);

        context.remove(Context.ARRAY_EXTENDED);
        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
FileLine
com\flagstone\transform\font\DefineFont2.java283
com\flagstone\transform\font\DefineFont3.java279
    public DefineFont3(final DefineFont3 object) {
        identifier = object.identifier;
        encoding = object.encoding;
        small = object.small;
        italic = object.italic;
        bold = object.bold;
        language = object.language;
        name = object.name;
        ascent = object.ascent;
        descent = object.descent;
        leading = object.leading;
        shapes = new ArrayList<Shape>(object.shapes.size());
        for (final Shape shape : object.shapes) {
            shapes.add(shape.copy());
        }
        codes = new ArrayList<Integer>(object.codes);
        advances = new ArrayList<Integer>(object.advances);
        bounds = new ArrayList<Bounds>(object.bounds);
        kernings = new ArrayList<Kerning>(object.kernings);
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Add a character code and the corresponding glyph that will be displayed.
     * Character codes should be added to the font in ascending order.
     *
     * @param code
     *            the character code. Must be in the range 0..65535.
     * @param obj
     *            the shape that represents the glyph displayed for the
     *            character code.
     * @return this object.
     */
    public DefineFont3 addGlyph(final int code, final Shape obj) {
FileLine
com\flagstone\transform\shape\ShapeStyle.java161
com\flagstone\transform\shape\ShapeStyle2.java127
        lineStyles = new ArrayList<LineStyle2>();

        if (hasFill) {
            fillStyle = coder.readBits(numberOfFillBits, false);
        }
        if (hasAlt) {
            altFillStyle = coder.readBits(numberOfFillBits, false);
        }
        if (hasLine) {
            lineStyle = coder.readBits(numberOfLineBits, false);
        }

        if (hasStyles) {
            coder.alignToByte();

            int fillStyleCount = coder.readByte();

            if (context.contains(Context.ARRAY_EXTENDED)
                    && (fillStyleCount == EXTENDED)) {
                fillStyleCount = coder.readUnsignedShort();
            }

            final SWFFactory<FillStyle> decoder = context.getRegistry()
                    .getFillStyleDecoder();

            for (int i = 0; i < fillStyleCount; i++) {
                decoder.getObject(fillStyles, coder, context);
            }

            int lineStyleCount = coder.readByte();

            if (context.contains(Context.ARRAY_EXTENDED)
                    && (lineStyleCount == EXTENDED)) {
                lineStyleCount = coder.readUnsignedShort();
            }

            for (int i = 0; i < lineStyleCount; i++) {
                lineStyles.add(new LineStyle2(coder, context));
FileLine
com\flagstone\transform\shape\DefineShape2.java418
com\flagstone\transform\shape\DefineShape4.java488
        coder.writeByte(winding | scaling);

        if (fillStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(fillStyles.size());
        } else {
            coder.writeByte(fillStyles.size());
        }

        for (final FillStyle style : fillStyles) {
            style.encode(coder, context);
        }

        if (lineStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(lineStyles.size());
        } else {
            coder.writeByte(lineStyles.size());
        }

        for (final LineStyle style : lineStyles) {
            style.encode(coder, context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        shape.encode(coder, context);

        context.remove(Context.ARRAY_EXTENDED);
        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
FileLine
com\flagstone\transform\filter\BevelFilter.java91
com\flagstone\transform\filter\GradientGlowFilter.java87
            return this;
        }

        /**
         * Set the blur amounts.
         * @param xAmount the horizontal blur amount.
         * @param yAmount the vertical blur amount.
         * @return this Builder.
         */
        public Builder setBlur(final float xAmount, final float yAmount) {
            blurX = (int) (xAmount * Coder.SCALE_16);
            blurY = (int) (yAmount * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the compositing mode for the shadow.
         * @param filterMode the compositing mode, either INNER, KNOCKOUT or
         * TOP.
         * @return this Builder.
         */
        public Builder setMode(final FilterMode filterMode) {
            switch (filterMode) {
            case TOP:
                 mode = Coder.BIT4;
                break;
            case KNOCKOUT:
                mode = Coder.BIT6;
                break;
            case INNER:
                mode = Coder.BIT7;
                break;
            default:
                throw new IllegalArgumentException();
            }
            return this;
        }

        /**
         * Set the glow angle in radians.
         * @param radians the angle.
         * @return this Builder.
         */
        public Builder setAngle(final float radians) {
            angle = (int) (radians * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the distance of the glow from the object.
         * @param width the width of the glow.
         * @return this Builder.
         */
        public Builder setDistance(final float width) {
            distance = (int) (width * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the glow strength.
         * @param weight the weight of the glow.
         * @return this Builder.
         */
        public Builder setStrength(final float weight) {
            strength = (int) (weight * Coder.SCALE_8);
            return this;
        }

        /**
         * Set the number of passes for creating the blur.
         * @param count the number of blur passes.
         * @return this Builder.
         */
        public Builder setPasses(final int count) {
            passes = count;
            return this;
        }

        /**
         * Create a GradientBevelFilter object using the parameters defined in
         * the Builder.
         * @return a GradientBevelFilter object.
         */
        public GradientBevelFilter build() {
FileLine
com\flagstone\transform\shape\DefineShape.java236
com\flagstone\transform\shape\DefineShape2.java251
    public DefineShape3 add(final FillStyle style) {
        if (style == null) {
            throw new IllegalArgumentException();
        }
        fillStyles.add(style);
        return this;
    }

    /**
     * Get the bounding rectangle for the shape.
     *
     * @return the Bounds that encloses the shape.
     */
    public Bounds getBounds() {
        return bounds;
    }

    /**
     * Get the list fill styles.
     *
     * @return the list of fill styles used in the shape.
     */
    public List<FillStyle> getFillStyles() {
        return fillStyles;
    }

    /**
     * Get the list line styles.
     *
     * @return the list of line styles used in the shape.
     */
    public List<LineStyle> getLineStyles() {
        return lineStyles;
    }

    /**
     * Get the shape.
     *
     * @return the shape.
     */
    public Shape getShape() {
        return shape;
    }

    /**
     * Sets the bounding rectangle that encloses the shape.
     *
     * @param rect
     *            set the bounding rectangle for the shape. Must not be null.
     */
    public void setBounds(final Bounds rect) {
        if (rect == null) {
            throw new IllegalArgumentException();
        }
        bounds = rect;
    }

    /**
     * Sets the list fill styles that will be used to draw the shape.
     *
     * @param list
     *            set the fill styles for the shape. Must not be null.
     */
    public void setFillStyles(final List<FillStyle> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        fillStyles = list;
    }

    /**
     * Sets the list of styles that will be used to draw the outline of the
     * shape.
     *
     * @param list
     *            set the line styles for the shape. Must not be null.
     */
    public void setLineStyles(final List<LineStyle> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        lineStyles = list;
    }

    /**
     * Sets the shape.
     *
     * @param aShape
     *            set the shape to be drawn. Must not be null.
     */
    public void setShape(final Shape aShape) {
        if (aShape == null) {
            throw new IllegalArgumentException();
        }
        shape = aShape;
    }

    /** {@inheritDoc} */
    public DefineShape3 copy() {
FileLine
com\flagstone\transform\linestyle\MorphLineStyle.java129
com\flagstone\transform\linestyle\MorphLineStyle2.java235
    }

    /**
     * Get the width of the line at the start of the morphing process.
     *
     * @return the starting stroke width.
     */
    public int getStartWidth() {
        return startWidth;
    }

    /**
     * Get the width of the line at the end of the morphing process.
     *
     * @return the final stroke width.
     */
    public int getEndWidth() {
        return endWidth;
    }

    /**
     * Get the colour of the line at the start of the morphing process.
     *
     * @return the starting stroke colour.
     */
    public Color getStartColor() {
        return startColor;
    }

    /**
     * Returns the colour of the line at the end of the morphing process.
     *
     * @return the final stroke colour.
     */
    public Color getEndColor() {
        return endColor;
    }

    /**
     * Sets the width of the line at the start of the morphing process.
     *
     * @param aNumber
     *            the starting width of the line. Must be in the range 0..65535.
     */
    public void setStartWidth(final int aNumber) {
        if ((aNumber < 0) || (aNumber > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    0, Coder.USHORT_MAX, aNumber);
        }
        startWidth = aNumber;
    }

    /**
     * Sets the width of the line at the end of the morphing process.
     *
     * @param aNumber
     *            the ending width of the line. Must be in the range 0..65535.
     */
    public void setEndWidth(final int aNumber) {
        if ((aNumber < 0) || (aNumber > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    0, Coder.USHORT_MAX, aNumber);
        }
        endWidth = aNumber;
    }

    /**
     * Returns the colour of the line at the start of the morphing process.
     *
     * @param aColor
     *            the starting colour of the line. Must not be null.
     */
    public void setStartColor(final Color aColor) {
        if (aColor == null) {
            throw new IllegalArgumentException();
        }
        startColor = aColor;
    }

    /**
     * Sets the colour of the line at the end of the morphing process.
     *
     * @param aColor
     *            the ending colour of the line. Must not be null.
     */
    public void setEndColor(final Color aColor) {
        if (aColor == null) {
            throw new IllegalArgumentException();
        }
        endColor = aColor;
    }

    /**
     * Get the CapStyle used for the start of the line.
     * @return the CapStyle that specifies how the start of the line is drawn.
     */
    public CapStyle getStartCap() {
FileLine
com\flagstone\transform\coder\LittleDecoder.java258
com\flagstone\transform\coder\SWFDecoder.java287
        }
    }

    /**
     * Read a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readBits(final int numberOfBits, final boolean signed)
            throws IOException {

        int pointer = (index << BYTES_TO_BITS) + offset;

        if (((size << BYTES_TO_BITS) - pointer) < numberOfBits) {
            fill();
            pointer = (index << BYTES_TO_BITS) + offset;
        }

        int value = 0;

        if (numberOfBits > 0) {

            if (pointer + numberOfBits > (size << BYTES_TO_BITS)) {
                throw new ArrayIndexOutOfBoundsException();
            }

            for (int i = BITS_PER_INT; (i > 0)
                    && (index < buffer.length); i -= BITS_PER_BYTE) {
                value |= (buffer[index++] & BYTE_MASK) << (i - BITS_PER_BYTE);
            }

            value <<= offset;

            if (signed) {
                value >>= BITS_PER_INT - numberOfBits;
            } else {
                value >>>= BITS_PER_INT - numberOfBits;
            }

            pointer += numberOfBits;
            index = pointer >>> BITS_TO_BYTES;
            offset = pointer & Coder.LOWEST3;
        }

        return value;
    }

    /**
     * Read-ahead a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int scanBits(final int numberOfBits, final boolean signed)
FileLine
com\flagstone\transform\coder\BigDecoder.java265
com\flagstone\transform\coder\SWFDecoder.java288
    }

    /**
     * Read a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readBits(final int numberOfBits, final boolean signed)
            throws IOException {

        int pointer = (index << BYTES_TO_BITS) + offset;

        if (((size << BYTES_TO_BITS) - pointer) < numberOfBits) {
            fill();
            pointer = (index << BYTES_TO_BITS) + offset;
        }

        int value = 0;

        if (numberOfBits > 0) {

            if (pointer + numberOfBits > (size << BYTES_TO_BITS)) {
                throw new ArrayIndexOutOfBoundsException();
            }

            for (int i = BITS_PER_INT; (i > 0)
                    && (index < buffer.length); i -= BITS_PER_BYTE) {
                value |= (buffer[index++] & BYTE_MASK) << (i - BITS_PER_BYTE);
            }

            value <<= offset;

            if (signed) {
                value >>= BITS_PER_INT - numberOfBits;
            } else {
                value >>>= BITS_PER_INT - numberOfBits;
            }

            pointer += numberOfBits;
            index = pointer >>> BITS_TO_BYTES;
            offset = pointer & Coder.LOWEST3;
        }

        return value;
    }

    /**
     * Read-ahead a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int scanBits(final int numberOfBits, final boolean signed)
FileLine
com\flagstone\transform\util\font\SWFFontDecoder.java212
com\flagstone\transform\util\font\SWFFontDecoder.java266
        final int highest = object.getCodes().get(glyphCount - 1);

        font.setMissingGlyph(0);
        font.setNumberOfGlyphs(glyphCount);
        font.setHighestChar((char) highest);

        if (glyphCount > 0) {

            Shape shape;
            Bounds bounds = null;
            int advance;
            int code;

            for (int i = 0; i < glyphCount; i++) {
                shape = object.getShapes().get(i);

                if (object.getBounds() != null) {
                     bounds = object.getBounds().get(i);
                }
                if (object.getAdvances() == null) {
                    advance = 0;
                } else {
                    advance = object.getAdvances().get(i);
                }
                code = object.getCodes().get(i);

                font.addGlyph((char) code, new Glyph(shape, bounds, advance));
            }
        }

        fonts.put(object.getIdentifier(), font);
    }
FileLine
com\flagstone\transform\coder\BigDecoder.java103
com\flagstone\transform\coder\SWFDecoder.java122
        locations = new Stack<Integer>();
    }

    /**
     * Fill the internal buffer. Any unread bytes are copied to the start of
     * the buffer and the remaining space is filled with data from the
     * underlying stream.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void fill() throws IOException {
        final int diff = size - index;
        pos += index;

        if (index < size) {
            for (int i = 0; i < diff; i++) {
                buffer[i] = buffer[index++];
            }
        }

        int bytesRead = 0;
        int bytesToRead = buffer.length - diff;

        index = diff;
        size = diff;

        do {
            bytesRead = stream.read(buffer, index, bytesToRead);
            if (bytesRead == -1) {
                bytesToRead = 0;
            } else {
                index += bytesRead;
                size += bytesRead;
                bytesToRead -= bytesRead;
            }
        } while (bytesToRead > 0);

        index = 0;
    }

    /**
     * Remember the current position.
     * @return the current position.
     */
    public int mark() {
        return locations.push(pos + index);
    }

    /**
     * Discard the last saved position.
     */
    public void unmark() {
        locations.pop();
    }

    /**
     * Reposition the decoder to the point recorded by the last call to the
     * mark() method.
     *
     * @throws IOException if the internal buffer was filled after mark() was
     * called.
     */
    public void reset() throws IOException {
        int last;
FileLine
com\flagstone\transform\util\font\SWFFontDecoder.java135
com\flagstone\transform\util\font\SWFFontDecoder.java166
    public void decode(final FontInfo2 info) {

        final Font font = fonts.get(info.getIdentifier());

        font.setFace(new FontFace(info.getName(),
                info.isBold(), info.isItalic()));

        font.setEncoding(info.getEncoding());
        font.setAscent(0);
        font.setDescent(0);
        font.setLeading(0);

        final int codeCount = info.getCodes().size();
        final int highest = info.getCodes().get(codeCount - 1);

        font.setHighestChar((char) highest);

        if (!glyphs.isEmpty()) {
            for (int code : info.getCodes()) {
                font.addGlyph((char) code, new Glyph(glyphs.get(code)));
            }
        }
    }

    /**
     * Initialise this object with the information from a flash font definition.
     *
     * @param object
     *            a DefineFont2 object that contains information on the font
     *            name, weight, style and character codes as well as the glyph
     *            definitions.
     */
    public void decode(final DefineFont2 object) {
FileLine
com\flagstone\transform\shape\DefineMorphShape.java575
com\flagstone\transform\shape\DefineShape4.java488
        bounds.encode(coder, context);

        if (fillStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(fillStyles.size());
        } else {
            coder.writeByte(fillStyles.size());
        }

        for (final FillStyle style : fillStyles) {
            style.encode(coder, context);
        }

        if (lineStyles.size() >= EXTENDED) {
            coder.writeByte(EXTENDED);
            coder.writeShort(lineStyles.size());
        } else {
            coder.writeByte(lineStyles.size());
        }

        for (final LineStyle style : lineStyles) {
            style.encode(coder, context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        shape.encode(coder, context);

        context.remove(Context.ARRAY_EXTENDED);
FileLine
com\flagstone\transform\image\DefineJPEGImage.java129
com\flagstone\transform\image\DefineJPEGImage2.java116
    public DefineJPEGImage2(final DefineJPEGImage2 object) {
        identifier = object.identifier;
        width = object.width;
        height = object.height;
        image = object.image;
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Get the width of the image in pixels (not twips).
     *
     * @return the width of the image.
     */
    public int getWidth() {
        return width;
    }

    /**
     * Get the height of the image in pixels (not twips).
     *
     * @return the height of the image.
     */
    public int getHeight() {
        return height;
    }

    /**
     * Get a copy of the image.
     *
     * @return  a copy of the data.
     */
    public byte[] getImage() {
        return Arrays.copyOf(image, image.length);
    }

    /**
     * Sets the image data.
     *
     * @param bytes
     *            a list of bytes containing the image data. Must not be null.
     */
    public void setImage(final byte[] bytes) {
        if (bytes == null) {
            throw new IllegalArgumentException();
        }
        image = Arrays.copyOf(bytes, bytes.length);
        decodeInfo();
    }

    /** {@inheritDoc} */
    public DefineJPEGImage2 copy() {
FileLine
com\flagstone\transform\coder\LittleDecoder.java110
com\flagstone\transform\coder\SWFDecoder.java123
    }

    /**
     * Fill the internal buffer. Any unread bytes are copied to the start of
     * the buffer and the remaining space is filled with data from the
     * underlying stream.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void fill() throws IOException {
        final int diff = size - index;
        pos += index;

        if (index < size) {
            for (int i = 0; i < diff; i++) {
                buffer[i] = buffer[index++];
            }
        }

        int bytesRead = 0;
        int bytesToRead = buffer.length - diff;

        index = diff;
        size = diff;

        do {
            bytesRead = stream.read(buffer, index, bytesToRead);
            if (bytesRead == -1) {
                bytesToRead = 0;
            } else {
                index += bytesRead;
                size += bytesRead;
                bytesToRead -= bytesRead;
            }
        } while (bytesToRead > 0);

        index = 0;
    }

    /**
     * Remember the current position.
     * @return the current position.
     */
    public int mark() {
        return locations.push(pos + index);
    }

    /**
     * Discard the last saved position.
     */
    public void unmark() {
        locations.pop();
    }

    /**
     * Reposition the decoder to the point recorded by the last call to the
     * mark() method.
     *
     * @throws IOException if the internal buffer was filled after mark() was
     * called.
     */
    public void reset() throws IOException {
        int last;
FileLine
com\flagstone\transform\font\FontInfo.java283
com\flagstone\transform\font\FontInfo2.java286
    }

    /**
     * Get the list of character codes.
     *
     * @return the list of character codes defined in the font.
     */
    public List<Integer> getCodes() {
        return codes;
    }

    /**
     * Sets the identifier of the font that this font information is for.
     *
     * @param uid
     *            the unique identifier of the DefineFont that contains the
     *            glyphs for the font. Must be in the range 1..65535.
     */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Sets the name of the font. The name be omitted (set to an empty string)
     * if the font is embedded in the Flash file, i.e. the corresponding
     * DefineFont object has all the glyph information.
     *
     * @param aString
     *            the name assigned to the font, identifying the font family.
     *            Must not be null.
     */
    public void setName(final String aString) {
        if (aString == null) {
            throw new IllegalArgumentException();
        }
        name = aString;
    }

    /**
     * Sets the font character encoding.
     *
     * @param anEncoding
     *            the encoding used to identify characters, either ASCII, SJIS
     *            or UNICODE.
     */
    public void setEncoding(final CharacterFormat anEncoding) {
        switch(anEncoding) {
        case UCS2:
            encoding = 0;
            break;
        case ANSI:
            encoding = 1;
            break;
        case SJIS:
            encoding = 2;
            break;
        default:
            throw new IllegalArgumentException();
        }
    }

    /**
     * Sets the font is italics.
     *
     * @param aBool
     *            a boolean flag indicating whether the font will be rendered in
     *            italics.
     */
    public void setItalic(final boolean aBool) {
        italic = aBool;
    }

    /**
     * Sets the font is bold.
     *
     * @param aBool
     *            a boolean flag indicating whether the font will be rendered in
     *            bold face.
     */
    public void setBold(final boolean aBool) {
        bold = aBool;
    }

    /**
     * Sets the language code used to determine the position of line-breaks in
     * text rendered using the font.
     *
     * NOTE: The language attribute is ignored if the object is encoded in a
     * Flash 5 movie.
     *
     * @param lang the Language identifying the spoken language for the text
     * rendered using the font.
     */
    public void setLanguage(final Language lang) {
FileLine
com\flagstone\transform\shape\DefineShape.java183
com\flagstone\transform\shape\DefineShape3.java188
    public DefineShape3(final DefineShape3 object) {
        identifier = object.identifier;
        bounds = object.bounds;
        fillStyles = new ArrayList<FillStyle>(object.fillStyles.size());
        for (final FillStyle style : object.fillStyles) {
            fillStyles.add(style.copy());
        }
        lineStyles = new ArrayList<LineStyle>(object.lineStyles.size());
        for (final LineStyle style : object.lineStyles) {
            lineStyles.add(style.copy());
        }
        shape = object.shape.copy();
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Add a LineStyle1 to the list of line styles.
     *
     * @param style
     *            and LineStyle1 object. Must not be null or an instance of
     *            LineStyle2.
     *
     * @return this object.
     */
    public DefineShape3 add(final LineStyle style) {
FileLine
com\flagstone\transform\linestyle\LineStyle2.java523
com\flagstone\transform\linestyle\MorphLineStyle2.java589
        coder.writeShort(endWidth);

        int value = 0;

        if (startCap == 1) {
            value |= Coder.BIT6;
        } else if (startCap == 2) {
            value |= Coder.BIT7;
        }

        if (joinStyle == 1) {
            value |= Coder.BIT4;
        } else if (joinStyle == 2) {
            value |= Coder.BIT5;
        }

        value |= fillStyle == null ? 0 : Coder.BIT3;
        value |= horizontal ? 0 : Coder.BIT2;
        value |= vertical ? 0 : Coder.BIT1;
        value |= pixelAligned ? Coder.BIT0 : 0;

        coder.writeByte(value);

        value = lineClosed ? 0 : Coder.BIT2;
        value |= endCap;
        coder.writeByte(value);

        if (hasMiter) {
            coder.writeShort(miterLimit);
        }

        if (hasFillStyle) {
            fillStyle.encode(coder, context);
        } else {
FileLine
com\flagstone\transform\shape\DefineMorphShape.java291
com\flagstone\transform\shape\DefineMorphShape2.java282
        fillStyles = new ArrayList<FillStyle>(object.fillStyles.size());
        for (final FillStyle style : object.fillStyles) {
            fillStyles.add(style.copy());
        }
        lineStyles = new ArrayList<LineStyle>(object.lineStyles.size());
        for (final LineStyle style : object.lineStyles) {
            lineStyles.add(style.copy());
        }
        shape = object.shape.copy();
        endShape = object.endShape.copy();
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Add a LineStyle object to the list of line styles.
     *
     * @param style
     *            a MorphLineStyle2 object. Must not be null. Must be an
     *            instance of MorphLineStyle2.
     *
     * @return this object.
     */
    public DefineMorphShape2 add(final LineStyle style) {
FileLine
com\flagstone\transform\Place2.java724
com\flagstone\transform\Place3.java789
                    << Coder.LENGTH_FIELD_SIZE) | length);
        }
        if (Constants.DEBUG) {
            coder.mark();
        }

        context.put(Context.TRANSPARENT, 1);
        int bits = 0;
        bits |= events.isEmpty() ? 0 : Coder.BIT7;
        bits |= depth == null ? 0 : Coder.BIT6;
        bits |= name == null ? 0 : Coder.BIT5;
        bits |= ratio == null ? 0 : Coder.BIT4;
        bits |= colorTransform == null ? 0 : Coder.BIT3;
        bits |= transform == null ? 0 : Coder.BIT2;

        switch (type) {
        case MODIFY:
            bits |= Coder.BIT0;
            break;
        case NEW:
            bits |= Coder.BIT1;
            break;
        default:
            bits |= Coder.BIT0;
            bits |= Coder.BIT1;
            break;
        }
        coder.writeByte(bits);
FileLine
com\flagstone\transform\filter\BevelFilter.java265
com\flagstone\transform\filter\GradientGlowFilter.java267
    }

    /**
     * Get the blur amount in the x-direction.
     * @return the horizontal blur amount.
     */
    public float getBlurX() {
        return blurX / Coder.SCALE_16;
    }

    /**
     * Get the blur amount in the y-direction.
     * @return the vertical blur amount.
     */
    public float getBlurY() {
        return blurY / Coder.SCALE_16;
    }

    /**
     * Get the angle of the glow.
     * @return the angle of the glow in radians.
     */
    public float getAngle() {
        return angle / Coder.SCALE_16;
    }

    /**
     * Get the distance of the glow from the object.
     * @return the width of the glow.
     */
    public float getDistance() {
        return distance / Coder.SCALE_16;
    }

    /**
     * Get the strength of the glow.
     * @return the glow strength.
     */
    public float getStrength() {
        return strength / Coder.SCALE_8;
    }

    /**
     * Get the compositing mode.
     * @return the mode used for compositing, either TOP, INNER or KNOCKOUT.
     */
    public FilterMode getMode() {
        FilterMode value;
        switch (mode) {
        case Coder.BIT4:
            value = FilterMode.TOP;
            break;
        case Coder.BIT6:
            value = FilterMode.KNOCKOUT;
            break;
        case Coder.BIT7:
            value = FilterMode.INNER;
            break;
        default:
            throw new IllegalStateException();
        }
        return value;
    }

    /**
     * Get the number of passes for generating the blur.
     * @return the number of blur passes.
     */
    public int getPasses() {
        return passes;
    }

    @Override
    public String toString() {
        return String.format(FORMAT, gradients.toString(),
FileLine
com\flagstone\transform\coder\LittleDecoder.java311
com\flagstone\transform\coder\SWFDecoder.java411
    }

    /**
     * Read an unsigned byte.
     *
     * @return an 8-bit unsigned value.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readByte() throws IOException {
        if (size - index < 1) {
            fill();
        }
        if (index + 1 > size) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return buffer[index++] & BYTE_MASK;
    }

    /**
     * Reads an array of bytes.
     *
     * @param bytes
     *            the array that will contain the bytes read.
     *
     * @return the array of bytes.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public byte[] readBytes(final byte[] bytes) throws IOException {
        final int wanted = bytes.length;
        int dest = 0;
        int read = 0;

        int available;
        int remaining;

        while (read < wanted) {
            available = size - index;
            remaining = wanted - read;
            if (available > remaining) {
                available = remaining;
            }
            System.arraycopy(buffer, index, bytes, dest, available);
            read += available;
            index += available;
            dest += available;

            if (index == size) {
                fill();
            }
        }
        return bytes;
    }

    /**
     * Sets the character encoding scheme used when encoding or decoding
     * strings.
     *
     * @param enc
     *            the CharacterEncoding that identifies how strings are encoded.
     */
    public void setEncoding(final CharacterEncoding enc) {
FileLine
com\flagstone\transform\util\image\BufferedImageDecoder.java334
com\flagstone\transform\util\image\BufferedImageDecoder.java357
    private void decodeARGBPre(final DataBuffer buffer) {
        final int[] pixels = ((DataBufferInt) buffer).getData();
        format = ImageFormat.RGBA;
        image = new byte[height * width * BYTES_PER_PIXEL];
        int index = 0;

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++, index += BYTES_PER_PIXEL) {
                final int pixel = pixels[y * width + x];

                image[index + ALPHA] = (byte) (pixel >> ALIGN_BYTE4);
                image[index + BLUE] = (byte) (pixel >> ALIGN_BYTE3);
                image[index + GREEN] = (byte) (pixel >> ALIGN_BYTE2);
                image[index] = (byte) pixel;
            }
        }
    }

    /**
     * Decode the data from a BufferedImage where each pixel is in the format
     * RGB.
     * @param buffer the DataBuffer from a BufferedImage.
     */
    private void decodeBGR(final DataBuffer buffer) {
FileLine
com\flagstone\transform\shape\ShapeStyle.java144
com\flagstone\transform\shape\ShapeStyle2.java110
    public ShapeStyle2(final int flags, final SWFDecoder coder,
            final Context context) throws IOException {
        int numberOfFillBits = context.get(Context.FILL_SIZE);
        int numberOfLineBits = context.get(Context.LINE_SIZE);

        hasStyles = (flags & Coder.BIT4) != 0;
        hasLine = (flags & Coder.BIT3) != 0;
        hasAlt = (flags & Coder.BIT2) != 0;
        hasFill = (flags & Coder.BIT1) != 0;
        hasMove = (flags & Coder.BIT0) != 0;

        if (hasMove) {
            final int moveFieldSize = coder.readBits(5, false);
            moveX = coder.readBits(moveFieldSize, true);
            moveY = coder.readBits(moveFieldSize, true);
        }
        fillStyles = new ArrayList<FillStyle>();
        lineStyles = new ArrayList<LineStyle2>();
FileLine
com\flagstone\transform\coder\BigDecoder.java281
com\flagstone\transform\coder\SWFDecoder.java357
    public int scanBits(final int numberOfBits, final boolean signed)
            throws IOException {

        int pointer = (index << BYTES_TO_BITS) + offset;

        if (((size << BYTES_TO_BITS) - pointer) < numberOfBits) {
            fill();
            pointer = (index << BYTES_TO_BITS) + offset;
        }

        int value = 0;

        if (numberOfBits > 0) {

            if (pointer + numberOfBits > (size << BYTES_TO_BITS)) {
                throw new ArrayIndexOutOfBoundsException();
            }

            for (int i = BITS_PER_INT; (i > 0)
                    && (index < buffer.length); i -= BITS_PER_BYTE) {
                value |= (buffer[index++] & BYTE_MASK) << (i - BITS_PER_BYTE);
            }

            value <<= offset;

            if (signed) {
                value >>= BITS_PER_INT - numberOfBits;
            } else {
                value >>>= BITS_PER_INT - numberOfBits;
            }
FileLine
com\flagstone\transform\font\DefineFont2.java861
com\flagstone\transform\font\DefineFont3.java854
                    << Coder.LENGTH_FIELD_SIZE) | length);
        }
        if (Constants.DEBUG) {
            coder.mark();
        }
        coder.writeShort(identifier);
        context.put(Context.FILL_SIZE, 1);
        context.put(Context.LINE_SIZE, context.contains(Context.POSTSCRIPT) ? 1
                : 0);
        if (wideCodes) {
            context.put(Context.WIDE_CODES, 1);
        }

        int bits = 0;
        bits |= containsLayoutInfo() ? Coder.BIT7 : 0;
        bits |= format << Coder.TO_UPPER_NIB;
        bits |= wideOffsets ? Coder.BIT3 : 0;
        bits |= wideCodes ? Coder.BIT2 : 0;
        bits |= italic ? Coder.BIT1 : 0;
        bits |= bold ? Coder.BIT0 : 0;
        coder.writeByte(bits);

        coder.writeByte(language);
FileLine
com\flagstone\transform\coder\BigDecoder.java198
com\flagstone\transform\coder\SWFDecoder.java235
    }

    /**
     * Get the number of bytes read from the last saved position.
     *
     * @return the number of bytes read since the mark() method was last called.
     */
    public int bytesRead() {
        return (pos + index) - locations.peek();
    }

    /**
     * Changes the location to the next byte boundary.
     */
    public void alignToByte() {
        if (offset > 0) {
            index += 1;
            offset = 0;
        }
    }

    /**
     * Skips over and discards n bytes of data.
     *
     * @param count the number of bytes to skip.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void skip(final int count) throws IOException {
        if (size - index == 0) {
            fill();
        }
        if (count < size - index) {
            index += count;
        } else {
            int toSkip = count;
            int diff;
            while (toSkip > 0) {
                diff = size - index;
                if (toSkip <= diff) {
                    index += toSkip;
                    toSkip = 0;
                } else {
                    index += diff;
                    toSkip -= diff;
                    fill();
                    if (size - index == 0) {
                        throw new ArrayIndexOutOfBoundsException();
                    }
                }
            }
        }
    }

    /**
     * Read a bit field.
     *
     * @param numberOfBits
     *            the number of bits to read.
     *
     * @param signed
     *            indicates whether the integer value read is signed.
     *
     * @return the value read.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readBits(final int numberOfBits, final boolean signed)
FileLine
com\flagstone\transform\shape\ShapeStyle.java393
com\flagstone\transform\shape\ShapeStyle2.java359
    public ShapeStyle2 setMove(final Integer xCoord, final Integer yCoord) {
        if (((xCoord == null) && (yCoord != null))
                || ((xCoord != null) && (yCoord == null))) {
            throw new IllegalArgumentException();
        }
        if ((xCoord != null)
                && ((xCoord < Shape.MIN_COORD) || (xCoord > Shape.MAX_COORD))) {
            throw new IllegalArgumentRangeException(
                    Shape.MIN_COORD, Shape.MAX_COORD, xCoord);
        }
        if ((yCoord != null)
                && ((yCoord < Shape.MIN_COORD) || (yCoord > Shape.MAX_COORD))) {
            throw new IllegalArgumentRangeException(
                    Shape.MIN_COORD, Shape.MAX_COORD, yCoord);
        }
        moveX = xCoord;
        moveY = yCoord;
        return this;
    }

    /**
     * Sets the index of the fill style that will be applied to any area filled.
     * May be set to zero if no style is selected or null if the line style
     * remains unchanged.
     *
     * @param anIndex
     *            selects the fill style at anIndex in the fill styles list of
     *            the parent Shape object.
     * @return this object.
     */
    public ShapeStyle2 setFillStyle(final Integer anIndex) {
FileLine
com\flagstone\transform\shape\DefineShape2.java375
com\flagstone\transform\shape\DefineShape3.java367
        length = 2 + bounds.prepareToEncode(context);

        length += (fillStyles.size() >= EXTENDED) ? EXTENDED_LENGTH : 1;

        for (final FillStyle style : fillStyles) {
            length += style.prepareToEncode(context);
        }

        length += (lineStyles.size() >= EXTENDED) ? EXTENDED_LENGTH : 1;

        for (final LineStyle style : lineStyles) {
            length += style.prepareToEncode(context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        length += shape.prepareToEncode(context);

        context.remove(Context.ARRAY_EXTENDED);
        context.put(Context.FILL_SIZE, 0);
        context.put(Context.LINE_SIZE, 0);
FileLine
com\flagstone\transform\shape\DefineMorphShape.java164
com\flagstone\transform\shape\DefineMorphShape2.java174
        coder.readByte();

        final int offsetToEnd = coder.readInt();
        coder.mark();

        int fillStyleCount = coder.readByte();

        if (context.contains(Context.ARRAY_EXTENDED)
                && (fillStyleCount == EXTENDED)) {
            fillStyleCount = coder.readUnsignedShort();
        }

        final SWFFactory<FillStyle> decoder = context.getRegistry()
                .getMorphFillStyleDecoder();

        for (int i = 0; i < fillStyleCount; i++) {
            decoder.getObject(fillStyles, coder, context);
        }

        int lineStyleCount = coder.readByte();

        if (context.contains(Context.ARRAY_EXTENDED)
                && (lineStyleCount == EXTENDED)) {
            lineStyleCount = coder.readUnsignedShort();
        }

        for (int i = 0; i < lineStyleCount; i++) {
            lineStyles.add(new MorphLineStyle2(coder, context));
FileLine
com\flagstone\transform\text\DefineText.java221
com\flagstone\transform\text\DefineText2.java222
    public DefineText2 add(final TextSpan obj) {
        if (obj == null) {
            throw new IllegalArgumentException();
        }
        spans.add(obj);
        return this;
    }

    /**
     * Returns the bounding rectangle that completely encloses the text to be
     * displayed.
     *
     * @return the bounding rectangle of the text.
     */
    public Bounds getBounds() {
        return bounds;
    }

    /**
     * Get the coordinate transform that controls the size, location and
     * orientation of the text when it is displayed.
     *
     * @return the coordinate transform used to position the text.
     */
    public CoordTransform getTransform() {
        return transform;
    }

    /**
     * Get the list of text spans that define the text to be displayed.
     *
     * @return the list of text blocks.
     */
    public List<TextSpan> getSpans() {
        return spans;
    }

    /**
     * Sets the bounding rectangle that encloses the text being displayed.
     *
     * @param rect
     *            the bounding rectangle enclosing the text. Must not be null.
     */
    public void setBounds(final Bounds rect) {
        if (rect == null) {
            throw new IllegalArgumentException();
        }
        bounds = rect;
    }

    /**
     * Sets the coordinate transform that changes the orientation and size of
     * the text displayed.
     *
     * @param matrix
     *            an CoordTransform to change the size and orientation of the
     *            text. Must not be null.
     */
    public void setTransform(final CoordTransform matrix) {
        if (matrix == null) {
            throw new IllegalArgumentException();
        }
        transform = matrix;
    }

    /**
     * Sets the list of text spans that define the text to be displayed.
     *
     * @param list
     *            a list of TextSpan objects that define the text to be
     *            displayed. Must not be null.
     */
    public void setSpans(final List<TextSpan> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        spans = list;
    }

    /** {@inheritDoc} */
    public DefineText2 copy() {
FileLine
com\flagstone\transform\text\DefineText.java107
com\flagstone\transform\text\DefineText2.java106
    public DefineText2(final SWFDecoder coder, final Context context)
            throws IOException {
        length = coder.readUnsignedShort() & Coder.LENGTH_FIELD;
        if (length == Coder.IS_EXTENDED) {
            length = coder.readInt();
        }
        coder.mark();
        identifier = coder.readUnsignedShort();
        bounds = new Bounds(coder);

        /*
         * This code is used to get round a bug in Flash - sometimes 16, 8-bit
         * zeroes are written out before the transform. The root cause in Flash
         * is unknown but seems to be related to the bounds not being set - all
         * values are zero.
         */

        coder.fill();
        coder.mark();
        int sum = 0;
        // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
        for (int i = 0; i < 16; i++) {
            sum += coder.readByte();
        }
        if (sum != 0) {
            coder.reset();
        }
        coder.unmark();

        transform = new CoordTransform(coder);

        glyphBits = coder.readByte();
        advanceBits = coder.readByte();

        context.put(Context.TRANSPARENT, 1);
FileLine
com\flagstone\transform\shape\DefineShape.java186
com\flagstone\transform\shape\DefineShape4.java211
        fillStyles = new ArrayList<FillStyle>(object.fillStyles.size());
        for (final FillStyle style : object.fillStyles) {
            fillStyles.add(style.copy());
        }
        lineStyles = new ArrayList<LineStyle>(object.lineStyles.size());
        for (final LineStyle style : object.lineStyles) {
            lineStyles.add(style.copy());
        }
        shape = object.shape.copy();
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Get the bounding rectangle that completely enclosed the shape.
     *
     * @return the Bounds that encloses the shape
     */
    public Bounds getBounds() {
FileLine
com\flagstone\transform\util\image\BufferedImageDecoder.java535
com\flagstone\transform\util\image\BufferedImageDecoder.java559
    private void decodeByteABGRPre(final DataBuffer buffer) {
        final byte[] pixels = ((DataBufferByte) buffer).getData();

        format = ImageFormat.RGBA;
        image = new byte[height * width * BYTES_PER_PIXEL];
        int index = 0;

        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++, index += BYTES_PER_PIXEL) {
                final int offset = BYTES_PER_PIXEL * (y * width + x);

                image[index + ALPHA] = pixels[offset];
                image[index + BLUE] = pixels[offset + 1];
                image[index + GREEN] = pixels[offset + 2];
                image[index] = pixels[offset + ALPHA];
            }
        }
    }

    /**
     * Decode the data from a BufferedImage where each pixel is either black
     * or white.
     * @param buffer the DataBuffer from a BufferedImage.
     * @param model the ColorModel from a BufferedImage.
     * @throws IOException if there is an error decoding the pixel data.
     */
    private void decodeByteBinary(final DataBuffer buffer,
FileLine
com\flagstone\transform\sound\SoundStreamHead.java131
com\flagstone\transform\sound\SoundStreamHead2.java141
        playRate = readRate(info & Coder.PAIR1);
        playSampleSize = ((info & Coder.BIT1) >> 1) + 1;
        playChannels = (info & Coder.BIT0) + 1;

        info = coder.readByte();
        format = (info & Coder.NIB1) >> Coder.TO_LOWER_NIB;
        streamRate = readRate(info & Coder.PAIR1);
        streamSampleSize = ((info & Coder.BIT1) >> 1) + 1;
        streamChannels = (info & Coder.BIT0) + 1;
        streamSampleCount = coder.readUnsignedShort();

        // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
        if ((length == 6) && (format == 2)) {
            latency = coder.readSignedShort();
        }
        coder.check(length);
        coder.unmark();
    }

    /**
     * Creates a SoundStreamHead2 object specifying all the parameters required
     * to define the sound.
     *
     * @param encoding
     *            the compression format for the sound data, either
     *            DefineSound.NATIVE_PCM, DefineSound.ADPCM, DefineSound.MP3,
     *            DefineSound.PCM or DefineSound.NELLYMOSER (Flash 6+ only).
     * @param playbackRate
     *            the recommended rate for playing the sound, either 5512,
     *            11025, 22050 or 44100 Hz.
     * @param playbackChannels
     *            The recommended number of playback channels: 1 = mono or 2 =
     *            stereo.
     * @param playSize
     *            the recommended uncompressed sample size for playing the
     *            sound, either 1 or 2 bytes.
     * @param streamingRate
     *            the rate at which the sound was sampled, either 5512, 11025,
     *            22050 or 44100 Hz.
     * @param streamingChannels
     *            the number of channels: 1 = mono or 2 = stereo.
     * @param streamingSize
     *            the sample size for the sound, either 1 or 2 bytes.
     * @param streamingCount
     *            the number of samples in each subsequent SoundStreamBlock
     *            object.
     */
    public SoundStreamHead2(final SoundFormat encoding, final int playbackRate,
FileLine
com\flagstone\transform\coder\BigDecoder.java318
com\flagstone\transform\coder\SWFDecoder.java411
    }

    /**
     * Read an unsigned byte.
     *
     * @return an 8-bit unsigned value.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public int readByte() throws IOException {
        if (size - index < 1) {
            fill();
        }
        if (index + 1 > size) {
            throw new ArrayIndexOutOfBoundsException();
        }
        return buffer[index++] & BYTE_MASK;
    }

    /**
     * Reads an array of bytes.
     *
     * @param bytes
     *            the array that will contain the bytes read.
     *
     * @return the array of bytes.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public byte[] readBytes(final byte[] bytes) throws IOException {
        final int wanted = bytes.length;
        int dest = 0;
        int read = 0;

        int available;
        int remaining;

        while (read < wanted) {
            available = size - index;
            remaining = wanted - read;
            if (available > remaining) {
                available = remaining;
            }
            System.arraycopy(buffer, index, bytes, dest, available);
            read += available;
            index += available;
            dest += available;

            if (index == size) {
FileLine
com\flagstone\transform\Place2.java262
com\flagstone\transform\Place3.java197
        int bits = coder.readByte();
        final boolean hasEvents = (bits & Coder.BIT7) != 0;
        final boolean hasDepth = (bits & Coder.BIT6) != 0;
        final boolean hasName = (bits & Coder.BIT5) != 0;
        final boolean hasRatio = (bits & Coder.BIT4) != 0;
        final boolean hasColorTransform = (bits & Coder.BIT3) != 0;
        final boolean hasTransform = (bits & Coder.BIT2) != 0;

        switch (bits & Coder.PAIR0) {
        case 0:
            type = PlaceType.MODIFY;
            break;
        case 1:
            type = PlaceType.MODIFY;
            break;
        case 2:
            type = PlaceType.NEW;
            break;
        default:
            type = PlaceType.REPLACE;
            break;
        }
FileLine
com\flagstone\transform\coder\BigDecoder.java206
com\flagstone\transform\coder\LittleDecoder.java192
        return pos + index - locations.peek();
    }

    /**
     * Changes the location to the next byte boundary.
     */
    public void alignToByte() {
        if (offset > 0) {
            index += 1;
            offset = 0;
        }
    }

    /**
     * Skips over and discards n bytes of data.
     *
     * @param count the number of bytes to skip.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void skip(final int count) throws IOException {
        if (size - index == 0) {
            fill();
        }
        if (count < size - index) {
            index += count;
        } else {
            int toSkip = count;
            int diff;
            while (toSkip > 0) {
                diff = size - index;
                if (toSkip <= diff) {
                    index += toSkip;
                    toSkip = 0;
                } else {
                    index += diff;
                    toSkip -= diff;
                    fill();
                    if (size - index == 0) {
                        throw new ArrayIndexOutOfBoundsException();
                    }
                }
            }
        }
    }

    /**
     * Checks the number of bytes read since the last mark and moves to the
     * next word (32-bit) aligned boundary.
     *
     * @throws IOException if an error occurs reading from the underlying
     * input stream.
     */
    public void alignToWord() throws IOException {
FileLine
com\flagstone\transform\text\DefineText.java366
com\flagstone\transform\text\DefineText2.java371
        context.remove(Context.TRANSPARENT);
        context.put(Context.GLYPH_SIZE, 0);
        context.put(Context.ADVANCE_SIZE, 0);
        if (Constants.DEBUG) {
            coder.check(length);
            coder.unmark();
        }
    }

    /**
     * The number of bits used to encode the glyph indices.
     * @return the number of bits used to encode each glyph index.
     */
    private int calculateSizeForGlyphs() {
        int total = 0;
        int size;

        for (final TextSpan span : spans) {
            size = span.glyphBits();

            if (size > total) {
                total = size;
            }
        }

        return total;
    }

    /**
     * The number of bits used to encode the advances.
     * @return the number of bits used to encode each advance.
     */
    private int calculateSizeForAdvances() {
        int total = 0;
        int size;

        for (final TextSpan span : spans) {
            size = span.advanceBits();

            if (size > total) {
                total = size;
            }
        }

        return total;
    }
}
FileLine
com\flagstone\transform\font\FontInfo.java199
com\flagstone\transform\font\FontInfo2.java190
        encoding = object.encoding;
        codes = new ArrayList<Integer>(object.codes);
    }

    /**
     * Get the unique identifier of the font definition that this font
     * information is for.
     *
     * @return the unique identifier of the font.
     */
    public int getIdentifier() {
        return identifier;
    }

    /**
     * Get the name of the font family.
     *
     * @return the font name.
     */
    public String getName() {
        return name;
    }

    /**
     * Get the encoding scheme used for characters rendered in the font,
     * either ASCII, SJIS or UCS2.
     *
     * @return the encoding used for the character codes.
     */
    public CharacterFormat getEncoding() {
        CharacterFormat value;
        switch(encoding) {
        case 0:
            value = CharacterFormat.UCS2;
            break;
        case 1:
            value = CharacterFormat.ANSI;
            break;
        case 2:
            value = CharacterFormat.SJIS;
            break;
        default:
            throw new IllegalStateException();
        }
        return value;
    }

    /**
     * Does the font have a small point size. This is used only with a Unicode
     * font encoding.
     *
     * @return true if the font is small.
     */
    public boolean isSmall() {
        return small;
    }

    /**
     * Sets the font is small. Used only with Unicode fonts.
     *
     * @param aBool
     *            a boolean flag indicating the font will be aligned on pixel
     *            boundaries.
     */
    public void setSmall(final boolean aBool) {
        small = aBool;
    }

    /**
     * Is the font style italics.
     *
     * @return true if the font is in italics.
     */
    public boolean isItalic() {
        return italic;
    }

    /**
     * Is the font weight bold.
     *
     * @return true if the font weight is bold.
     */
    public boolean isBold() {
        return bold;
    }

    /**
     * Returns the language code identifying the type of spoken language for the
     * font.
     *
     * @return the Language used to determine how line-breaks are inserted
     *         into text rendered using the font. Returns NONE if the object was
     *         decoded from a movie contains Flash 5 or less.
     */
    public Language getLanguage() {
FileLine
com\flagstone\transform\font\DefineFont2.java219
com\flagstone\transform\font\DefineFont3.java214
        if (containsLayout || coder.bytesRead() < length) {
            ascent = coder.readSignedShort();
            descent = coder.readSignedShort();
            leading = coder.readSignedShort();

            for (int i = 0; i < glyphCount; i++) {
                advances.add(coder.readSignedShort());
            }

            for (int i = 0; i < glyphCount; i++) {
                bounds.add(new Bounds(coder));
            }

            final int kerningCount = coder.readUnsignedShort();

            for (int i = 0; i < kerningCount; i++) {
                kernings.add(new Kerning(coder, context));
            }
        }

        context.remove(Context.WIDE_CODES);
        coder.check(length);
        coder.unmark();
    }

    /**
     * Creates a DefineFont2 object specifying only the name of the font.
     *
     * If none of the remaining attributes are set the Flash Player will load
     * the font from the system on which it is running or substitute a suitable
     * font if the specified font cannot be found. This is particularly useful
     * when defining fonts that will be used to display text in DefineTextField
     * objects.
     *
     * The font will be defined to use Unicode encoding. The flags which define
     * the font's face will be set to false. The lists of glyphs which define
     * the shapes and the code which map the character codes to a particular
     * glyph will remain empty since the font is loaded from the system on which
     * it is displayed.
     *
     * @param uid
     *            the unique identifier for this font object.
     * @param fontName
     *            the name of the font.
     */
    public DefineFont3(final int uid, final String fontName) {
FileLine
com\flagstone\transform\font\FontInfo.java126
com\flagstone\transform\font\FontInfo2.java122
        codes = new ArrayList<Integer>();

        identifier = coder.readUnsignedShort();
        final int nameLength = coder.readByte();
        name = coder.readString(nameLength);

        if (name.length() > 0) {
            while (name.charAt(name.length() - 1) == 0) {
                name = name.substring(0, name.length() - 1);
            }
        }

        final int bits = coder.readByte();
        small = (bits & Coder.BIT5) != 0;
        // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
        encoding = (bits >> 3) & Coder.LOWEST3;
        italic = (bits & Coder.BIT2) != 0;
        bold = (bits & Coder.BIT1) != 0;
FileLine
com\flagstone\transform\util\image\PNGDecoder.java780
com\flagstone\transform\util\image\PNGDecoder.java897
    private void decodeAlphaTrueColour(final BigDecoder coder, final int row,
            final int col) throws IOException, DataFormatException {
        int pixel = 0;
        byte colour = 0;

        final int index = row * (width << 2) + (col << 2);

        for (int i = 0; i < colorComponents; i++) {
            if (bitDepth == DEPTH_8) {
                pixel = coder.readByte();
                colour = (byte) pixel;
            } else if (bitDepth == DEPTH_16) {
                pixel = coder.readUnsignedShort();
                colour = (byte) (pixel >> Coder.TO_LOWER_BYTE);
            } else {
                throw new DataFormatException(BAD_FORMAT);
            }

            image[index + i] = colour;
        }
FileLine
com\flagstone\transform\shape\DefineShape3.java115
com\flagstone\transform\shape\DefineShape4.java129
        int fillStyleCount = coder.readByte();

        if (fillStyleCount == EXTENDED) {
            fillStyleCount = coder.readUnsignedShort();
        }
        fillStyles = new ArrayList<FillStyle>();
        lineStyles = new ArrayList<LineStyle>();

        final SWFFactory<FillStyle> decoder = context.getRegistry()
                .getFillStyleDecoder();

        for (int i = 0; i < fillStyleCount; i++) {
            decoder.getObject(fillStyles, coder, context);
        }

        int lineStyleCount = coder.readByte();

        if (lineStyleCount == EXTENDED) {
            lineStyleCount = coder.readUnsignedShort();
        }

        for (int i = 0; i < lineStyleCount; i++) {
            lineStyles.add(new LineStyle2(coder, context));
FileLine
com\flagstone\transform\sound\SoundStreamHead.java421
com\flagstone\transform\sound\SoundStreamHead2.java435
        return new SoundStreamHead2(this);
    }

    @Override
    public String toString() {
        return String.format(FORMAT, format, playRate, playChannels,
                playSampleSize, streamRate, streamChannels, streamSampleSize,
                streamSampleCount, latency);
    }

    /** {@inheritDoc} */
    public int prepareToEncode(final Context context) {
        // CHECKSTYLE IGNORE MagicNumberCheck FOR NEXT 1 LINES
        length = 4;

        if ((format == 2) && (latency > 0)) {
            length += 2;
        }
        return (length > Coder.HEADER_LIMIT ? Coder.LONG_HEADER
                : Coder.SHORT_HEADER) + length;
    }

    /** {@inheritDoc} */
    public void encode(final SWFEncoder coder, final Context context)
            throws IOException {

        if (length > Coder.HEADER_LIMIT) {
            coder.writeShort((MovieTypes.SOUND_STREAM_HEAD_2
FileLine
com\flagstone\transform\Export.java129
com\flagstone\transform\SymbolClass.java119
    public SymbolClass add(final int uid, final String aString) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
             throw new IllegalArgumentRangeException(
                     1, Coder.USHORT_MAX, uid);
        }
        if (aString == null || aString.length() == 0) {
            throw new IllegalArgumentException();
        }
        objects.put(uid, aString);
        return this;
    }

    /**
     * Get the table that maps identifiers to actionscript 3 classes.
     * @return the table of identifiers and class names.
     */
    public Map<Integer, String> getObjects() {
        return objects;
    }

    /**
     * Set the table that maps identifiers to actionscript 3 classes.
     * @param aTable the table of identifiers and class names.
     */
    public void setObjects(final Map<Integer, String> aTable) {
        if (aTable == null) {
            throw new IllegalArgumentException();
        }
        objects = aTable;
    }

    /** {@inheritDoc} */
    public SymbolClass copy() {
FileLine
com\flagstone\transform\filter\BevelFilter.java117
com\flagstone\transform\filter\DropShadowFilter.java100
            case KNOCKOUT:
                mode = Coder.BIT6;
                break;
            case INNER:
                mode = Coder.BIT7;
                break;
            default:
                throw new IllegalArgumentException();
            }
            return this;
        }

        /**
         * Set the shadow angle in radians.
         * @param radians the angle.
         * @return this Builder.
         */
        public Builder setAngle(final float radians) {
            angle = (int) (radians * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the distance from the object that the shadow is displayed.
         * @param width the width of the shadow.
         * @return this Builder.
         */
        public Builder setDistance(final float width) {
            distance = (int) (width * Coder.SCALE_16);
            return this;
        }

        /**
         * Set the shadow strength.
         * @param weight the weight of the shadow.
         * @return this Builder.
         */
        public Builder setStrength(final float weight) {
            strength = (int) (weight * Coder.SCALE_8);
            return this;
        }

        /**
         * Set the number of passes for creating the blur.
         * @param count the number of blur passes.
         * @return this Builder.
         */
        public Builder setPasses(final int count) {
            passes = count;
            return this;
        }

        /**
         * Create a DropShadowFilter object using the parameters defined in the
         * Builder.
         * @return a DropShadowFilter object.
         */
        public DropShadowFilter build() {
FileLine
com\flagstone\transform\shape\DefineMorphShape.java429
com\flagstone\transform\shape\DefineMorphShape2.java468
        endEdgeBounds = rect;
    }

    /**
     * Sets the list of morph fill styles.
     *
     * @param list
     *            a list of MorphSolidFill, MorphBitmapFill and
     *            MorphGradientFill objects. Must not be null.
     */
    public void setFillStyles(final List<FillStyle> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        fillStyles = list;
    }

    /**
     * Sets the list of morph line styles.
     *
     * @param list
     *            a list of MorphLineStyle2 objects. Must not be null.
     */
    public void setLineStyles(final List<LineStyle> list) {
        if (list == null) {
            throw new IllegalArgumentException();
        }
        lineStyles = list;
    }

    /**
     * Sets the shape that will be displayed at the start of the morphing
     * process.
     *
     * @param aShape
     *            the shape at the start of the morphing process. Must not be
     *            null.
     */
    public void setShape(final Shape aShape) {
        if (aShape == null) {
            throw new IllegalArgumentException();
        }
        shape = aShape;
    }

    /**
     * Sets the shape that will be displayed at the end of the morphing process.
     *
     * @param aShape
     *            the shape at the end of the morphing process. Must not be
     *            null.
     */
    public void setEndShape(final Shape aShape) {
        if (aShape == null) {
            throw new IllegalArgumentException();
        }
        endShape = aShape;
    }

    /** {@inheritDoc} */
    public DefineMorphShape2 copy() {
FileLine
com\flagstone\transform\shape\ShapeStyle.java632
com\flagstone\transform\shape\ShapeStyle2.java599
            for (final LineStyle2 style : lineStyles) {
                style.encode(coder, context);
            }

            int numberOfFillBits = Coder.unsignedSize(fillStyles.size());
            int numberOfLineBits = Coder.unsignedSize(lineStyles.size());

            if (context.contains(Context.POSTSCRIPT)) {
                if (numberOfFillBits == 0) {
                    numberOfFillBits = 1;
                }

                if (numberOfLineBits == 0) {
                    numberOfLineBits = 1;
                }
            }

            coder.writeByte((numberOfFillBits << Coder.TO_UPPER_NIB)
                    | numberOfLineBits);

            // Update the stream with the new numbers of line and fill bits
            context.put(Context.FILL_SIZE, numberOfFillBits);
            context.put(Context.LINE_SIZE, numberOfLineBits);
        }
    }
}
FileLine
com\flagstone\transform\image\DefineJPEGImage3.java150
com\flagstone\transform\image\DefineJPEGImage4.java166
    }

    /**
     * Get the width of the image in pixels (not twips).
     *
     * @return the width of the image.
     */
    public int getWidth() {
        return width;
    }

    /**
     * Get the height of the image in pixels (not twips).
     *
     * @return the height of the image.
     */
    public int getHeight() {
        return height;
    }

    /**
     * Get a copy of the image.
     *
     * @return  a copy of the data.
     */
    public byte[] getImage() {
        return Arrays.copyOf(image, image.length);
    }

    /**
     * Get the alpha channel data.
     *
     * @return a copy of the alpha data.
     */
    public byte[] getAlpha() {
        return Arrays.copyOf(alpha, alpha.length);
    }

    /**
     * Sets the image data.
     *
     * @param bytes
     *            a list of bytes containing the image table. Must not be
     *            null.
     */
    public void setImage(final byte[] bytes) {
        image = Arrays.copyOf(bytes, bytes.length);
        decodeInfo();
    }

    /**
     * Sets the alpha channel data with the zlib compressed data.
     *
     * @param bytes
     *            array of bytes containing zlib encoded alpha channel. Must not
     *            be null.
     */
    public void setAlpha(final byte[] bytes) {
        alpha = Arrays.copyOf(bytes, bytes.length);
    }

    /** {@inheritDoc} */
    public DefineJPEGImage4 copy() {
FileLine
com\flagstone\transform\text\DefineText.java190
com\flagstone\transform\text\DefineText2.java191
    public DefineText2(final DefineText2 object) {
        identifier = object.identifier;
        bounds = object.bounds;
        transform = object.transform;
        spans = new ArrayList<TextSpan>(object.spans.size());
        for (final TextSpan span : object.spans) {
            spans.add(span.copy());
        }
    }

    /** {@inheritDoc} */
    public int getIdentifier() {
        return identifier;
    }

    /** {@inheritDoc} */
    public void setIdentifier(final int uid) {
        if ((uid < 1) || (uid > Coder.USHORT_MAX)) {
            throw new IllegalArgumentRangeException(
                    1, Coder.USHORT_MAX, uid);
        }
        identifier = uid;
    }

    /**
     * Add a TextSpan object to the list of text spans.
     *
     * @param obj
     *            an TextSpan object. Must not be null.
     * @return this object.
     */
    public DefineText2 add(final TextSpan obj) {
FileLine
com\flagstone\transform\font\DefineFont2.java203
com\flagstone\transform\font\DefineFont3.java198
        for (int i = 0; i < glyphCount; i++) {
            shape = new Shape();
            shape.add(new ShapeData(offset[i + 1] - offset[i], coder));
            shapes.add(shape);
        }

        if (wideCodes) {
            for (int i = 0; i < glyphCount; i++) {
                codes.add(coder.readUnsignedShort());
            }
        } else {
            for (int i = 0; i < glyphCount; i++) {
                codes.add(coder.readByte());
            }
        }

        if (containsLayout || coder.bytesRead() < length) {
FileLine
com\flagstone\transform\font\DefineFont2.java393
com\flagstone\transform\font\FontInfo2.java211
    }

    /**
     * Get the encoding scheme used for characters rendered in the font,
     * either ASCII, SJIS or UCS2.
     *
     * @return the encoding used for the character codes.
     */
    public CharacterFormat getEncoding() {
        CharacterFormat value;
        switch(encoding) {
        case 0:
            value = CharacterFormat.UCS2;
            break;
        case 1:
            value = CharacterFormat.ANSI;
            break;
        case 2:
            value = CharacterFormat.SJIS;
            break;
        default:
            throw new IllegalStateException();
        }
        return value;
    }

    /**
     * Does the font have a small point size. This is used only with a Unicode
     * font encoding.
     *
     * @return true if the font is small.
     */
    public boolean isSmall() {
        return small;
    }

    /**
     * Sets the font is small. Used only with Unicode fonts.
     *
     * @param aBool
     *            a boolean flag indicating the font will be aligned on pixel
     *            boundaries.
     */
    public void setSmall(final boolean aBool) {
        small = aBool;
    }

    /**
     * Is the font style italics.
     *
     * @return true if the font is in italics.
     */
    public boolean isItalic() {
        return italic;
    }

    /**
     * Is the font weight bold.
     *
     * @return true if the font weight is bold.
     */
    public boolean isBold() {
        return bold;
    }

    /**
     * Returns the language code identifying the type of spoken language for the
     * font.
     *
     * @return the Language used to determine how line-breaks are inserted
     *         into text rendered using the font. Returns NONE if the object was
     *         decoded from a movie contains Flash 5 or less.
     */
    public Language getLanguage() {
        return Language.fromInt(language);
    }

    /**
     * Get the list of character codes.
     *
     * @return the list of character codes defined in the font.
     */
    public List<Integer> getCodes() {
FileLine
com\flagstone\transform\shape\DefineShape3.java137
com\flagstone\transform\shape\DefineShape4.java151
            lineStyles.add(new LineStyle2(coder, context));
        }

        context.put(Context.ARRAY_EXTENDED, 1);

        if (context.getRegistry().getShapeDecoder() == null) {
            shape = new Shape();
            shape.add(new ShapeData(length - coder.bytesRead(), coder));
        } else {
            shape = new Shape(coder, context);
        }

        context.remove(Context.TRANSPARENT);
        context.remove(Context.ARRAY_EXTENDED);
        context.remove(Context.TYPE);
        coder.check(length);
        coder.unmark();
    }

    /**
     * Creates a DefineShape3 object.
     *
     * @param uid
     *            the unique identifier for the shape in the range 1..65535.
     * @param rect
     *            the bounding rectangle for the shape including the width of
     *            the border lines. Must not be null.
     * @param edges
     *            the bounding rectangle for the shape excluding the line used
     *            to draw the border. Must not be null.
     * @param fills
     *            the list of fill styles used in the shape. Must not be null.
     * @param lines
     *            the list of line styles used in the shape. Must not be null.
     * @param aShape
     *            the shape to be drawn. Must not be null.
     */
    public DefineShape4(final int uid, final Bounds rect, final Bounds edges,
FileLine
com\flagstone\transform\Export.java73
com\flagstone\transform\SymbolClass.java68
    public SymbolClass(final SWFDecoder coder) throws IOException {
        length = coder.readUnsignedShort() & Coder.LENGTH_FIELD;
        if (length == Coder.IS_EXTENDED) {
            length = coder.readInt();
        }
        coder.mark();
        final int count = coder.readUnsignedShort();
        objects = new LinkedHashMap<Integer, String>(count);
        for (int i = 0; i < count; i++) {
            objects.put(coder.readUnsignedShort(), coder.readString());
        }
        coder.check(length);
        coder.unmark();
    }

    /**
     * Creates a SymbolClass object with an empty table.
     */
    public SymbolClass() {
FileLine
com\flagstone\transform\shape\DefineMorphShape.java523
com\flagstone\transform\shape\DefineShape3.java369
        length += (fillStyles.size() >= EXTENDED) ? EXTENDED_LENGTH : 1;

        for (final FillStyle style : fillStyles) {
            length += style.prepareToEncode(context);
        }

        length += (lineStyles.size() >= EXTENDED) ? EXTENDED_LENGTH : 1;

        for (final LineStyle style : lineStyles) {
            length += style.prepareToEncode(context);
        }

        context.put(Context.ARRAY_EXTENDED, 1);
        context.put(Context.FILL_SIZE, fillBits);
        context.put(Context.LINE_SIZE, lineBits);

        length += shape.prepareToEncode(context);
FileLine
com\flagstone\transform\shape\DefineShape2.java350
com\flagstone\transform\shape\DefineShape3.java340
        return new DefineShape3(this);
    }

    @Override
    public String toString() {
        return String.format(FORMAT, identifier, bounds, fillStyles,
                lineStyles, shape);
    }

    /** {@inheritDoc} */
    @SuppressWarnings("PMD.NPathComplexity")
    public int prepareToEncode(final Context context) {
        fillBits = Coder.unsignedSize(fillStyles.size());
        lineBits = Coder.unsignedSize(lineStyles.size());

        if (context.contains(Context.POSTSCRIPT)) {
            if (fillBits == 0) {
                fillBits = 1;
            }

            if (lineBits == 0) {
                lineBits = 1;
            }
        }
FileLine
com\flagstone\transform\filter\GradientBevelFilter.java356
com\flagstone\transform\filter\GradientGlowFilter.java356
            filter = (GradientGlowFilter) object;
            result = gradients.equals(filter.gradients)
                    && (blurX == filter.blurX) && (blurY == filter.blurY)
                    && (angle == filter.angle) && (distance == filter.distance)
                    && (strength == filter.strength) && (mode == filter.mode)
                    && (passes == filter.passes);
        } else {
            result = false;
        }
        return result;
    }

    @Override
    public int hashCode() {
        return (((((((gradients.hashCode() * Constants.PRIME)
FileLine
com\flagstone\transform\util\image\BufferedImageDecoder.java176
com\flagstone\transform\util\image\BufferedImageDecoder.java231
            object = new DefineImage2(identifier, width, height, table.length,
                    zip(mergeAlpha(adjustScan(width, height, image), table)));
            break;
        case RGB5:
            object = new DefineImage(identifier, width, height,
                    zip(packColours(width, height, image)), RGB5_SIZE);
            break;
        case RGB8:
            orderAlpha(image);
            object = new DefineImage(identifier, width, height, zip(image),
                    RGB8_SIZE);
            break;
        case RGBA:
            applyAlpha(image);
            object = new DefineImage2(identifier, width, height, zip(image));
            break;
        default:
            throw new DataFormatException(BAD_FORMAT);
FileLine
com\flagstone\transform\Place2.java753
com\flagstone\transform\Place3.java830
        if ((type == PlaceType.NEW) || (type == PlaceType.REPLACE)) {
            coder.writeShort(identifier);
        }
        if (transform != null) {
            transform.encode(coder, context);
        }
        if (colorTransform != null) {
            colorTransform.encode(coder, context);
        }
        if (ratio != null) {
            coder.writeShort(ratio);
        }
        if (name != null) {
            coder.writeString(name);
        }

        if (depth != null) {
            coder.writeShort(depth);
        }

        if (hasFilters) {