Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/NativeContinuation.java
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript;
import java.util.Objects;
public final class NativeContinuation extends IdScriptableObject implements Function {
private static final long serialVersionUID = 1794167133757605367L;
private static final Object FTAG = "Continuation";
private Object implementation;
public static void init(Context cx, Scriptable scope, boolean sealed) {
NativeContinuation obj = new NativeContinuation();
obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);
}
public Object getImplementation() {
return implementation;
}
public void initImplementation(Object implementation) {
this.implementation = implementation;
}
@Override
public String getClassName() {
return "Continuation";
}
@Override
public Scriptable construct(Context cx, Scriptable scope, Object[] args) {
throw Context.reportRuntimeError("Direct call is not supported");
}
@Override
public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
return Interpreter.restartContinuation(this, cx, scope, args);
}
public static boolean isContinuationConstructor(IdFunctionObject f) {
if (f.hasTag(FTAG) && f.methodId() == Id_constructor) {
return true;
}
return false;
}
/**
* Returns true if both continuations have equal implementations.
*
* @param c1 one continuation
* @param c2 another continuation
* @return true if the implementations of both continuations are equal, or they are both null.
* @throws NullPointerException if either continuation is null
*/
public static boolean equalImplementations(NativeContinuation c1, NativeContinuation c2) {
return Objects.equals(c1.implementation, c2.implementation);
}
@Override
protected void initPrototypeId(int id) {
String s;
int arity;
switch (id) {
case Id_constructor:
arity = 0;
s = "constructor";
break;
default:
throw new IllegalArgumentException(String.valueOf(id));
}
initPrototypeMethod(FTAG, id, s, arity);
}
@Override
public Object execIdCall(
IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
if (!f.hasTag(FTAG)) {
return super.execIdCall(f, cx, scope, thisObj, args);
}
int id = f.methodId();
switch (id) {
case Id_constructor:
throw Context.reportRuntimeError("Direct call is not supported");
}
throw new IllegalArgumentException(String.valueOf(id));
}
@Override
protected int findPrototypeId(String s) {
int id;
switch (s) {
case "constructor":
id = Id_constructor;
break;
default:
id = 0;
break;
}
return id;
}
private static final int Id_constructor = 1, MAX_PROTOTYPE_ID = 1;
}
⏎ org/mozilla/javascript/NativeContinuation.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈207🔥, 1💬
Popular Posts:
SLF4J API is a simple API that allows to plug in any desired logging library at deployment time. Her...
What is the jaxp\SourceValidator.jav aprovided in the Apache Xerces package? I have Apache Xerces 2....
Apache Commons Codec library provides implementations of common encoders and decoders such as Base64...
The Java Naming and Directory Interface (JNDI) is part of the Java platform, providing applications ...
Apache Log4j provides the interface that applications should code to and provides the adapter compon...