//# 0 errors, 30 messages
//#
/*
    //#ReturnableThread.java:1:1: class: com.dmdirc.util.ReturnableThread
    //#ReturnableThread.java:1:1: method: com.dmdirc.util.ReturnableThread.com.dmdirc.util.ReturnableThread__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.util;

/**
 * Normal thread with the potential to return a value.
 * 
 * @param T Type to be returned
 */
public abstract class ReturnableThread<T> extends Thread {
    //#ReturnableThread.java:30: method: void com.dmdirc.util.ReturnableThread.com.dmdirc.util.ReturnableThread()
    //#input(void com.dmdirc.util.ReturnableThread()): this
    //#ReturnableThread.java:30: end of method: void com.dmdirc.util.ReturnableThread.com.dmdirc.util.ReturnableThread()

    /** Returnable object. */
    private T value;

    /** {@inheritDoc} */
    @Override
    public abstract void run();

    /**
     * Sets the returnable object.
     * 
     * @param value new returnable object
     */
    public void setObject(final T value) {
        this.value = value;
    //#ReturnableThread.java:45: method: void com.dmdirc.util.ReturnableThread.setObject(Object)
    //#input(void setObject(Object)): this
    //#input(void setObject(Object)): value
    //#output(void setObject(Object)): this.value
    //#post(void setObject(Object)): this.value == value
    //#post(void setObject(Object)): init'ed(this.value)
    }
    //#ReturnableThread.java:46: end of method: void com.dmdirc.util.ReturnableThread.setObject(Object)

    /**
     * Returns the object set by this thread.
     * 
     * @return Returnable object
     */
    public T getObject() {
        return value;
    //#ReturnableThread.java:54: method: Object com.dmdirc.util.ReturnableThread.getObject()
    //#input(Object getObject()): this
    //#input(Object getObject()): this.value
    //#output(Object getObject()): return_value
    //#pre[2] (Object getObject()): init'ed(this.value)
    //#post(Object getObject()): return_value == this.value
    //#post(Object getObject()): init'ed(return_value)
    //#ReturnableThread.java:54: end of method: Object com.dmdirc.util.ReturnableThread.getObject()
    }
}
    //#output(com.dmdirc.util.ReturnableThread__static_init): __Descendant_Table[com/dmdirc/util/ReturnableThread]
    //#output(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.getObject()Ljava/lang/Object;
    //#output(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.run()V
    //#output(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.setObject(Ljava/lang/Object;)V
    //#post(com.dmdirc.util.ReturnableThread__static_init): __Descendant_Table[com/dmdirc/util/ReturnableThread] == &__Dispatch_Table
    //#post(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.getObject()Ljava/lang/Object; == &getObject
    //#post(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.run()V == &run
    //#post(com.dmdirc.util.ReturnableThread__static_init): __Dispatch_Table.setObject(Ljava/lang/Object;)V == &setObject
    //#ReturnableThread.java:: end of method: com.dmdirc.util.ReturnableThread.com.dmdirc.util.ReturnableThread__static_init
    //#ReturnableThread.java:: end of class: com.dmdirc.util.ReturnableThread
