//# 2 errors, 78 messages
//#
/*
    //#UrlListCommand.java:1:1: class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#UrlListCommand.java:1:1: method: com.dmdirc.addons.urlcatcher.UrlListCommand.com.dmdirc.addons.urlcatcher.UrlListCommand__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.addons.urlcatcher;

import com.dmdirc.commandparser.CommandArguments;
import com.dmdirc.commandparser.commands.GlobalCommand;
import com.dmdirc.commandparser.commands.IntelligentCommand;
import com.dmdirc.ui.input.AdditionalTabTargets;
import com.dmdirc.ui.interfaces.InputWindow;
import java.util.List;
import java.util.Map;

/**
 *
 * @author chris
 */
public class UrlListCommand extends GlobalCommand implements IntelligentCommand {
    
    private final UrlCatcherPlugin plugin;
    
    public UrlListCommand(final UrlCatcherPlugin plugin) {
    //#UrlListCommand.java:41: method: void com.dmdirc.addons.urlcatcher.UrlListCommand.com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)
    //#input(void com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)): plugin
    //#input(void com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)): this
    //#output(void com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)): this.plugin
    //#post(void com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)): this.plugin == plugin
    //#post(void com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)): init'ed(this.plugin)
        this.plugin = plugin;
    }
    //#UrlListCommand.java:43: end of method: void com.dmdirc.addons.urlcatcher.UrlListCommand.com.dmdirc.addons.urlcatcher.UrlListCommand(UrlCatcherPlugin)

