//# 0 errors, 94 messages
//#
/*
    //#Plugin.java:1:1: class: com.dmdirc.plugins.Plugin
    //#Plugin.java:1:1: method: com.dmdirc.plugins.Plugin.com.dmdirc.plugins.Plugin__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.plugins;

import com.dmdirc.config.prefs.PreferencesManager;
import com.dmdirc.config.prefs.validator.ValidationResponse;

/**
 * Defines the standard methods that should be implemented by plugins.
 */
public abstract class Plugin implements Comparable<Plugin> {
    //#Plugin.java:31: method: int com.dmdirc.plugins.Plugin.compareTo(Object)
    //#input(int compareTo(Object)): __Descendant_Table[com/dmdirc/plugins/Plugin]
    //#input(int compareTo(Object)): __Descendant_Table[others]
    //#input(int compareTo(Object)): __Dispatch_Table.compareTo(Lcom/dmdirc/plugins/Plugin;)I
    //#input(int compareTo(Object)): this
    //#input(int compareTo(Object)): this.__Tag
    //#input(int compareTo(Object)): this._tainted
    //#input(int compareTo(Object)): x0
    //#input(int compareTo(Object)): x0.__Tag
    //#input(int compareTo(Object)): x0._tainted
    //#output(int compareTo(Object)): return_value
    //#pre[2] (int compareTo(Object)): this.__Tag == com/dmdirc/plugins/Plugin
    //#pre[4] (int compareTo(Object)): x0 != null
    //#pre[5] (int compareTo(Object)): x0.__Tag == com/dmdirc/plugins/Plugin
    //#post(int compareTo(Object)): init'ed(return_value)
    //#unanalyzed(int compareTo(Object)): Effects-of-calling:java.lang.Object:toString
    //#unanalyzed(int compareTo(Object)): Effects-of-calling:java.lang.String:compareTo
    //#Plugin.java:31: end of method: int com.dmdirc.plugins.Plugin.compareTo(Object)
	/** Domain name for the settings in this plugin. */
	private String myDomain = "plugin-unknown";
	
	/** Has the domain been set? */
	private boolean domainSet = false;
	
	/**
	 * Called when the plugin is constructed.
	 */
	public Plugin() { }
    //#Plugin.java:41: method: void com.dmdirc.plugins.Plugin.com.dmdirc.plugins.Plugin()
    //#input(void com.dmdirc.plugins.Plugin()): this
    //#output(void com.dmdirc.plugins.Plugin()): this.domainSet
    //#output(void com.dmdirc.plugins.Plugin()): this.myDomain
    //#post(void com.dmdirc.plugins.Plugin()): this.domainSet == 0
    //#post(void com.dmdirc.plugins.Plugin()): this.myDomain == &"plugin-unknown"
    //#Plugin.java:41: end of method: void com.dmdirc.plugins.Plugin.com.dmdirc.plugins.Plugin()
	
	/**
	 * Called by PluginInfo to set the domain name.
	 * This can only be called once, all other attempts will be ignored.
	 *
	 * @param newDomain Domain name for plugin settings
	 */
	public void setDomain(final String newDomain) {
		if (!domainSet) {
    //#Plugin.java:50: method: void com.dmdirc.plugins.Plugin.setDomain(String)
    //#input(void setDomain(String)): __Descendant_Table[com/dmdirc/plugins/Plugin]
    //#input(void setDomain(String)): __Descendant_Table[others]
    //#input(void setDomain(String)): __Dispatch_Table.domainUpdated()V
    //#input(void setDomain(String)): newDomain
    //#input(void setDomain(String)): this
    //#input(void setDomain(String)): this.__Tag
    //#input(void setDomain(String)): this.domainSet
    //#output(void setDomain(String)): this.domainSet
    //#output(void setDomain(String)): this.myDomain
    //#pre[2] (void setDomain(String)): init'ed(this.domainSet)
    //#pre[5] (void setDomain(String)): (soft) this.__Tag == com/dmdirc/plugins/Plugin
    //#post(void setDomain(String)): this.domainSet == 1
    //#post(void setDomain(String)): this.myDomain == One-of{old this.myDomain, newDomain}
    //#test_vector(void setDomain(String)): this.domainSet: {1}, {0}
			domainSet = true;
			myDomain = newDomain;
			domainUpdated();
		}
	}
    //#Plugin.java:55: end of method: void com.dmdirc.plugins.Plugin.setDomain(String)
	
	/**
	 * Get the domain name settings for this plugin should be stored in.
	 *
	 * @return Domain name for plugin settings
	 */
	public String getDomain() {
		return myDomain;
    //#Plugin.java:63: method: String com.dmdirc.plugins.Plugin.getDomain()
    //#input(String getDomain()): this
    //#input(String getDomain()): this.myDomain
    //#output(String getDomain()): return_value
    //#pre[2] (String getDomain()): init'ed(this.myDomain)
    //#post(String getDomain()): return_value == this.myDomain
    //#post(String getDomain()): init'ed(return_value)
    //#Plugin.java:63: end of method: String com.dmdirc.plugins.Plugin.getDomain()
	}
	
