com.eclipsesource.v8.V8Array.push()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中com.eclipsesource.v8.V8Array.push()方法的一些代码示例,展示了V8Array.push()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。V8Array.push()方法的具体详情如下:
包路径:com.eclipsesource.v8.V8Array
类名称:V8Array
方法名:push

V8Array.push介绍

[英]Pushes a double value to the next available spot in the Array. In particular, this[length] = value;
[中]将双精度值推送到数组中的下一个可用位置。特别是,这个[长度]=值;

代码示例

代码示例来源:origin: eclipsesource/J2V8

/**
 * Changes the current condition on the breakpoint as specified by the breakpoint ID
 *
 * @param breakpointID The ID of the breakpoint of which to change the condition on
 * @param condition The new condition to set
 */
public void changeBreakPointCondition(final int breakpointID, final String condition) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  parameters.push(condition);
  try {
    debugObject.executeVoidFunction(CHANGE_BREAK_POINT_CONDITION, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Registers a breakpoint given a scriptID and line number. The breakpoint
 * will be 'hit' when the script is executed and the given line is reached.
 *
 * @param scriptID The ID of the script on which to set the breakpoint.
 * @param lineNumber The line number on which to set the breakpoint.
 * @return The berakpointID.
 */
public int setScriptBreakpoint(final String scriptID, final int lineNumber) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(scriptID);
  parameters.push(lineNumber);
  try {
    return debugObject.executeIntegerFunction(SET_SCRIPT_BREAK_POINT_BY_NAME, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

@Override
  public Object invoke(final V8Object receiver, final V8Array parameters) {
    V8Array requireParams = new V8Array(v8);
    try {
      requireParams.push(file.getAbsolutePath());
      return require.call(null, requireParams);
    } finally {
      requireParams.close();
    }
  }
});

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final double value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final boolean value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final V8Value value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final int value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the value of a variable in this scope.
 *
 * @param name The name of the variable
 * @param value The value
 */
public void setVariableValue(final String name, final String value) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(name);
  parameters.push(value);
  try {
    v8Object.executeVoidFunction(SET_VARIABLE_VALUE, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Enables a breakpoint.
 *
 * @param breakpointID The breakpoint to enable.
 */
public void enableScriptBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(ENABLE_SCRIPT_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Disables a breakpoint.
 *
 * @param breakpointID The breakpoint to disable
 */
public void disableScriptBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(DISABLE_SCRIPT_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Removes a Breakpoint.
 *
 * @param breakpointID The ID of the breakpoint to remove.
 */
public void clearBreakPoint(final int breakpointID) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(breakpointID);
  try {
    debugObject.executeVoidFunction(CLEAR_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Registers a function breakpoint. When the JavaScript function
 * is invoked, the breakpoint will be 'hit'.
 *
 * @param function The function on which to register the breakpoint.
 * @return The berakpointID.
 */
public int setBreakpoint(final V8Function function) {
  V8Array parameters = new V8Array(runtime);
  parameters.push(function);
  try {
    return debugObject.executeIntegerFunction(SET_BREAK_POINT, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Invokes NodeJS require() on the specified file. This will load the module, execute
 * it and return the exports object to the caller. The exports object must be released.
 *
 * @param file The module to load.
 * @return The exports object.
 */
public V8Object require(final File file) {
  v8.checkThread();
  V8Array requireParams = new V8Array(v8);
  try {
    requireParams.push(file.getAbsolutePath());
    return (V8Object) require.call(null, requireParams);
  } finally {
    requireParams.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the name of the local variable at the given index.
 *
 * @param index The index of the local variable name to return.
 * @return The name of local variable at the given index.
 */
public String getLocalName(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  try {
    return v8Object.executeStringFunction(LOCAL_NAME, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the name of the argument at the given index.
 *
 * @param index The index of the argument name to return.
 * @return The name of argument at the given index.
 */
public String getArgumentName(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  try {
    return v8Object.executeStringFunction(ARGUMENT_NAME, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets a condition to be evaluated before determining if
 * the breakpoint event should be fired.
 *
 * @param condition A JavaScript condition to be evaluated.
 */
public void setCondition(final String condition) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(condition);
  try {
    v8Object.executeVoidFunction(SET_CONDITION, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Indicates to the debugger how to proceed. If not called,
 * the debugger will continue running until the next breakpoint
 * is hit.
 *
 * @param action The step action to use.
 */
public void prepareStep(final StepAction action) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(action.index);
  try {
    v8Object.executeVoidFunction(PREPARE_STEP, parameters);
  } finally {
    parameters.close();
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the Frame at a given index
 *
 * @param index The stack index
 * @return The stack frame at a given index
 */
public Frame getFrame(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  V8Object frame = null;
  try {
    frame = v8Object.executeObjectFunction(FRAME, parameters);
    return new Frame(frame);
  } finally {
    parameters.close();
    if (frame != null) {
      frame.close();
    }
  }
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the scope at a given index.
 *
 * @param index The index
 * @return The scope
 */
public Scope getScope(final int index) {
  V8Array parameters = new V8Array(v8Object.getRuntime());
  parameters.push(index);
  V8Object scope = null;
  try {
    scope = v8Object.executeObjectFunction(SCOPE, parameters);
    return new Scope(scope);
  } finally {
    parameters.close();
    if (scope != null) {
      scope.close();
    }
  }
}

代码示例来源:origin: eclipsesource/J2V8

private void setupBreakpointHandler() {
  BreakpointHandler handler = new BreakpointHandler();
  debugObject.registerJavaMethod(handler, DEBUG_BREAK_HANDLER);
  V8Function debugHandler = null;
  V8Array parameters = null;
  try {
    debugHandler = (V8Function) debugObject.getObject(DEBUG_BREAK_HANDLER);
    parameters = new V8Array(runtime);
    parameters.push(debugHandler);
    debugObject.executeFunction(SET_LISTENER, parameters);
  } finally {
    if ((debugHandler != null) && !debugHandler.isReleased()) {
      debugHandler.close();
    }
    if ((parameters != null) && !parameters.isReleased()) {
      parameters.close();
    }
  }
}

相关文章