//# 0 errors, 54 messages
//#
/*
    //#AdditionalTabTargets.java:1:1: class: com.dmdirc.ui.input.AdditionalTabTargets
    //#AdditionalTabTargets.java:1:1: method: com.dmdirc.ui.input.AdditionalTabTargets.com.dmdirc.ui.input.AdditionalTabTargets__static_init
 * 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.input;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * The AdditionalTabTargets class is a basic wrapper around an arraylist that
 * adds an additional property to determine what types of results to include.
 * 
 * @author chris
 */
public final class AdditionalTabTargets extends ArrayList<String> {
    
    /**
     * 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;
    
    /** Whether to include normal targets. */
    private List<TabCompletionType> includes
    //#AdditionalTabTargets.java:45: Warning: method not available - call not analyzed
    //#    call on TabCompletionType[] com.dmdirc.ui.input.TabCompletionType:values()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.ui.input.AdditionalTabTargets
    //#    method: void com.dmdirc.ui.input.AdditionalTabTargets()
    //#    unanalyzed callee: TabCompletionType[] com.dmdirc.ui.input.TabCompletionType:values()
            = new ArrayList<TabCompletionType>(Arrays.asList(TabCompletionType.values()));
    
    /** Initialises the AdditionalTabTargets. */
    public AdditionalTabTargets() {
        super();
    //#AdditionalTabTargets.java:50: method: void com.dmdirc.ui.input.AdditionalTabTargets.com.dmdirc.ui.input.AdditionalTabTargets()
    //#input(void com.dmdirc.ui.input.AdditionalTabTargets()): this
    //#output(void com.dmdirc.ui.input.AdditionalTabTargets()): new ArrayList(AdditionalTabTargets#1) num objects
    //#output(void com.dmdirc.ui.input.AdditionalTabTargets()): this.includes
    //#new obj(void com.dmdirc.ui.input.AdditionalTabTargets()): new ArrayList(AdditionalTabTargets#1)
    //#post(void com.dmdirc.ui.input.AdditionalTabTargets()): this.includes == &new ArrayList(AdditionalTabTargets#1)
    //#post(void com.dmdirc.ui.input.AdditionalTabTargets()): new ArrayList(AdditionalTabTargets#1) num objects == 1
        //Do nothing
    }
    //#AdditionalTabTargets.java:52: end of method: void com.dmdirc.ui.input.AdditionalTabTargets.com.dmdirc.ui.input.AdditionalTabTargets()

    /**
     * Determines if the specified type of completion should be used.
     * 
     * @param type The type to check for
     * @return True if the specified targets are included, false otherwise
     */
    public boolean shouldInclude(final TabCompletionType type) {
        return includes.contains(type);
    //#AdditionalTabTargets.java:61: method: bool com.dmdirc.ui.input.AdditionalTabTargets.shouldInclude(TabCompletionType)
    //#input(bool shouldInclude(TabCompletionType)): this
    //#input(bool shouldInclude(TabCompletionType)): this.includes
    //#input(bool shouldInclude(TabCompletionType)): type
    //#output(bool shouldInclude(TabCompletionType)): return_value
    //#pre[2] (bool shouldInclude(TabCompletionType)): this.includes != null
    //#post(bool shouldInclude(TabCompletionType)): init'ed(return_value)
    //#AdditionalTabTargets.java:61: end of method: bool com.dmdirc.ui.input.AdditionalTabTargets.shouldInclude(TabCompletionType)
    }

    /**
     * Includes the specified target type.
     * 
     * @param type The type to be included
     */
    public void include(final TabCompletionType type) {
        if (!includes.contains(type)) {
    //#AdditionalTabTargets.java:70: method: void com.dmdirc.ui.input.AdditionalTabTargets.include(TabCompletionType)
    //#input(void include(TabCompletionType)): this
    //#input(void include(TabCompletionType)): this.includes
    //#input(void include(TabCompletionType)): type
    //#pre[2] (void include(TabCompletionType)): this.includes != null
    //#test_vector(void include(TabCompletionType)): java.util.List:contains(...)@70: {1}, {0}
            includes.add(type);
        }
    }
    //#AdditionalTabTargets.java:73: end of method: void com.dmdirc.ui.input.AdditionalTabTargets.include(TabCompletionType)
    