	/**
	 * Called when the domain for plugin settings has been set.
	 * This will only be called once (either when the plugin is loading, or when
	 * its config is being shown).
	 */
	public void domainUpdated() { }
    //#Plugin.java:71: method: void com.dmdirc.plugins.Plugin.domainUpdated()
    //#Plugin.java:71: end of method: void com.dmdirc.plugins.Plugin.domainUpdated()
	
	/**
	 * Called when the plugin is loaded.
	 */
	public abstract void onLoad();
	
	/**
	 * Check any further Prerequisites for this plugin to load that can not be
	 * checked using metainfo.
	 *
	 * @return ValidationResponse detailign if the plugin passes any extra checks
	 *         that plugin.info can't handle
	 */
	public ValidationResponse checkPrerequisites() { return new ValidationResponse(); }
    //#Plugin.java:85: method: ValidationResponse com.dmdirc.plugins.Plugin.checkPrerequisites()
    //#Plugin.java:85: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.config.prefs.validator.ValidationResponse()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.plugins.Plugin
    //#    method: ValidationResponse checkPrerequisites()
    //#    unanalyzed callee: void com.dmdirc.config.prefs.validator.ValidationResponse()
    //#output(ValidationResponse checkPrerequisites()): new ValidationResponse(checkPrerequisites#1) num objects
    //#output(ValidationResponse checkPrerequisites()): return_value
    //#new obj(ValidationResponse checkPrerequisites()): new ValidationResponse(checkPrerequisites#1)
    //#post(ValidationResponse checkPrerequisites()): return_value == &new ValidationResponse(checkPrerequisites#1)
    //#post(ValidationResponse checkPrerequisites()): new ValidationResponse(checkPrerequisites#1) num objects == 1
    //#Plugin.java:85: end of method: ValidationResponse com.dmdirc.plugins.Plugin.checkPrerequisites()
		
	/**
	 * Called when the plugin is about to be unloaded.
	 */
	public abstract void onUnload();
	
	/**
	 * Called to allow plugins to add their configuration options to the manager.
	 *
	 * @param manager The preferences manager that configuration options
	 * need to be added to.
	 */
	public void showConfig(final PreferencesManager manager) { }
    //#Plugin.java:98: method: void com.dmdirc.plugins.Plugin.showConfig(PreferencesManager)
    //#Plugin.java:98: end of method: void com.dmdirc.plugins.Plugin.showConfig(PreferencesManager)
	
	/**
	 * Compares this object with the specified object for order.
	 * Returns a negative integer, zero, or a positive integer as per String.compareTo();
	 *
	 * @param o Object to compare to
	 * @return a negative integer, zero, or a positive integer.
	 */
	@Override
	public int compareTo(final Plugin o) {
		return toString().compareTo(o.toString());
    //#Plugin.java:109: method: int com.dmdirc.plugins.Plugin.compareTo(Plugin)
    //#input(int compareTo(Plugin)): o
    //#input(int compareTo(Plugin)): o._tainted
    //#input(int compareTo(Plugin)): this
    //#input(int compareTo(Plugin)): this._tainted
    //#output(int compareTo(Plugin)): return_value
    //#pre[1] (int compareTo(Plugin)): o != null
    //#post(int compareTo(Plugin)): init'ed(return_value)
    //#Plugin.java:109: end of method: int com.dmdirc.plugins.Plugin.compareTo(Plugin)
	}
}
    //#output(com.dmdirc.plugins.Plugin__static_init): __Descendant_Table[com/dmdirc/plugins/Plugin]
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.checkPrerequisites()Lcom/dmdirc/config/prefs/validator/ValidationResponse;
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.compareTo(Lcom/dmdirc/plugins/Plugin;)I
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.domainUpdated()V
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.getDomain()Ljava/lang/String;
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.onLoad()V
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.onUnload()V
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.setDomain(Ljava/lang/String;)V
    //#output(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.showConfig(Lcom/dmdirc/config/prefs/PreferencesManager;)V
    //#post(com.dmdirc.plugins.Plugin__static_init): __Descendant_Table[com/dmdirc/plugins/Plugin] == &__Dispatch_Table
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.checkPrerequisites()Lcom/dmdirc/config/prefs/validator/ValidationResponse; == &checkPrerequisites
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.compareTo(Lcom/dmdirc/plugins/Plugin;)I == &compareTo
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.compareTo(Ljava/lang/Object;)I == &compareTo
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.domainUpdated()V == &domainUpdated
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.getDomain()Ljava/lang/String; == &getDomain
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.onLoad()V == &onLoad
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.onUnload()V == &onUnload
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.setDomain(Ljava/lang/String;)V == &setDomain
    //#post(com.dmdirc.plugins.Plugin__static_init): __Dispatch_Table.showConfig(Lcom/dmdirc/config/prefs/PreferencesManager;)V == &showConfig
    //#Plugin.java:: end of method: com.dmdirc.plugins.Plugin.com.dmdirc.plugins.Plugin__static_init
    //#Plugin.java:: end of class: com.dmdirc.plugins.Plugin
