//# 5 errors, 604 messages
//#
/*
    //#Styliser.java:1:1: class: com.dmdirc.ui.messages.Styliser$1
    //#Styliser.java:1:1: method: com.dmdirc.ui.messages.Styliser$1.com.dmdirc.ui.messages.Styliser$1__static_init
    //#Styliser.java:1:1: class: com.dmdirc.ui.messages.Styliser
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.ui.messages;

import com.dmdirc.actions.ActionManager;
import com.dmdirc.actions.CoreActionType;
import com.dmdirc.interfaces.ConfigChangeListener;
import com.dmdirc.config.IdentityManager;
import com.dmdirc.logger.ErrorLevel;
import com.dmdirc.logger.Logger;

import java.awt.Color;
import java.util.Locale;

import javax.swing.UIManager;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;

/**
 * The styliser applies IRC styles to text. Styles are indicated by various
 * control codes which are a de-facto IRC standard.
 * @author chris
 */
public final class Styliser {
    //#Styliser.java:47: method: bool com.dmdirc.ui.messages.Styliser.access$002(bool)
    //#input(bool access$002(bool)): x0
    //#output(bool access$002(bool)): return_value
    //#output(bool access$002(bool)): styleLinks
    //#post(bool access$002(bool)): return_value == x0
    //#post(bool access$002(bool)): init'ed(return_value)
    //#post(bool access$002(bool)): styleLinks == return_value
    //#Styliser.java:47: end of method: bool com.dmdirc.ui.messages.Styliser.access$002(bool)
    
    /** The character used for marking up bold text. */
    public static final char CODE_BOLD = 2;
    /** The character used for marking up coloured text. */
    public static final char CODE_COLOUR = 3;
    /** The character used for marking up coloured text (using hex). */
    public static final char CODE_HEXCOLOUR = 4;
    /** Character used to indicate hyperlinks. */
    public static final char CODE_HYPERLINK = 5;
    /** Character used to indicate channel links. */
    public static final char CODE_CHANNEL = 6;
    /** Character used to indicate smilies. */
    public static final char CODE_SMILIE = 7;
    /** The character used for stopping all formatting. */
    public static final char CODE_STOP = 15;
    /** Character used to indicate nickname links. */
    public static final char CODE_NICKNAME = 16;
    /** The character used for marking up fixed pitch text. */
    public static final char CODE_FIXED = 17;
    /** The character used for negating control codes. */
    public static final char CODE_NEGATE = 18;    
    /** The character used for marking up italic text. */
    public static final char CODE_ITALIC = 29;
    /** The character used for marking up underlined text. */
    public static final char CODE_UNDERLINE = 31;
    
    /** Internal chars. */
    private static final String INTERNAL_CHARS = String.valueOf(CODE_HYPERLINK)
    //#Styliser.java:75: method: com.dmdirc.ui.messages.Styliser.com.dmdirc.ui.messages.Styliser__static_init
    //#output(com.dmdirc.ui.messages.Styliser__static_init): INTERNAL_CHARS
    //#output(com.dmdirc.ui.messages.Styliser__static_init): __Descendant_Table[com/dmdirc/ui/messages/Styliser]
    //#output(com.dmdirc.ui.messages.Styliser__static_init): java.lang.StringBuilder:toString(...)._tainted
    //#output(com.dmdirc.ui.messages.Styliser__static_init): styleLinks
    //#new obj(com.dmdirc.ui.messages.Styliser__static_init): java.lang.StringBuilder:toString(...)
    //#presumption(com.dmdirc.ui.messages.Styliser__static_init): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@127 != null
    //#presumption(com.dmdirc.ui.messages.Styliser__static_init): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@131 != null
    //#post(com.dmdirc.ui.messages.Styliser__static_init): INTERNAL_CHARS == &java.lang.StringBuilder:toString(...)
    //#post(com.dmdirc.ui.messages.Styliser__static_init): __Descendant_Table[com/dmdirc/ui/messages/Styliser] == &__Dispatch_Table
    //#post(com.dmdirc.ui.messages.Styliser__static_init): java.lang.StringBuilder:toString(...)._tainted == 0
    //#post(com.dmdirc.ui.messages.Styliser__static_init): init'ed(styleLinks)
            + CODE_NICKNAME + CODE_CHANNEL + CODE_SMILIE;
    
    /** Regexp to match characters which shouldn't be used in channel links. */
    private static final String RESERVED_CHARS = "[^\\s" + CODE_BOLD + CODE_COLOUR
            + CODE_STOP + CODE_HEXCOLOUR + CODE_FIXED + CODE_ITALIC
            + CODE_UNDERLINE + CODE_CHANNEL + CODE_NICKNAME + CODE_NEGATE + "\"]";
    
    /** Defines all characters treated as trailing punctuation that are illegal in URLs. */
    private static final String URL_PUNCT_ILLEGAL = "\"";
    
    /** Defines all characters treated as trailing punctuation that're legal in URLs. */
    private static final String URL_PUNCT_LEGAL = "';:!,\\.\\?";
    
    /** Defines all trailing punctuation. */
    private static final String URL_PUNCT = URL_PUNCT_ILLEGAL + URL_PUNCT_LEGAL;

    /** Defines all characters allowed in URLs that aren't treated as trailing punct. */
    private static final String URL_NOPUNCT = "a-z0-9$\\-_@&\\+\\*\\(\\)=/#%~";

    /** Defines all characters allowed in URLs per W3C specs. */
    private static final String URL_CHARS = "[" + URL_PUNCT_LEGAL + URL_NOPUNCT
            + "]*[" + URL_NOPUNCT + "]+[" + URL_PUNCT_LEGAL + URL_NOPUNCT + "]*";

    /** The regular expression to use for marking up URLs. */
    private static final String URL_REGEXP = "(?i)([a-z+]+://" + URL_CHARS
            + "|(?<![a-z0-9:/])www\\." + URL_CHARS + ")";
    
    /** Regular expression for intelligent handling of closing brackets. */
    private static final String URL_INT1 = "(\\([^\\)" + CODE_HYPERLINK
            + "]*(?:" + CODE_HYPERLINK + "[^" + CODE_HYPERLINK + "]*"
            + CODE_HYPERLINK + ")?[^\\)" + CODE_HYPERLINK + "]*" + CODE_HYPERLINK
            + "[^" + CODE_HYPERLINK + "]+)(\\)['\";:!,\\.\\)]*)" + CODE_HYPERLINK;
    
    /** Regular expression for intelligent handling of trailing single and double quotes. */
    private static final String URL_INT2 = "(^(?:[^" + CODE_HYPERLINK + "]+|"
            + CODE_HYPERLINK + "[^" + CODE_HYPERLINK + "]" + CODE_HYPERLINK + "))(['\"])([^"
            + CODE_HYPERLINK + "]*?" + CODE_HYPERLINK + "[^" + CODE_HYPERLINK
            + "]+)(\\1[" + URL_PUNCT + "]*)" + CODE_HYPERLINK;
    
    /** Regular expression for intelligent handling of surrounding quotes. */
    private static final String URL_INT3 = "(['\"])(" + CODE_HYPERLINK
            + "[^" + CODE_HYPERLINK + "]+?)(\\1[^" + CODE_HYPERLINK + "]*)" + CODE_HYPERLINK;
    
    /** Regular expression for intelligent handling of trailing punctuation. */
    private static final String URL_INT4 = "(" + CODE_HYPERLINK
            + "[^" + CODE_HYPERLINK + "]+?)([" + URL_PUNCT + "]?)" + CODE_HYPERLINK;
    
    /** The regular expression to use for marking up channels. */
    private static final String URL_CHANNEL = "(?i)(?<![^\\s])([#&]" + RESERVED_CHARS + "+)";
    