    /**
     * Excludes the specified target type.
     * 
     * @param type The type to be excluded
     */
    public void exclude(final TabCompletionType type) {
        includes.remove(type);
    //#AdditionalTabTargets.java:81: method: void com.dmdirc.ui.input.AdditionalTabTargets.exclude(TabCompletionType)
    //#input(void exclude(TabCompletionType)): this
    //#input(void exclude(TabCompletionType)): this.includes
    //#input(void exclude(TabCompletionType)): type
    //#pre[2] (void exclude(TabCompletionType)): this.includes != null
    }
    //#AdditionalTabTargets.java:82: end of method: void com.dmdirc.ui.input.AdditionalTabTargets.exclude(TabCompletionType)
    
    /**
     * Excludes all types of targets except ADDITIONAL.
     * 
     * @return A reference to this object.
     */
    public AdditionalTabTargets excludeAll() {
        includes.clear();
    //#AdditionalTabTargets.java:90: method: AdditionalTabTargets com.dmdirc.ui.input.AdditionalTabTargets.excludeAll()
    //#input(AdditionalTabTargets excludeAll()): com.dmdirc.ui.input.TabCompletionType.ADDITIONAL
    //#input(AdditionalTabTargets excludeAll()): this
    //#input(AdditionalTabTargets excludeAll()): this.includes
    //#output(AdditionalTabTargets excludeAll()): return_value
    //#pre[2] (AdditionalTabTargets excludeAll()): this.includes != null
    //#presumption(AdditionalTabTargets excludeAll()): init'ed(com.dmdirc.ui.input.TabCompletionType.ADDITIONAL)
    //#post(AdditionalTabTargets excludeAll()): return_value == this
    //#post(AdditionalTabTargets excludeAll()): return_value != null
        includes.add(TabCompletionType.ADDITIONAL);
        
        return this;
    //#AdditionalTabTargets.java:93: end of method: AdditionalTabTargets com.dmdirc.ui.input.AdditionalTabTargets.excludeAll()
    }

}
    //#output(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Descendant_Table[com/dmdirc/ui/input/AdditionalTabTargets]
    //#output(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.exclude(Lcom/dmdirc/ui/input/TabCompletionType;)V
    //#output(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.excludeAll()Lcom/dmdirc/ui/input/AdditionalTabTargets;
    //#output(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.include(Lcom/dmdirc/ui/input/TabCompletionType;)V
    //#output(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.shouldInclude(Lcom/dmdirc/ui/input/TabCompletionType;)Z
    //#post(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Descendant_Table[com/dmdirc/ui/input/AdditionalTabTargets] == &__Dispatch_Table
    //#post(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.exclude(Lcom/dmdirc/ui/input/TabCompletionType;)V == &exclude
    //#post(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.excludeAll()Lcom/dmdirc/ui/input/AdditionalTabTargets; == &excludeAll
    //#post(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.include(Lcom/dmdirc/ui/input/TabCompletionType;)V == &include
    //#post(com.dmdirc.ui.input.AdditionalTabTargets__static_init): __Dispatch_Table.shouldInclude(Lcom/dmdirc/ui/input/TabCompletionType;)Z == &shouldInclude
    //#AdditionalTabTargets.java:: end of method: com.dmdirc.ui.input.AdditionalTabTargets.com.dmdirc.ui.input.AdditionalTabTargets__static_init
    //#AdditionalTabTargets.java:: end of class: com.dmdirc.ui.input.AdditionalTabTargets
