Tabnine Logo
PolyglotEngineWithJavaScript$Multiplier
Code IndexAdd Tabnine to your IDE (free)

How to use
PolyglotEngineWithJavaScript$Multiplier
in
com.oracle.truffle.tck.impl

Best Java code snippets using com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript$Multiplier (Showing top 2 results out of 315)

origin: com.oracle.truffle/truffle-tck

public void callJavaScriptFunctionFromJava() {
  Source src = Source.newBuilder("js",
    "(function (a, b) {\n" +
    "  return a * b;\n" +
    "})\n",
    "mul.js").buildLiteral();
  // Evaluate JavaScript function definition
  Value jsFunction = context.eval(src);
  // Create Java access to JavaScript function
  Multiplier mul = jsFunction.as(Multiplier.class);
  assertEquals(42, mul.multiply(6, 7));
  assertEquals(144, mul.multiply(12, 12));
  assertEquals(256, mul.multiply(32, 8));
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#callJavaScriptFunctionFromJava
origin: org.graalvm.truffle/truffle-tck

public void callJavaScriptFunctionFromJava() {
  Source src = Source.newBuilder("js",
    "(function (a, b) {\n" +
    "  return a * b;\n" +
    "})\n",
    "mul.js").buildLiteral();
  // Evaluate JavaScript function definition
  Value jsFunction = context.eval(src);
  // Create Java access to JavaScript function
  Multiplier mul = jsFunction.as(Multiplier.class);
  assertEquals(42, mul.multiply(6, 7));
  assertEquals(144, mul.multiply(12, 12));
  assertEquals(256, mul.multiply(32, 8));
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#callJavaScriptFunctionFromJava
com.oracle.truffle.tck.implPolyglotEngineWithJavaScript$Multiplier

Most used methods

  • multiply

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • getSystemService (Context)
  • startActivity (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now