    /** Whether or not we should style links. */
    private static boolean styleLinks
    //#Styliser.java:127: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: com.dmdirc.ui.messages.Styliser__static_init
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#Styliser.java:127: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: com.dmdirc.ui.messages.Styliser__static_init
    //#    unanalyzed callee: bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
            = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
    
    static {
        IdentityManager.getGlobalConfig().addChangeListener("ui", "stylelinks",
    //#Styliser.java:131: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: com.dmdirc.ui.messages.Styliser__static_init
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#Styliser.java:131: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.config.ConfigManager:addChangeListener(String, String, ConfigChangeListener)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: com.dmdirc.ui.messages.Styliser__static_init
    //#    unanalyzed callee: void com.dmdirc.config.ConfigManager:addChangeListener(String, String, ConfigChangeListener)
                new ConfigChangeListener() {
    //#Styliser.java:132: method: void com.dmdirc.ui.messages.Styliser$1.com.dmdirc.ui.messages.Styliser$1()
    //#Styliser.java:132: end of method: void com.dmdirc.ui.messages.Styliser$1.com.dmdirc.ui.messages.Styliser$1()
            @Override
            public void configChanged(final String domain, final String key) {
                Styliser.styleLinks
    //#Styliser.java:135: method: void com.dmdirc.ui.messages.Styliser$1.configChanged(String, String)
    //#Styliser.java:135: Warning: method not available - call not analyzed
    //#    call on ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser$1
    //#    method: void configChanged(String, String)
    //#    unanalyzed callee: ConfigManager com.dmdirc.config.IdentityManager:getGlobalConfig()
    //#Styliser.java:135: Warning: method not available - call not analyzed
    //#    call on bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser$1
    //#    method: void configChanged(String, String)
    //#    unanalyzed callee: bool com.dmdirc.config.ConfigManager:getOptionBool(String, String)
    //#output(void configChanged(String, String)): com/dmdirc/ui/messages/Styliser.styleLinks
    //#presumption(void configChanged(String, String)): com.dmdirc.config.IdentityManager:getGlobalConfig(...)@135 != null
    //#post(void configChanged(String, String)): init'ed(com/dmdirc/ui/messages/Styliser.styleLinks)
                        = IdentityManager.getGlobalConfig().getOptionBool("ui", "stylelinks");
            }
    //#Styliser.java:137: end of method: void com.dmdirc.ui.messages.Styliser$1.configChanged(String, String)
        });
    }
    //#Styliser.java:139: end of method: com.dmdirc.ui.messages.Styliser.com.dmdirc.ui.messages.Styliser__static_init
    
    /** Creates a new instance of Styliser. */
    private Styliser() {
    //#Styliser.java:142: method: void com.dmdirc.ui.messages.Styliser.com.dmdirc.ui.messages.Styliser()
    }
    //#Styliser.java:143: end of method: void com.dmdirc.ui.messages.Styliser.com.dmdirc.ui.messages.Styliser()
    
