package org.mozilla.javascript;


/**
 * Exception thrown by 
 * {@link org.mozilla.javascript.Context#executeScriptWithContinuations(Script, Scriptable)}
 * and {@link org.mozilla.javascript.Context#callFunctionWithContinuations(Callable, Scriptable, Object[])}
 * when execution encounters a continuation captured by
 * {@link org.mozilla.javascript.Context#captureContinuation()}.
 * Exception will contain the captured state needed to restart the continuation
 * with {@link org.mozilla.javascript.Context#resumeContinuation(Object, Scriptable, Object)}.
 * @author Norris Boyd
 */
public class ContinuationPending extends RuntimeException {
    private static final long serialVersionUID = 4956008116771118856L;
    private NativeContinuation continuationState;
    private Object applicationState;
    
    /**
     * Construct a ContinuationPending exception. Internal call only;
     * users of the API should get continuations created on their behalf by
     * calling {@link org.mozilla.javascript.Context#executeScriptWithContinuations(Script, Scriptable)}
     * and {@link org.mozilla.javascript.Context#callFunctionWithContinuations(Callable, Scriptable, Object[])}
     * @param continuationState Internal Continuation object
     */
    ContinuationPending(NativeContinuation continuationState) {
        this.continuationState = continuationState;
    }
    
    /**
     * Get continuation object. The only
     * use for this object is to be passed to 
     * {@link org.mozilla.javascript.Context#resumeContinuation(Object, Scriptable, Object)}.
     * @return continuation object
     */
    public Object getContinuation() {
        return continuationState;
    }
    
    /**
     * @return internal continuation state
     */
    NativeContinuation getContinuationState() {
        return continuationState;
    }
    
    /**
     * Store an arbitrary object that applications can use to associate
     * their state with the continuation.
     * @param applicationState arbitrary application state
     */
    public void setApplicationState(Object applicationState) {
        this.applicationState = applicationState;
    }

    /**
     * @return arbitrary application state
     */
    public Object getApplicationState() {
        return applicationState;
    }
}

@@ -1,8 +1,1650 @@
+/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-%0A *%0A * ***** BEGIN LICENSE BLOCK *****%0A * Version: MPL 1.1/GPL 2.0%0A *%0A * The contents of this file are subject to the Mozilla Public License Version%0A * 1.1 (the %22License%22); you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A * http://www.mozilla.org/MPL/%0A *%0A * Software distributed under the License is distributed on an %22AS IS%22 basis,%0A * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License%0A * for the specific language governing rights and limitations under the%0A * License.%0A *%0A * The Original Code is Rhino code, released%0A * May 6, 1999.%0A *%0A * The Initial Developer of the Original Code is%0A * Netscape Communications Corporation.%0A * Portions created by the Initial Developer are Copyright (C) 1997-1999%0A * the Initial Developer. All Rights Reserved.%0A *%0A * Contributor(s):%0A *   Norris Boyd%0A *%0A * Alternatively, the contents of this file may be used under the terms of%0A * the GNU General Public License Version 2 or later (the %22GPL%22), in which%0A * case the provisions of the GPL are applicable instead of those above. If%0A * you wish to allow use of your version of this file only under the terms of%0A * the GPL and not to allow others to use your version of this file under the%0A * MPL, indicate your decision by deleting the provisions above and replacing%0A * them with the notice and other provisions required by the GPL. If you do%0A * not delete the provisions above, a recipient may use your version of this%0A * file under either the MPL or the GPL.%0A *%0A * ***** END LICENSE BLOCK ***** */%0A%0A
 package 
@@ -1668,17 +1668,16 @@
 cript;%0A%0A
-%0A
 /**%0A * E

Add missing copyright notice.