//# 0 errors, 63 messages
//#
/*
    //#IRCTextAttribute.java:1:1: class: com.dmdirc.ui.messages.IRCTextAttribute
 * 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 java.io.InvalidObjectException;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.HashMap;
import java.util.Map;

/**
 * Defines attribute keys that can be used to identify text attributes. These
 * keys are used in AttributedCharacterIterator and AttributedString.
 */
public final class IRCTextAttribute extends Attribute {
    
    /**
     * A version number for this class. It should be changed whenever the
     * class structure is changed (or anything else that would prevent
     * serialized objects being unserialized with the new class).
     */
    private static final long serialVersionUID = 1;
    
    /** table of all instances in this class, used by readResolve. */
    private static final Map<String, IRCTextAttribute> INSTANCE_MAP
    //#IRCTextAttribute.java:44: method: com.dmdirc.ui.messages.IRCTextAttribute.com.dmdirc.ui.messages.IRCTextAttribute__static_init
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): CHANNEL
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): HYPERLINK
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): INSTANCE_MAP
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): NICKNAME
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): SMILEY
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): __Descendant_Table[com/dmdirc/ui/messages/IRCTextAttribute]
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): __Dispatch_Table.readResolve()Ljava/lang/Object;
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new HashMap(IRCTextAttribute__static_init#1) num objects
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#2) num objects
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): HYPERLINK.__Tag
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#3) num objects
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): NICKNAME.__Tag
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#4) num objects
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): CHANNEL.__Tag
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#5) num objects
    //#output(com.dmdirc.ui.messages.IRCTextAttribute__static_init): SMILEY.__Tag
    //#new obj(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new HashMap(IRCTextAttribute__static_init#1)
    //#new obj(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#2)
    //#new obj(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#3)
    //#new obj(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#4)
    //#new obj(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#5)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): CHANNEL == &new IRCTextAttribute(IRCTextAttribute__static_init#4)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): HYPERLINK == &new IRCTextAttribute(IRCTextAttribute__static_init#2)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): INSTANCE_MAP == &new HashMap(IRCTextAttribute__static_init#1)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): NICKNAME == &new IRCTextAttribute(IRCTextAttribute__static_init#3)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): SMILEY == &new IRCTextAttribute(IRCTextAttribute__static_init#5)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): __Descendant_Table[com/dmdirc/ui/messages/IRCTextAttribute] == &__Dispatch_Table
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): __Dispatch_Table.readResolve()Ljava/lang/Object; == &readResolve
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): init'ed(INSTANCE_MAP)
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new HashMap(IRCTextAttribute__static_init#1) num objects == 1
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#2) num objects == 1
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#3) num objects == 1
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#4) num objects == 1
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): new IRCTextAttribute(IRCTextAttribute__static_init#5) num objects == 1
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): HYPERLINK.__Tag == com/dmdirc/ui/messages/IRCTextAttribute
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): NICKNAME.__Tag == com/dmdirc/ui/messages/IRCTextAttribute
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): CHANNEL.__Tag == com/dmdirc/ui/messages/IRCTextAttribute
    //#post(com.dmdirc.ui.messages.IRCTextAttribute__static_init): SMILEY.__Tag == com/dmdirc/ui/messages/IRCTextAttribute
    //#unanalyzed(com.dmdirc.ui.messages.IRCTextAttribute__static_init): Effects-of-calling:java.text.AttributedCharacterIterator$Attribute
    //#unanalyzed(com.dmdirc.ui.messages.IRCTextAttribute__static_init): Effects-of-calling:java.lang.Object:getClass
    //#unanalyzed(com.dmdirc.ui.messages.IRCTextAttribute__static_init): Effects-of-calling:java.util.Map:put
            = new HashMap<String, IRCTextAttribute>(1);
    
    /**
     * Constructs an Attribute with the given name.
     *
     * @param name name for the attribute
     */
    protected IRCTextAttribute(final String name) {
        super(name);
    //#IRCTextAttribute.java:53: method: void com.dmdirc.ui.messages.IRCTextAttribute.com.dmdirc.ui.messages.IRCTextAttribute(String)
    //#input(void com.dmdirc.ui.messages.IRCTextAttribute(String)): INSTANCE_MAP
    //#input(void com.dmdirc.ui.messages.IRCTextAttribute(String)): name
    //#input(void com.dmdirc.ui.messages.IRCTextAttribute(String)): this
    //#test_vector(void com.dmdirc.ui.messages.IRCTextAttribute(String)): java.lang.Object:getClass(...)@54: Inverse{&__Class_Obj}, Addr_Set{&__Class_Obj}
        if (this.getClass() == IRCTextAttribute.class) {
            INSTANCE_MAP.put(name, this);
        }
    }
    //#IRCTextAttribute.java:57: end of method: void com.dmdirc.ui.messages.IRCTextAttribute.com.dmdirc.ui.messages.IRCTextAttribute(String)
    
    /**
     * Resolves instances being deserialized to the predefined constants.
     *
     * @return IRCTextAttribute instance
     *
     * @throws InvalidObjectException when the class being deserialized is not
     * an instance of IRCTextAttribute
     */
    protected Object readResolve() throws InvalidObjectException {
        if (this.getClass() != IRCTextAttribute.class) {
    //#IRCTextAttribute.java:68: method: Object com.dmdirc.ui.messages.IRCTextAttribute.readResolve()
    //#input(Object readResolve()): INSTANCE_MAP
    //#input(Object readResolve()): __Descendant_Table[com/dmdirc/ui/messages/IRCTextAttribute]
    //#input(Object readResolve()): __Descendant_Table[others]
    //#input(Object readResolve()): this
    //#output(Object readResolve()): return_value
    //#presumption(Object readResolve()): java.lang.Object:getClass(...)@68 == &__Class_Obj
    //#presumption(Object readResolve()): java.util.Map:get(...).__Tag@72 == com/dmdirc/ui/messages/IRCTextAttribute
    //#presumption(Object readResolve()): java.util.Map:get(...)@72 != null
    //#post(Object readResolve()): return_value != null
            throw new InvalidObjectException("subclass didn't correctly implement readResolve");
        }
        
        final IRCTextAttribute instance = INSTANCE_MAP.get(getName());
    //#IRCTextAttribute.java:72: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.ui.messages.IRCTextAttribute:getName()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.messages.IRCTextAttribute
    //#    method: Object readResolve()
    //#    unanalyzed callee: String com.dmdirc.ui.messages.IRCTextAttribute:getName()
        if (instance == null) {
            throw new InvalidObjectException("unknown attribute name");
        } else {
            return instance;
    //#IRCTextAttribute.java:76: end of method: Object com.dmdirc.ui.messages.IRCTextAttribute.readResolve()
        }
    }
    
    /** Hyperlink attribute. */
    public static final IRCTextAttribute HYPERLINK = new IRCTextAttribute("hyperlink");
    
    /** Nickname attribute. */
    public static final IRCTextAttribute NICKNAME = new IRCTextAttribute("nickname");
    
    /** Channel attribute. */
    public static final IRCTextAttribute CHANNEL = new IRCTextAttribute("channel");
    
    /** Smiley attribute. */
    public static final IRCTextAttribute SMILEY = new IRCTextAttribute("smiley");
    //#IRCTextAttribute.java:90: end of method: com.dmdirc.ui.messages.IRCTextAttribute.com.dmdirc.ui.messages.IRCTextAttribute__static_init
}
    //#IRCTextAttribute.java:: end of class: com.dmdirc.ui.messages.IRCTextAttribute