    /**
     * Stylises the specified strings and adds them to the specified document.
     *
     * @param styledDoc Document to add the styled strings to
     * @param strings The lines to be stylised
     */
    public static void addStyledString(final StyledDocument styledDoc, final String[] strings) {
        for (int i = 0; i < strings.length; i++) {
    //#Styliser.java:152: method: void com.dmdirc.ui.messages.Styliser.addStyledString(StyledDocument, String[])
    //#input(void addStyledString(StyledDocument, String[])): "#"._tainted
    //#input(void addStyledString(StyledDocument, String[])): "Invalid colour #"._tainted
    //#input(void addStyledString(StyledDocument, String[])): "Invalid colour format: "._tainted
    //#input(void addStyledString(StyledDocument, String[])): "Invalid colour: "._tainted
    //#input(void addStyledString(StyledDocument, String[])): "Unable to insert styled string: "._tainted
    //#input(void addStyledString(StyledDocument, String[])): "smilie-"._tainted
    //#input(void addStyledString(StyledDocument, String[])): INTERNAL_CHARS
    //#input(void addStyledString(StyledDocument, String[])): com.dmdirc.actions.CoreActionType.CLIENT_STRING_STYLED
    //#input(void addStyledString(StyledDocument, String[])): com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/IRCTextAttribute.CHANNEL
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/IRCTextAttribute.HYPERLINK
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/IRCTextAttribute.NICKNAME
    //#input(void addStyledString(StyledDocument, String[])): com/dmdirc/ui/messages/IRCTextAttribute.SMILEY
    //#input(void addStyledString(StyledDocument, String[])): java.awt.Color.BLUE
    //#input(void addStyledString(StyledDocument, String[])): java.lang.Boolean.TRUE
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants$FontConstants.Bold
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants$FontConstants.FontFamily
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants$FontConstants.Foreground
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants$FontConstants.Italic
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants.Background
    //#input(void addStyledString(StyledDocument, String[])): javax.swing.text.StyleConstants.Foreground
    //#input(void addStyledString(StyledDocument, String[])): strings
    //#input(void addStyledString(StyledDocument, String[])): strings.length
    //#input(void addStyledString(StyledDocument, String[])): strings[0..4_294_967_295]
    //#input(void addStyledString(StyledDocument, String[])): styleLinks
    //#input(void addStyledString(StyledDocument, String[])): styledDoc
    //#pre[4] (void addStyledString(StyledDocument, String[])): strings != null
    //#pre[5] (void addStyledString(StyledDocument, String[])): strings.length <= 4_294_967_295
    //#pre[1] (void addStyledString(StyledDocument, String[])): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[2] (void addStyledString(StyledDocument, String[])): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[3] (void addStyledString(StyledDocument, String[])): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#pre[6] (void addStyledString(StyledDocument, String[])): (soft) strings[0..4_294_967_295] != null
    //#pre[7] (void addStyledString(StyledDocument, String[])): (soft) init'ed(styleLinks)
    //#pre[8] (void addStyledString(StyledDocument, String[])): (soft) styledDoc != null
    //#presumption(void addStyledString(StyledDocument, String[])): chars.length@153 <= 4_294_967_295
    //#presumption(void addStyledString(StyledDocument, String[])): init'ed(com.dmdirc.actions.CoreActionType.CLIENT_STRING_STYLED)
    //#presumption(void addStyledString(StyledDocument, String[])): init'ed(com.dmdirc.logger.ErrorLevel.MEDIUM)
    //#presumption(void addStyledString(StyledDocument, String[])): javax.swing.text.StyledDocument:getLength(...)@187 - javax.swing.text.StyledDocument:getLength(...)@162 in {-2_147_483_648..4_294_967_295}
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:matches
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:containsAttribute
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:removeAttribute
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:addAttribute
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:getAttribute
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:isDefined
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.util.Locale:getDefault
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:toUpperCase
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(void addStyledString(StyledDocument, String[])): Effects-of-calling:java.lang.String:valueOf
            final char[] chars = strings[i].toCharArray();
            
            for (int j = 0; j < chars.length; j++) {
                if (chars[j] == 65533) {
                    chars[j] = '?';
                }
            }

            try {
                final int ooffset = styledDoc.getLength();
                int offset = ooffset;
                int position = 0;
                
                String target = doSmilies(doLinks(new String(chars).replaceAll(INTERNAL_CHARS, "")));
                
                target = target.replaceAll(URL_CHANNEL, CODE_CHANNEL + "$0" + CODE_CHANNEL);
                
                final SimpleAttributeSet attribs = new SimpleAttributeSet();
                attribs.addAttribute("DefaultFontFamily", UIManager.getFont("TextPane.font"));
                
                while (position < target.length()) {
                    final String next = readUntilControl(target.substring(position));
                    
                    styledDoc.insertString(offset, next, attribs);
                    
                    position += next.length();
    //#Styliser.java:178: ?overflow
    //#    position + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: void addStyledString(StyledDocument, String[])
    //#    basic block: bb_11
    //#    assertion: position + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    VN: java.lang.String:length(...)@178 + position
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..8_589_934_589}
    //#    Attribs:  Int  Bad > Exp
                    offset += next.length();
    //#Styliser.java:179: ?overflow
    //#    offset + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: void addStyledString(StyledDocument, String[])
    //#    basic block: bb_11
    //#    assertion: offset + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    VN: java.lang.String:length(...)@179 + offset
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..8_589_934_590}
    //#    Attribs:  Int  Bad > Exp
                    
                    if (position < target.length()) {
                        position += readControlChars(target.substring(position),
    //#Styliser.java:182: ?overflow
    //#    position + readControlChars(...) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: void addStyledString(StyledDocument, String[])
    //#    basic block: bb_15
    //#    assertion: position + readControlChars(...) in {-2_147_483_648..4_294_967_295}
    //#    VN: java.lang.String:length(...)@178 + position + readControlChars(...)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..4_294_967_308}
    //#    Attribs:  Int  Bad > Exp
                                attribs, position == 0);
                    }
                }

                ActionManager.processEvent(CoreActionType.CLIENT_STRING_STYLED,
    //#Styliser.java:187: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.actions.ActionManager:processEvent(ActionType, StringBuffer, Object[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: void addStyledString(StyledDocument, String[])
    //#    unanalyzed callee: void com.dmdirc.actions.ActionManager:processEvent(ActionType, StringBuffer, Object[])
                        null, styledDoc, ooffset, styledDoc.getLength() - ooffset);
                
            } catch (BadLocationException ex) {
                Logger.userError(ErrorLevel.MEDIUM,
    //#Styliser.java:191: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.logger.Logger:userError(ErrorLevel, String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: void addStyledString(StyledDocument, String[])
    //#    unanalyzed callee: void com.dmdirc.logger.Logger:userError(ErrorLevel, String)
                        "Unable to insert styled string: " + ex.getMessage());
            }
        }
    }
    //#Styliser.java:195: end of method: void com.dmdirc.ui.messages.Styliser.addStyledString(StyledDocument, String[])
    
    /**
     * Stylises the specified string.
     *
     * @param strings The line to be stylised
     *
     * @return StyledDocument for the inputted strings
     */
    public static StyledDocument getStyledString(final String[] strings) {
        final StyledDocument styledDoc = new DefaultStyledDocument();
    //#Styliser.java:205: method: StyledDocument com.dmdirc.ui.messages.Styliser.getStyledString(String[])
    //#input(StyledDocument getStyledString(String[])): "#"._tainted
    //#input(StyledDocument getStyledString(String[])): "Invalid colour #"._tainted
    //#input(StyledDocument getStyledString(String[])): "Invalid colour format: "._tainted
    //#input(StyledDocument getStyledString(String[])): "Invalid colour: "._tainted
    //#input(StyledDocument getStyledString(String[])): "Unable to insert styled string: "._tainted
    //#input(StyledDocument getStyledString(String[])): "smilie-"._tainted
    //#input(StyledDocument getStyledString(String[])): INTERNAL_CHARS
    //#input(StyledDocument getStyledString(String[])): com.dmdirc.actions.CoreActionType.CLIENT_STRING_STYLED
    //#input(StyledDocument getStyledString(String[])): com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/IRCTextAttribute.CHANNEL
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/IRCTextAttribute.HYPERLINK
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/IRCTextAttribute.NICKNAME
    //#input(StyledDocument getStyledString(String[])): com/dmdirc/ui/messages/IRCTextAttribute.SMILEY
    //#input(StyledDocument getStyledString(String[])): java.awt.Color.BLUE
    //#input(StyledDocument getStyledString(String[])): java.lang.Boolean.TRUE
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants$FontConstants.Bold
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants$FontConstants.FontFamily
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants$FontConstants.Foreground
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants$FontConstants.Italic
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants.Background
    //#input(StyledDocument getStyledString(String[])): javax.swing.text.StyleConstants.Foreground
    //#input(StyledDocument getStyledString(String[])): strings
    //#input(StyledDocument getStyledString(String[])): strings.length
    //#input(StyledDocument getStyledString(String[])): strings[0..4_294_967_295]
    //#input(StyledDocument getStyledString(String[])): styleLinks
    //#output(StyledDocument getStyledString(String[])): new DefaultStyledDocument(getStyledString#1) num objects
    //#output(StyledDocument getStyledString(String[])): return_value
    //#new obj(StyledDocument getStyledString(String[])): new DefaultStyledDocument(getStyledString#1)
    //#pre[4] (StyledDocument getStyledString(String[])): strings != null
    //#pre[5] (StyledDocument getStyledString(String[])): strings.length <= 4_294_967_295
    //#pre[1] (StyledDocument getStyledString(String[])): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[2] (StyledDocument getStyledString(String[])): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[3] (StyledDocument getStyledString(String[])): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#pre[6] (StyledDocument getStyledString(String[])): (soft) strings[0..4_294_967_295] != null
    //#pre[7] (StyledDocument getStyledString(String[])): (soft) init'ed(styleLinks)
    //#post(StyledDocument getStyledString(String[])): return_value == &new DefaultStyledDocument(getStyledString#1)
    //#post(StyledDocument getStyledString(String[])): new DefaultStyledDocument(getStyledString#1) num objects == 1
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:matches
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:length
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:containsAttribute
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:removeAttribute
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:addAttribute
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:getAttribute
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet:isDefined
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.util.Map:get
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.util.Map:put
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.util.Locale:getDefault
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:toUpperCase
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:valueOf
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String:toCharArray
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.StyledDocument:getLength
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.String
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.SimpleAttributeSet
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.UIManager:getFont
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.StyledDocument:insertString
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:java.lang.Integer:valueOf
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:com.dmdirc.actions.ActionManager:processEvent
    //#unanalyzed(StyledDocument getStyledString(String[])): Effects-of-calling:javax.swing.text.BadLocationException:getMessage
        
        addStyledString(styledDoc, strings);
        
        return styledDoc;
    //#Styliser.java:209: end of method: StyledDocument com.dmdirc.ui.messages.Styliser.getStyledString(String[])
    }
    
    /**
     * Applies the hyperlink styles and intelligent linking regexps to the
     * target.
     *
     * @param string The string to be linked
     * @return A copy of the string with hyperlinks marked up
     */
    public static String doLinks(final String string) {
        String target = string;
    //#Styliser.java:220: method: String com.dmdirc.ui.messages.Styliser.doLinks(String)
    //#input(String doLinks(String)): string
    //#output(String doLinks(String)): return_value
    //#pre[1] (String doLinks(String)): string != null
    //#post(String doLinks(String)): return_value != null
    //#test_vector(String doLinks(String)): java.lang.String:equals(...)@226: {1}, {0}
    //#test_vector(String doLinks(String)): java.lang.String:matches(...)@222: {0}, {1}
        
        if (target.matches(".*" + URL_REGEXP + ".*")) {
            target = target.replaceAll(URL_REGEXP, CODE_HYPERLINK + "$0" + CODE_HYPERLINK);
            String target2 = "";
            
            for (int j = 0; j < 5 && !target.equals(target2); j++) {
                target2 = target;
                target = target
                        .replaceAll(URL_INT1, "$1" + CODE_HYPERLINK + "$2")
                        .replaceAll(URL_INT2, "$1$2$3" + CODE_HYPERLINK + "$4")
                        .replaceAll(URL_INT3, "$1$2" + CODE_HYPERLINK + "$3")
                        .replaceAll(URL_INT4, "$1" + CODE_HYPERLINK + "$2");
            }
        }
        
        return target;
    //#Styliser.java:236: end of method: String com.dmdirc.ui.messages.Styliser.doLinks(String)
    }

    /**
     * Applies the smilie styles to the target.
     *
     * @param string The string to be smilified
     * @return A copy of the string with smilies marked up
     * @since 0.6.3m1
     */
    public static String doSmilies(final String string) {
        // TODO: read types from config. Check if they're enabled.

        return string.replaceAll("(\\s|^):[\\\\/](?=\\s|$)", "$1" + CODE_SMILIE + ":/"
    //#Styliser.java:249: method: String com.dmdirc.ui.messages.Styliser.doSmilies(String)
    //#input(String doSmilies(String)): string
    //#output(String doSmilies(String)): return_value
    //#pre[1] (String doSmilies(String)): string != null
    //#post(String doSmilies(String)): return_value != null
    //#Styliser.java:249: end of method: String com.dmdirc.ui.messages.Styliser.doSmilies(String)
                + CODE_SMILIE);
    }
    
    /**
     * Strips all recognised control codes from the input string.
     * @param input the String to be stripped
     * @return a copy of the input with control codes removed
     */
    public static String stipControlCodes(final String input) {
        int position = 0;
    //#Styliser.java:259: method: String com.dmdirc.ui.messages.Styliser.stipControlCodes(String)
    //#input(String stipControlCodes(String)): ""._tainted
    //#input(String stipControlCodes(String)): "#"._tainted
    //#input(String stipControlCodes(String)): "Invalid colour #"._tainted
    //#input(String stipControlCodes(String)): "Invalid colour format: "._tainted
    //#input(String stipControlCodes(String)): "Invalid colour: "._tainted
    //#input(String stipControlCodes(String)): "smilie-"._tainted
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/IRCTextAttribute.CHANNEL
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/IRCTextAttribute.HYPERLINK
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/IRCTextAttribute.NICKNAME
    //#input(String stipControlCodes(String)): com/dmdirc/ui/messages/IRCTextAttribute.SMILEY
    //#input(String stipControlCodes(String)): input
    //#input(String stipControlCodes(String)): input._tainted
    //#input(String stipControlCodes(String)): java.awt.Color.BLUE
    //#input(String stipControlCodes(String)): java.lang.Boolean.TRUE
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants$FontConstants.Bold
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants$FontConstants.FontFamily
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants$FontConstants.Foreground
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants$FontConstants.Italic
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants.Background
    //#input(String stipControlCodes(String)): javax.swing.text.StyleConstants.Foreground
    //#input(String stipControlCodes(String)): styleLinks
    //#output(String stipControlCodes(String)): java.lang.String:concat(...)._tainted
    //#output(String stipControlCodes(String)): return_value
    //#new obj(String stipControlCodes(String)): java.lang.String:concat(...)
    //#pre[4] (String stipControlCodes(String)): input != null
    //#pre[1] (String stipControlCodes(String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[2] (String stipControlCodes(String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[3] (String stipControlCodes(String)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#pre[6] (String stipControlCodes(String)): (soft) init'ed(styleLinks)
    //#post(String stipControlCodes(String)): init'ed(java.lang.String:concat(...)._tainted)
    //#post(String stipControlCodes(String)): return_value in Addr_Set{&"",&java.lang.String:concat(...)}
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:containsAttribute
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:removeAttribute
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:addAttribute
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:getAttribute
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:isDefined
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.util.Locale:getDefault
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:toUpperCase
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:charAt
    //#unanalyzed(String stipControlCodes(String)): Effects-of-calling:java.lang.String:valueOf
        String output = "";
        
        while (position < input.length()) {
            final String next = readUntilControl(input.substring(position));
            
            output = output.concat(next);
            
            position += next.length();
    //#Styliser.java:267: ?overflow
    //#    position + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: String stipControlCodes(String)
    //#    basic block: bb_3
    //#    assertion: position + java/lang/String:length(...) in {-2_147_483_648..4_294_967_295}
    //#    VN: java.lang.String:length(...)@267 + position
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..8_589_934_589}
    //#    Attribs:  Int  Bad > Exp
            
            if (position < input.length()) {
                position += readControlChars(input.substring(position),
    //#Styliser.java:270: ?overflow
    //#    position + readControlChars(...) in {-2_147_483_648..4_294_967_295}
    //#    severity: SUPPRESSED
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: String stipControlCodes(String)
    //#    basic block: bb_7
    //#    assertion: position + readControlChars(...) in {-2_147_483_648..4_294_967_295}
    //#    VN: java.lang.String:length(...)@267 + position + readControlChars(...)
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296..4_294_967_308}
    //#    Attribs:  Int  Bad > Exp
                        new SimpleAttributeSet(), position == 0);
            }
        }
        
        return output;
    //#Styliser.java:275: end of method: String com.dmdirc.ui.messages.Styliser.stipControlCodes(String)
    }
    
    /**
     * Returns a substring of the input string such that no control codes are present
     * in the output. If the returned value isn't the same as the input, then the
     * character immediately after is a control character.
     * @param input The string to read from
     * @return A substring of the input containing no control characters
     */
    static String readUntilControl(final String input) {
        int pos = input.length();
    //#Styliser.java:286: method: String com.dmdirc.ui.messages.Styliser.readUntilControl(String)
    //#input(String readUntilControl(String)): input
    //#input(String readUntilControl(String)): input._tainted
    //#output(String readUntilControl(String)): java.lang.String:substring(...)._tainted
    //#output(String readUntilControl(String)): return_value
    //#new obj(String readUntilControl(String)): java.lang.String:substring(...)
    //#pre[1] (String readUntilControl(String)): input != null
    //#post(String readUntilControl(String)): java.lang.String:substring(...)._tainted == input._tainted
    //#post(String readUntilControl(String)): init'ed(java.lang.String:substring(...)._tainted)
    //#post(String readUntilControl(String)): return_value == &java.lang.String:substring(...)
        
        pos = checkChar(pos, input.indexOf(CODE_BOLD));
        pos = checkChar(pos, input.indexOf(CODE_UNDERLINE));
        pos = checkChar(pos, input.indexOf(CODE_STOP));
        pos = checkChar(pos, input.indexOf(CODE_COLOUR));
        pos = checkChar(pos, input.indexOf(CODE_HEXCOLOUR));
        pos = checkChar(pos, input.indexOf(CODE_ITALIC));
        pos = checkChar(pos, input.indexOf(CODE_FIXED));
        pos = checkChar(pos, input.indexOf(CODE_HYPERLINK));
        pos = checkChar(pos, input.indexOf(CODE_NICKNAME));
        pos = checkChar(pos, input.indexOf(CODE_CHANNEL));
        pos = checkChar(pos, input.indexOf(CODE_SMILIE));
        pos = checkChar(pos, input.indexOf(CODE_NEGATE));
        
        return input.substring(0, pos);
    //#Styliser.java:301: end of method: String com.dmdirc.ui.messages.Styliser.readUntilControl(String)
    }
    
    /**
     * Helper function used in readUntilControl. Checks if i is a valid index of
     * the string (i.e., it's not -1), and then returns the minimum of pos and i.
     * @param pos The current position in the string
     * @param i The index of the first occurance of some character
     * @return The new position (see implementation)
     */
    private static int checkChar(final int pos, final int i) {
        if (i < pos && i != -1) { return i; }
    //#Styliser.java:312: method: int com.dmdirc.ui.messages.Styliser.checkChar(int, int)
    //#input(int checkChar(int, int)): i
    //#input(int checkChar(int, int)): pos
    //#output(int checkChar(int, int)): return_value
    //#post(int checkChar(int, int)): return_value == One-of{i, pos}
    //#post(int checkChar(int, int)): init'ed(return_value)
    //#test_vector(int checkChar(int, int)): i: {-1}, {-2_147_483_648..-2, 0..4_294_967_294}
    //#test_vector(int checkChar(int, int)): pos - i: {-6_442_450_943..0}, {1..4_294_967_296}
        return pos;
    //#Styliser.java:313: end of method: int com.dmdirc.ui.messages.Styliser.checkChar(int, int)
    }
    
    /**
     * Reads the first control character from the input string (and any arguments
     * it takes), and applies it to the specified attribute set.
     * @return The number of characters read as control characters
     * @param string The string to read from
     * @param attribs The attribute set that new attributes will be applied to
     * @param isStart Whether this is at the start of the string or not
     */
    private static int readControlChars(final String string,
            final SimpleAttributeSet attribs, final boolean isStart) {
        boolean isNegated = attribs.containsAttribute("NegateControl", Boolean.TRUE);
    //#Styliser.java:326: method: int com.dmdirc.ui.messages.Styliser.readControlChars(String, SimpleAttributeSet, bool)
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): "#"._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): "Invalid colour #"._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): "Invalid colour format: "._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): "Invalid colour: "._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): "smilie-"._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): attribs
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/IRCTextAttribute.CHANNEL
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/IRCTextAttribute.HYPERLINK
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/IRCTextAttribute.NICKNAME
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): com/dmdirc/ui/messages/IRCTextAttribute.SMILEY
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): isStart
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): java.awt.Color.BLUE
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.Boolean.TRUE
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants$FontConstants.Bold
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants$FontConstants.FontFamily
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants$FontConstants.Foreground
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants$FontConstants.Italic
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants.Background
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.StyleConstants.Foreground
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): string
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): string._tainted
    //#input(int readControlChars(String, SimpleAttributeSet, bool)): styleLinks
    //#output(int readControlChars(String, SimpleAttributeSet, bool)): return_value
    //#pre[1] (int readControlChars(String, SimpleAttributeSet, bool)): attribs != null
    //#pre[6] (int readControlChars(String, SimpleAttributeSet, bool)): string != null
    //#pre[2] (int readControlChars(String, SimpleAttributeSet, bool)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[3] (int readControlChars(String, SimpleAttributeSet, bool)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[4] (int readControlChars(String, SimpleAttributeSet, bool)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#pre[8] (int readControlChars(String, SimpleAttributeSet, bool)): (soft) init'ed(styleLinks)
    //#presumption(int readControlChars(String, SimpleAttributeSet, bool)): init'ed(java.lang.Boolean.TRUE)
    //#presumption(int readControlChars(String, SimpleAttributeSet, bool)): init'ed(javax.swing.text.StyleConstants$FontConstants.Bold)
    //#presumption(int readControlChars(String, SimpleAttributeSet, bool)): init'ed(javax.swing.text.StyleConstants$FontConstants.FontFamily)
    //#presumption(int readControlChars(String, SimpleAttributeSet, bool)): init'ed(javax.swing.text.StyleConstants$FontConstants.Italic)
    //#presumption(int readControlChars(String, SimpleAttributeSet, bool)): init'ed(javax.swing.text.StyleConstants$FontConstants.Underline)
    //#post(int readControlChars(String, SimpleAttributeSet, bool)): return_value in {0..7, 14}
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:containsAttribute
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:removeAttribute
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:addAttribute
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:getAttribute
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:isDefined
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.util.Locale:getDefault
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.String:toUpperCase
    //#unanalyzed(int readControlChars(String, SimpleAttributeSet, bool)): Effects-of-calling:java.lang.String:charAt
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): isStart: {0}, {1}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@329: {0,1, 3..65_535}, {2}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@338: {0..30, 32..65_535}, {31}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@347: {0..28, 30..65_535}, {29}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@356: {0..4, 6..65_535}, {5}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@371: {0..5, 7..65_535}, {6}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@383: {0..15, 17..65_535}, {16}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@395: {0..16, 18..65_535}, {17}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@409: {0..14, 16..65_535}, {15}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@418: {0..2, 4..65_535}, {3}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@421: {0..47, 58..65_535}, {48..57}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@424: {0..47, 58..65_535}, {48..57}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@438: {0..43, 45..65_535}, {44}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@438: {0..47, 58..65_535}, {48..57}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@443: {0..47, 58..65_535}, {48..57}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@463: {0..3, 5..65_535}, {4}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@476: {0..43, 45..65_535}, {44}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@496: {0..17, 19..65_535}, {18}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:charAt(...)@502: {0..6, 8..65_535}, {7}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:length(...)@421: {0,1}, {2..4_294_967_295}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): java.lang.String:length(...)@424: {0..2}, {3..4_294_967_295}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@326: {1}, {0}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@397: {0}, {1}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@361: Inverse{null}, Addr_Set{null}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@372: Inverse{null}, Addr_Set{null}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@384: Inverse{null}, Addr_Set{null}
    //#test_vector(int readControlChars(String, SimpleAttributeSet, bool)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@503: Inverse{null}, Addr_Set{null}
        
        // Bold
        if (string.charAt(0) == CODE_BOLD) {
            if (!isNegated) {
                toggleAttribute(attribs, StyleConstants.FontConstants.Bold);
            }
            
            return 1;
        }
        
        // Underline
        if (string.charAt(0) == CODE_UNDERLINE) {
            if (!isNegated) {
                toggleAttribute(attribs, StyleConstants.FontConstants.Underline);
            }
            
            return 1;
        }
        
        // Italic
        if (string.charAt(0) == CODE_ITALIC) {
            if (!isNegated) {
                toggleAttribute(attribs, StyleConstants.FontConstants.Italic);
            }
            
            return 1;
        }
        
        // Hyperlinks
        if (string.charAt(0) == CODE_HYPERLINK) {
            if (!isNegated) {
                toggleLink(attribs);
            }
            
            if (attribs.getAttribute(IRCTextAttribute.HYPERLINK) == null) {
                attribs.addAttribute(IRCTextAttribute.HYPERLINK,
    //#Styliser.java:362: Warning: unused assignment in callee
    //#    Unused assignment to (java.lang.String:substring(...)._tainted) in readUntilControl
    //#    severity: LOW
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: int readControlChars(String, SimpleAttributeSet, bool)
                        readUntilControl(string.substring(1)));
            } else {
                attribs.removeAttribute(IRCTextAttribute.HYPERLINK);
            }
            return 1;
        }
        
        // Channel links
        if (string.charAt(0) == CODE_CHANNEL) {
            if (attribs.getAttribute(IRCTextAttribute.CHANNEL) == null) {
                attribs.addAttribute(IRCTextAttribute.CHANNEL,
    //#Styliser.java:373: Warning: unused assignment in callee
    //#    Unused assignment to (java.lang.String:substring(...)._tainted) in readUntilControl
    //#    severity: LOW
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: int readControlChars(String, SimpleAttributeSet, bool)
                        readUntilControl(string.substring(1)));
            } else {
                attribs.removeAttribute(IRCTextAttribute.CHANNEL);
            }
            
            return 1;
        }
        
        // Nickname links
        if (string.charAt(0) == CODE_NICKNAME) {
            if (attribs.getAttribute(IRCTextAttribute.NICKNAME) == null) {
                attribs.addAttribute(IRCTextAttribute.NICKNAME,
    //#Styliser.java:385: Warning: unused assignment in callee
    //#    Unused assignment to (java.lang.String:substring(...)._tainted) in readUntilControl
    //#    severity: LOW
    //#    class: com.dmdirc.ui.messages.Styliser
    //#    method: int readControlChars(String, SimpleAttributeSet, bool)
                        readUntilControl(string.substring(1)));
            } else {
                attribs.removeAttribute(IRCTextAttribute.NICKNAME);
            }
            
            return 1;
        }
        
        // Fixed pitch
        if (string.charAt(0) == CODE_FIXED) {
            if (!isNegated) {
                if (attribs.containsAttribute(StyleConstants.FontConstants.FontFamily, "monospaced")) {
                    attribs.removeAttribute(StyleConstants.FontConstants.FontFamily);
                } else {
                    attribs.removeAttribute(StyleConstants.FontConstants.FontFamily);
                    attribs.addAttribute(StyleConstants.FontConstants.FontFamily, "monospaced");
                }
            }
            
            return 1;
        }
        
        // Stop formatting
        if (string.charAt(0) == CODE_STOP) {
            if (!isNegated) {
                resetAttributes(attribs);
            }
            
            return 1;
        }
        
        // Colours
        if (string.charAt(0) == CODE_COLOUR) {
            int count = 1;
            // This isn't too nice!
            if (string.length() > count && isInt(string.charAt(count))) {
                int foreground = string.charAt(count) - '0';
                count++;
                if (string.length() > count && isInt(string.charAt(count))) {
                    foreground = foreground * 10 + (string.charAt(count) - '0');
                    count++;
                }
                foreground = foreground % 16;
                
                if (!isNegated) {
                    setForeground(attribs, String.valueOf(foreground));
                    if (isStart) {
                        setDefaultForeground(attribs, String.valueOf(foreground));
                    }
                }
                
                // Now background
                if (string.length() > count && string.charAt(count) == ','
                        && string.length() > count + 1
                        && isInt(string.charAt(count + 1))) {
                    int background = string.charAt(count + 1) - '0';
                    count += 2; // Comma and first digit
                    if (string.length() > count && isInt(string.charAt(count))) {
                        background = background * 10 + (string.charAt(count) - '0');
                        count++;
                    }
                    background = background % 16;
                    
                    if (!isNegated) {
                        setBackground(attribs, String.valueOf(background));
                        if (isStart) {
                            setDefaultBackground(attribs, String.valueOf(background));
                        }
                    }
                }
            } else if (!isNegated) {
                resetColour(attribs);
            }
            return count;
        }
        
        // Hex colours
        if (string.charAt(0) == CODE_HEXCOLOUR) {
            int count = 1;
            if (hasHexString(string, 1)) {
                if (!isNegated) {
                    setForeground(attribs, string.substring(1, 7).toUpperCase());
                    if (isStart) {
                        setDefaultForeground(attribs, string.substring(1, 7).toUpperCase());
                    }
                }
                
                count = count + 6;
                
                // Now for background
                if (string.charAt(count) == ',' && hasHexString(string, count + 1)) {
                    count++;
                    
                    if (!isNegated) {
                        setBackground(attribs, string.substring(count, count + 6).toUpperCase());
                        if (isStart) {
                            setDefaultBackground(attribs, 
                                    string.substring(count, count + 6).toUpperCase());
                        }
                    }
                    
                    count += 6;
                }
            } else if (!isNegated) {
                resetColour(attribs);
            }
            return count;
        }
        
        // Control code negation
        if (string.charAt(0) == CODE_NEGATE) {
            toggleAttribute(attribs, "NegateControl");
            return 1;
        }

        // Smilies!!
        if (string.charAt(0) == CODE_SMILIE) {
            if (attribs.getAttribute(IRCTextAttribute.SMILEY) == null) {
                final String smilie = readUntilControl(string.substring(1));

                attribs.addAttribute(IRCTextAttribute.SMILEY, "smilie-" + smilie);
            } else {
                attribs.removeAttribute(IRCTextAttribute.SMILEY);
            }

            return 1;
        }
        
        return 0;
    //#Styliser.java:514: end of method: int com.dmdirc.ui.messages.Styliser.readControlChars(String, SimpleAttributeSet, bool)
    }
    
    /**
     * Determines if the specified character represents a single integer (i.e. 0-9).
     * @param c The character to check
     * @return True iff the character is in the range [0-9], false otherwise
     */
    private static boolean isInt(final char c) {
        return c >= '0' && c <= '9';
    //#Styliser.java:523: method: bool com.dmdirc.ui.messages.Styliser.isInt(char)
    //#input(bool isInt(char)): c
    //#output(bool isInt(char)): return_value
    //#post(bool isInt(char)): init'ed(return_value)
    //#Styliser.java:523: end of method: bool com.dmdirc.ui.messages.Styliser.isInt(char)
    }
    
    /**
     * Determines if the specified character represents a single hex digit
     * (i.e., 0-F).
     * @param c The character to check
     * @return True iff the character is in the range [0-F], false otherwise
     */
    private static boolean isHex(final char c) {
        return isInt(c) || (c >= 'A' && c <= 'F');
    //#Styliser.java:533: method: bool com.dmdirc.ui.messages.Styliser.isHex(char)
    //#input(bool isHex(char)): c
    //#output(bool isHex(char)): return_value
    //#post(bool isHex(char)): init'ed(return_value)
    //#Styliser.java:533: end of method: bool com.dmdirc.ui.messages.Styliser.isHex(char)
    }
    
    /**
     * Determines if the specified string has a 6-digit hex string starting at
     * the specified offset.
     * @param input The string to check
     * @param offset The offset to start at
     * @return True iff there is a hex string preset at the offset
     */
    private static boolean hasHexString(final String input, final int offset) {
        // If the string's too short, it can't have a hex string
        if (input.length() < offset + 6) {
    //#Styliser.java:545: method: bool com.dmdirc.ui.messages.Styliser.hasHexString(String, int)
    //#input(bool hasHexString(String, int)): input
    //#input(bool hasHexString(String, int)): offset
    //#output(bool hasHexString(String, int)): return_value
    //#pre[1] (bool hasHexString(String, int)): input != null
    //#post(bool hasHexString(String, int)): init'ed(return_value)
            return false;
        }
        boolean res = true;
        for (int i = offset; i < 6 + offset; i++) {
            res = res && isHex(input.toUpperCase(Locale.getDefault()).charAt(i));
        }
        
        return res;
    //#Styliser.java:553: end of method: bool com.dmdirc.ui.messages.Styliser.hasHexString(String, int)
    }
    
    /**
     * Toggles the various hyperlink-related attributes.
     * @param attribs The attributes to be modified.
     */
    private static void toggleLink(final SimpleAttributeSet attribs) {
        if (styleLinks) {
    //#Styliser.java:561: method: void com.dmdirc.ui.messages.Styliser.toggleLink(SimpleAttributeSet)
    //#input(void toggleLink(SimpleAttributeSet)): attribs
    //#input(void toggleLink(SimpleAttributeSet)): com/dmdirc/ui/messages/IRCTextAttribute.HYPERLINK
    //#input(void toggleLink(SimpleAttributeSet)): java.awt.Color.BLUE
    //#input(void toggleLink(SimpleAttributeSet)): java.lang.Boolean.TRUE
    //#input(void toggleLink(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.Foreground
    //#input(void toggleLink(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(void toggleLink(SimpleAttributeSet)): styleLinks
    //#pre[2] (void toggleLink(SimpleAttributeSet)): init'ed(styleLinks)
    //#pre[1] (void toggleLink(SimpleAttributeSet)): (soft) attribs != null
    //#presumption(void toggleLink(SimpleAttributeSet)): init'ed(java.awt.Color.BLUE)
    //#presumption(void toggleLink(SimpleAttributeSet)): init'ed(java.lang.Boolean.TRUE)
    //#presumption(void toggleLink(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.Foreground)
    //#presumption(void toggleLink(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.Underline)
    //#test_vector(void toggleLink(SimpleAttributeSet)): styleLinks: {0}, {1}
    //#test_vector(void toggleLink(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@565: {0}, {1}
    //#test_vector(void toggleLink(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@583: {0}, {1}
    //#test_vector(void toggleLink(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@562: Inverse{null}, Addr_Set{null}
    //#test_vector(void toggleLink(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@571: Addr_Set{null}, Inverse{null}
    //#test_vector(void toggleLink(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:getAttribute(...)@590: Addr_Set{null}, Inverse{null}
            if (attribs.getAttribute(IRCTextAttribute.HYPERLINK) == null) {
                // Add the hyperlink style
                
                if (attribs.containsAttribute(StyleConstants.FontConstants.Underline, Boolean.TRUE)) {
                    attribs.addAttribute("restoreUnderline", Boolean.TRUE);
                } else {
                    attribs.addAttribute(StyleConstants.FontConstants.Underline, Boolean.TRUE);
                }
                
                final Object foreground = attribs.getAttribute(StyleConstants.FontConstants.Foreground);
                
                if (foreground != null) {
                    attribs.addAttribute("restoreColour", foreground);
                    attribs.removeAttribute(StyleConstants.FontConstants.Foreground);
                }
                
                attribs.addAttribute(StyleConstants.FontConstants.Foreground, Color.BLUE);
                
            } else {
                // Remove the hyperlink style
                
                if (attribs.containsAttribute("restoreUnderline", Boolean.TRUE)) {
                    attribs.removeAttribute("restoreUnderline");
                } else {
                    attribs.removeAttribute(StyleConstants.FontConstants.Underline);
                }
                
                attribs.removeAttribute(StyleConstants.FontConstants.Foreground);
                final Object foreground = attribs.getAttribute("restoreColour");
                if (foreground != null) {
                    attribs.addAttribute(StyleConstants.FontConstants.Foreground, foreground);
                    attribs.removeAttribute("restoreColour");
                }
            }
        }
    }
    //#Styliser.java:597: end of method: void com.dmdirc.ui.messages.Styliser.toggleLink(SimpleAttributeSet)
    
    /**
     * Toggles the specified attribute. If the attribute exists in the attribute
     * set, it is removed. Otherwise, it is added with a value of Boolean.True.
     * @param attribs The attribute set to check
     * @param attrib The attribute to toggle
     */
    private static void toggleAttribute(final SimpleAttributeSet attribs,
            final Object attrib) {
        if (attribs.containsAttribute(attrib, Boolean.TRUE)) {
    //#Styliser.java:607: method: void com.dmdirc.ui.messages.Styliser.toggleAttribute(SimpleAttributeSet, Object)
    //#input(void toggleAttribute(SimpleAttributeSet, Object)): attrib
    //#input(void toggleAttribute(SimpleAttributeSet, Object)): attribs
    //#input(void toggleAttribute(SimpleAttributeSet, Object)): java.lang.Boolean.TRUE
    //#pre[2] (void toggleAttribute(SimpleAttributeSet, Object)): attribs != null
    //#presumption(void toggleAttribute(SimpleAttributeSet, Object)): init'ed(java.lang.Boolean.TRUE)
    //#test_vector(void toggleAttribute(SimpleAttributeSet, Object)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@607: {0}, {1}
            attribs.removeAttribute(attrib);
        } else {
            attribs.addAttribute(attrib, Boolean.TRUE);
        }
    }
    //#Styliser.java:612: end of method: void com.dmdirc.ui.messages.Styliser.toggleAttribute(SimpleAttributeSet, Object)
    
    /**
     * Resets all attributes in the specified attribute list.
     * @param attribs The attribute list whose attributes should be reset
     */
    private static void resetAttributes(final SimpleAttributeSet attribs) {
        if (attribs.containsAttribute(StyleConstants.FontConstants.Bold, Boolean.TRUE)) {
    //#Styliser.java:619: method: void com.dmdirc.ui.messages.Styliser.resetAttributes(SimpleAttributeSet)
    //#input(void resetAttributes(SimpleAttributeSet)): attribs
    //#input(void resetAttributes(SimpleAttributeSet)): java.lang.Boolean.TRUE
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.Bold
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.FontFamily
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.Italic
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants$FontConstants.Underline
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants.Background
    //#input(void resetAttributes(SimpleAttributeSet)): javax.swing.text.StyleConstants.Foreground
    //#pre[1] (void resetAttributes(SimpleAttributeSet)): attribs != null
    //#presumption(void resetAttributes(SimpleAttributeSet)): init'ed(java.lang.Boolean.TRUE)
    //#presumption(void resetAttributes(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.Bold)
    //#presumption(void resetAttributes(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.FontFamily)
    //#presumption(void resetAttributes(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.Italic)
    //#presumption(void resetAttributes(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants$FontConstants.Underline)
    //#unanalyzed(void resetAttributes(SimpleAttributeSet)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:removeAttribute
    //#unanalyzed(void resetAttributes(SimpleAttributeSet)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:addAttribute
    //#unanalyzed(void resetAttributes(SimpleAttributeSet)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:getAttribute
    //#unanalyzed(void resetAttributes(SimpleAttributeSet)): Effects-of-calling:javax.swing.text.SimpleAttributeSet:isDefined
    //#test_vector(void resetAttributes(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@619: {0}, {1}
    //#test_vector(void resetAttributes(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@622: {0}, {1}
    //#test_vector(void resetAttributes(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@625: {0}, {1}
    //#test_vector(void resetAttributes(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:containsAttribute(...)@628: {0}, {1}
            attribs.removeAttribute(StyleConstants.FontConstants.Bold);
        }
        if (attribs.containsAttribute(StyleConstants.FontConstants.Underline, Boolean.TRUE)) {
            attribs.removeAttribute(StyleConstants.FontConstants.Underline);
        }
        if (attribs.containsAttribute(StyleConstants.FontConstants.Italic, Boolean.TRUE)) {
            attribs.removeAttribute(StyleConstants.FontConstants.Italic);
        }
        if (attribs.containsAttribute(StyleConstants.FontConstants.FontFamily, "monospaced")) {
            final Object defaultFont = attribs.getAttribute("DefaultFontFamily");
            attribs.removeAttribute(StyleConstants.FontConstants.FontFamily);
            attribs.addAttribute(StyleConstants.FontConstants.FontFamily, defaultFont);
        }
        resetColour(attribs);
    }
    //#Styliser.java:634: end of method: void com.dmdirc.ui.messages.Styliser.resetAttributes(SimpleAttributeSet)
    
    /**
     * Resets the colour attributes in the specified attribute set.
     * @param attribs The attribute set whose colour attributes should be reset
     */
    private static void resetColour(final SimpleAttributeSet attribs) {
        if (attribs.isDefined(StyleConstants.Foreground)) {
    //#Styliser.java:641: method: void com.dmdirc.ui.messages.Styliser.resetColour(SimpleAttributeSet)
    //#input(void resetColour(SimpleAttributeSet)): attribs
    //#input(void resetColour(SimpleAttributeSet)): javax.swing.text.StyleConstants.Background
    //#input(void resetColour(SimpleAttributeSet)): javax.swing.text.StyleConstants.Foreground
    //#pre[1] (void resetColour(SimpleAttributeSet)): attribs != null
    //#presumption(void resetColour(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants.Background)
    //#presumption(void resetColour(SimpleAttributeSet)): init'ed(javax.swing.text.StyleConstants.Foreground)
    //#test_vector(void resetColour(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:isDefined(...)@641: {0}, {1}
    //#test_vector(void resetColour(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:isDefined(...)@644: {0}, {1}
    //#test_vector(void resetColour(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:isDefined(...)@648: {0}, {1}
    //#test_vector(void resetColour(SimpleAttributeSet)): javax.swing.text.SimpleAttributeSet:isDefined(...)@651: {0}, {1}
            attribs.removeAttribute(StyleConstants.Foreground);
        }
        if (attribs.isDefined("DefaultForeground")) {
            attribs.addAttribute(StyleConstants.Foreground,
                    attribs.getAttribute("DefaultForeground"));
        }
        if (attribs.isDefined(StyleConstants.Background)) {
            attribs.removeAttribute(StyleConstants.Background);
        }
        if (attribs.isDefined("DefaultBackground")) {
            attribs.addAttribute(StyleConstants.Background,
                    attribs.getAttribute("DefaultBackground"));
        }
    }
    //#Styliser.java:655: end of method: void com.dmdirc.ui.messages.Styliser.resetColour(SimpleAttributeSet)
    
    /**
     * Sets the foreground colour in the specified attribute set to the colour
     * corresponding to the specified colour code or hex.
     * @param attribs The attribute set to modify
     * @param foreground The colour code/hex of the new foreground colour
     */
    private static void setForeground(final SimpleAttributeSet attribs,
            final String foreground) {
        if (attribs.isDefined(StyleConstants.Foreground)) {
    //#Styliser.java:665: method: void com.dmdirc.ui.messages.Styliser.setForeground(SimpleAttributeSet, String)
    //#input(void setForeground(SimpleAttributeSet, String)): "#"._tainted
    //#input(void setForeground(SimpleAttributeSet, String)): "Invalid colour #"._tainted
    //#input(void setForeground(SimpleAttributeSet, String)): "Invalid colour format: "._tainted
    //#input(void setForeground(SimpleAttributeSet, String)): "Invalid colour: "._tainted
    //#input(void setForeground(SimpleAttributeSet, String)): attribs
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void setForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(void setForeground(SimpleAttributeSet, String)): foreground
    //#input(void setForeground(SimpleAttributeSet, String)): foreground._tainted
    //#input(void setForeground(SimpleAttributeSet, String)): javax.swing.text.StyleConstants.Foreground
    //#pre[1] (void setForeground(SimpleAttributeSet, String)): attribs != null
    //#pre[2] (void setForeground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[3] (void setForeground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[4] (void setForeground(SimpleAttributeSet, String)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#presumption(void setForeground(SimpleAttributeSet, String)): init'ed(javax.swing.text.StyleConstants.Foreground)
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Integer:parseInt
    //#test_vector(void setForeground(SimpleAttributeSet, String)): javax.swing.text.SimpleAttributeSet:isDefined(...)@665: {0}, {1}
            attribs.removeAttribute(StyleConstants.Foreground);
        }
        attribs.addAttribute(StyleConstants.Foreground, ColourManager.parseColour(foreground));
    }
    //#Styliser.java:669: end of method: void com.dmdirc.ui.messages.Styliser.setForeground(SimpleAttributeSet, String)
    
    /**
     * Sets the background colour in the specified attribute set to the colour
     * corresponding to the specified colour code or hex.
     * @param attribs The attribute set to modify
     * @param background The colour code/hex of the new background colour
     */
    private static void setBackground(final SimpleAttributeSet attribs,
            final String background) {
        if (attribs.isDefined(StyleConstants.Background)) {
    //#Styliser.java:679: method: void com.dmdirc.ui.messages.Styliser.setBackground(SimpleAttributeSet, String)
    //#input(void setBackground(SimpleAttributeSet, String)): "#"._tainted
    //#input(void setBackground(SimpleAttributeSet, String)): "Invalid colour #"._tainted
    //#input(void setBackground(SimpleAttributeSet, String)): "Invalid colour format: "._tainted
    //#input(void setBackground(SimpleAttributeSet, String)): "Invalid colour: "._tainted
    //#input(void setBackground(SimpleAttributeSet, String)): attribs
    //#input(void setBackground(SimpleAttributeSet, String)): background
    //#input(void setBackground(SimpleAttributeSet, String)): background._tainted
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void setBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(void setBackground(SimpleAttributeSet, String)): javax.swing.text.StyleConstants.Background
    //#pre[1] (void setBackground(SimpleAttributeSet, String)): attribs != null
    //#pre[4] (void setBackground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[5] (void setBackground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[6] (void setBackground(SimpleAttributeSet, String)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#presumption(void setBackground(SimpleAttributeSet, String)): init'ed(javax.swing.text.StyleConstants.Background)
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Integer:parseInt
    //#test_vector(void setBackground(SimpleAttributeSet, String)): javax.swing.text.SimpleAttributeSet:isDefined(...)@679: {0}, {1}
            attribs.removeAttribute(StyleConstants.Background);
        }
        attribs.addAttribute(StyleConstants.Background, ColourManager.parseColour(background));
    }
    //#Styliser.java:683: end of method: void com.dmdirc.ui.messages.Styliser.setBackground(SimpleAttributeSet, String)
    
    /**
     * Sets the default foreground colour (used after an empty ctrl+k or a ctrl+o).
     * @param attribs The attribute set to apply this default on
     * @param foreground The default foreground colour
     */
    private static void setDefaultForeground(final SimpleAttributeSet attribs,
            final String foreground) {
        attribs.addAttribute("DefaultForeground", ColourManager.parseColour(foreground));
    //#Styliser.java:692: method: void com.dmdirc.ui.messages.Styliser.setDefaultForeground(SimpleAttributeSet, String)
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): "#"._tainted
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): "Invalid colour #"._tainted
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): "Invalid colour format: "._tainted
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): "Invalid colour: "._tainted
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): attribs
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): foreground
    //#input(void setDefaultForeground(SimpleAttributeSet, String)): foreground._tainted
    //#pre[1] (void setDefaultForeground(SimpleAttributeSet, String)): attribs != null
    //#pre[2] (void setDefaultForeground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[3] (void setDefaultForeground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[4] (void setDefaultForeground(SimpleAttributeSet, String)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setDefaultForeground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Integer:parseInt
    }
    //#Styliser.java:693: end of method: void com.dmdirc.ui.messages.Styliser.setDefaultForeground(SimpleAttributeSet, String)
    
    /**
     * Sets the default background colour (used after an empty ctrl+k or a ctrl+o).
     * @param attribs The attribute set to apply this default on
     * @param background The default background colour
     */
    private static void setDefaultBackground(final SimpleAttributeSet attribs,
            final String background) {
        attribs.addAttribute("DefaultBackground", ColourManager.parseColour(background));
    //#Styliser.java:702: method: void com.dmdirc.ui.messages.Styliser.setDefaultBackground(SimpleAttributeSet, String)
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): "#"._tainted
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): "Invalid colour #"._tainted
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): "Invalid colour format: "._tainted
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): "Invalid colour: "._tainted
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): attribs
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): background
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): background._tainted
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.COLOUR_CACHE
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295]
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.com.dmdirc.logger.ErrorLevel.MEDIUM
    //#input(void setDefaultBackground(SimpleAttributeSet, String)): com/dmdirc/ui/messages/ColourManager.java.awt.Color.WHITE
    //#pre[1] (void setDefaultBackground(SimpleAttributeSet, String)): attribs != null
    //#pre[4] (void setDefaultBackground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS != null
    //#pre[5] (void setDefaultBackground(SimpleAttributeSet, String)): (soft) com/dmdirc/ui/messages/ColourManager.IRC_COLOURS.length >= 1
    //#pre[6] (void setDefaultBackground(SimpleAttributeSet, String)): (soft) init'ed(com/dmdirc/ui/messages/ColourManager.IRC_COLOURS[0..4_294_967_295])
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:containsKey
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:get
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.awt.Color:decode
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.util.Map:put
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:com.dmdirc.logger.Logger:userError
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setDefaultBackground(SimpleAttributeSet, String)): Effects-of-calling:java.lang.Integer:parseInt
    }
    //#Styliser.java:703: end of method: void com.dmdirc.ui.messages.Styliser.setDefaultBackground(SimpleAttributeSet, String)
    
}
    //#output(com.dmdirc.ui.messages.Styliser$1__static_init): __Descendant_Table[com/dmdirc/ui/messages/Styliser$1]
    //#output(com.dmdirc.ui.messages.Styliser$1__static_init): __Dispatch_Table.configChanged(Ljava/lang/String;Ljava/lang/String;)V
    //#post(com.dmdirc.ui.messages.Styliser$1__static_init): __Descendant_Table[com/dmdirc/ui/messages/Styliser$1] == &__Dispatch_Table
    //#post(com.dmdirc.ui.messages.Styliser$1__static_init): __Dispatch_Table.configChanged(Ljava/lang/String;Ljava/lang/String;)V == &configChanged
    //#Styliser.java:: end of method: com.dmdirc.ui.messages.Styliser$1.com.dmdirc.ui.messages.Styliser$1__static_init
    //#Styliser.java:: end of class: com.dmdirc.ui.messages.Styliser$1
    //#Styliser.java:: end of class: com.dmdirc.ui.messages.Styliser