    /** {@inheritDoc} */
    @Override
    public void execute(final InputWindow origin, final boolean isSilent,
            final CommandArguments args) {
        final String[] headers = {"URL", "Count"};
    //#UrlListCommand.java:49: method: void com.dmdirc.addons.urlcatcher.UrlListCommand.execute(InputWindow, bool, CommandArguments)
    //#input(void execute(InputWindow, bool, CommandArguments)): com/dmdirc/addons/urlcatcher/UrlCatcherPlugin.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlCatcherPlugin]
    //#input(void execute(InputWindow, bool, CommandArguments)): com/dmdirc/addons/urlcatcher/UrlCatcherPlugin.__Descendant_Table[others]
    //#input(void execute(InputWindow, bool, CommandArguments)): com/dmdirc/addons/urlcatcher/UrlCatcherPlugin.__Dispatch_Table.getURLS()Ljava/util/Map;
    //#input(void execute(InputWindow, bool, CommandArguments)): isSilent
    //#input(void execute(InputWindow, bool, CommandArguments)): origin
    //#input(void execute(InputWindow, bool, CommandArguments)): this
    //#input(void execute(InputWindow, bool, CommandArguments)): this.plugin
    //#input(void execute(InputWindow, bool, CommandArguments)): this.plugin.__Tag
    //#input(void execute(InputWindow, bool, CommandArguments)): this.plugin.urls
    //#pre[4] (void execute(InputWindow, bool, CommandArguments)): this.plugin != null
    //#pre[5] (void execute(InputWindow, bool, CommandArguments)): this.plugin.__Tag == com/dmdirc/addons/urlcatcher/UrlCatcherPlugin
    //#pre[6] (void execute(InputWindow, bool, CommandArguments)): this.plugin.urls != null
    //#presumption(void execute(InputWindow, bool, CommandArguments)): java.util.Iterator:next(...)@54 != null
    //#presumption(void execute(InputWindow, bool, CommandArguments)): java.util.Map:entrySet(...)@54 != null
    //#presumption(void execute(InputWindow, bool, CommandArguments)): java.util.Map:size(...)@51 >= 1
    //#presumption(void execute(InputWindow, bool, CommandArguments)): java.util.Map_Entry:getValue(...)@55 != null
    //#unanalyzed(void execute(InputWindow, bool, CommandArguments)): Effects-of-calling:com.dmdirc.ui.interfaces.InputWindow:addLine
    //#test_vector(void execute(InputWindow, bool, CommandArguments)): java.util.Iterator:hasNext(...)@54: {0}, {1}
        final Map<String, Integer> map = plugin.getURLS();
        final String[][] data = new String[map.size()][];
        
        int i = 0;
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            data[i++] = new String[]{entry.getKey(), entry.getValue().toString()};
    //#UrlListCommand.java:55: ?overflow
    //#    i in {-2_147_483_649..4_294_967_294}
    //#    severity: LOW
    //#    class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    basic block: bb_3
    //#    assertion: i in {-2_147_483_649..4_294_967_294}
    //#    VN: i + 1
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296}
    //#    Attribs:  Int  Bad singleton  Bad > Exp
    //#UrlListCommand.java:55: ?array index out of bounds
    //#    i < data.length
    //#    severity: MEDIUM
    //#    class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    basic block: bb_3
    //#    assertion: i < data.length
    //#    VN: -(i - java.util.Map:size(...)@51)
    //#    Expected: {1..+Inf}
    //#    Bad: {0}
    //#    Attribs:  Int  Bad singleton  Bad overlaps +/-1000  Bad < Exp
        }
        
        sendLine(origin, isSilent, FORMAT_OUTPUT, doTable(headers, data));
    //#UrlListCommand.java:58: Warning: method not available - call not analyzed
    //#    call on String com.dmdirc.addons.urlcatcher.UrlListCommand:doTable(String[], String[][])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#    method: void execute(InputWindow, bool, CommandArguments)
    //#    unanalyzed callee: String com.dmdirc.addons.urlcatcher.UrlListCommand:doTable(String[], String[][])
    }
    //#UrlListCommand.java:59: end of method: void com.dmdirc.addons.urlcatcher.UrlListCommand.execute(InputWindow, bool, CommandArguments)

    /** {@inheritDoc} */
    @Override
    public String getName() {
        return "urllist";
    //#UrlListCommand.java:64: method: String com.dmdirc.addons.urlcatcher.UrlListCommand.getName()
    //#output(String getName()): return_value
    //#post(String getName()): return_value == &"urllist"
    //#UrlListCommand.java:64: end of method: String com.dmdirc.addons.urlcatcher.UrlListCommand.getName()
    }

    /** {@inheritDoc} */
    @Override
    public boolean showInHelp() {
        return true;
    //#UrlListCommand.java:70: method: bool com.dmdirc.addons.urlcatcher.UrlListCommand.showInHelp()
    //#output(bool showInHelp()): return_value
    //#post(bool showInHelp()): return_value == 1
    //#UrlListCommand.java:70: end of method: bool com.dmdirc.addons.urlcatcher.UrlListCommand.showInHelp()
    }

    /** {@inheritDoc} */
    @Override
    public String getHelp() {
        return "urllist - shows a list of URLs that have been seen";
    //#UrlListCommand.java:76: method: String com.dmdirc.addons.urlcatcher.UrlListCommand.getHelp()
    //#output(String getHelp()): return_value
    //#post(String getHelp()): return_value == &"urllist - shows a list of URLs that have been seen"
    //#UrlListCommand.java:76: end of method: String com.dmdirc.addons.urlcatcher.UrlListCommand.getHelp()
    }

    /** {@inheritDoc} */
    @Override
    public AdditionalTabTargets getSuggestions(final int arg, final List<String> previousArgs) {
        return new AdditionalTabTargets().excludeAll();
    //#UrlListCommand.java:82: method: AdditionalTabTargets com.dmdirc.addons.urlcatcher.UrlListCommand.getSuggestions(int, List)
    //#UrlListCommand.java:82: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.ui.input.AdditionalTabTargets()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#    method: AdditionalTabTargets getSuggestions(int, List)
    //#    unanalyzed callee: void com.dmdirc.ui.input.AdditionalTabTargets()
    //#UrlListCommand.java:82: Warning: method not available - call not analyzed
    //#    call on AdditionalTabTargets com.dmdirc.ui.input.AdditionalTabTargets:excludeAll()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.urlcatcher.UrlListCommand
    //#    method: AdditionalTabTargets getSuggestions(int, List)
    //#    unanalyzed callee: AdditionalTabTargets com.dmdirc.ui.input.AdditionalTabTargets:excludeAll()
    //#output(AdditionalTabTargets getSuggestions(int, List)): return_value
    //#post(AdditionalTabTargets getSuggestions(int, List)): init'ed(return_value)
    //#UrlListCommand.java:82: end of method: AdditionalTabTargets com.dmdirc.addons.urlcatcher.UrlListCommand.getSuggestions(int, List)
    } 

}
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand]
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;ZLcom/dmdirc/commandparser/CommandArguments;)V
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String;
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String;
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getSuggestions(ILjava/util/List;)Lcom/dmdirc/ui/input/AdditionalTabTargets;
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getType()Lcom/dmdirc/commandparser/CommandType;
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.sendLine(Lcom/dmdirc/ui/interfaces/InputWindow;ZLjava/lang/String;[Ljava/lang/Object;)V
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.showInHelp()Z
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.showUsage(Lcom/dmdirc/ui/interfaces/InputWindow;ZLjava/lang/String;Ljava/lang/String;)V
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/CommandInfo.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand]
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/Command.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand]
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/GlobalCommand.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand]
    //#output(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/IntelligentCommand.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand]
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/CommandInfo.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/Command.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/GlobalCommand.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): com/dmdirc/commandparser/commands/IntelligentCommand.__Descendant_Table[com/dmdirc/addons/urlcatcher/UrlListCommand] == &__Dispatch_Table
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.execute(Lcom/dmdirc/ui/interfaces/InputWindow;ZLcom/dmdirc/commandparser/CommandArguments;)V == &execute
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getHelp()Ljava/lang/String; == &getHelp
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getName()Ljava/lang/String; == &getName
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getSuggestions(ILjava/util/List;)Lcom/dmdirc/ui/input/AdditionalTabTargets; == &getSuggestions
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.getType()Lcom/dmdirc/commandparser/CommandType; == &com/dmdirc/commandparser/commands/GlobalCommand.getType
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.sendLine(Lcom/dmdirc/ui/interfaces/InputWindow;ZLjava/lang/String;[Ljava/lang/Object;)V == &com/dmdirc/commandparser/commands/Command.sendLine
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.showInHelp()Z == &showInHelp
    //#post(com.dmdirc.addons.urlcatcher.UrlListCommand__static_init): __Dispatch_Table.showUsage(Lcom/dmdirc/ui/interfaces/InputWindow;ZLjava/lang/String;Ljava/lang/String;)V == &com/dmdirc/commandparser/commands/Command.showUsage
    //#UrlListCommand.java:: end of method: com.dmdirc.addons.urlcatcher.UrlListCommand.com.dmdirc.addons.urlcatcher.UrlListCommand__static_init
    //#UrlListCommand.java:: end of class: com.dmdirc.addons.urlcatcher.UrlListCommand
