• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Candidates类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中scala.tools.nsc.interpreter.Completion.Candidates的典型用法代码示例。如果您正苦于以下问题:Java Candidates类的具体用法?Java Candidates怎么用?Java Candidates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Candidates类属于scala.tools.nsc.interpreter.Completion包,在下文中一共展示了Candidates类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: completion

点赞 3

import scala.tools.nsc.interpreter.Completion.Candidates; //导入依赖的package包/类
@Override
public List<InterpreterCompletion> completion(String buf, int cursor,
    InterpreterContext interpreterContext) {
  if (Utils.isScala2_10()) {
    ScalaCompleter c = (ScalaCompleter) Utils.invokeMethod(completer, "completer");
    Candidates ret = c.complete(buf, cursor);

    List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates());
    List<InterpreterCompletion> completions = new LinkedList<>();

    for (String candidate : candidates) {
      completions.add(new InterpreterCompletion(candidate, candidate, StringUtils.EMPTY));
    }

    return completions;
  } else {
    return new LinkedList<>();
  }
}
 

开发者ID:apache,
项目名称:zeppelin,
代码行数:20,
代码来源:DepInterpreter.java

示例2: completion

点赞 2

import scala.tools.nsc.interpreter.Completion.Candidates; //导入依赖的package包/类
@Override
public List<String> completion(String buf, int cursor) {
  if (buf.length() < cursor) {
    cursor = buf.length();
  }
  String completionText = getCompletionTargetString(buf, cursor);
  if (completionText == null) {
    completionText = "";
    cursor = completionText.length();
  }
  ScalaCompleter c = completor.completer();
  Candidates ret = c.complete(completionText, cursor);
  return scala.collection.JavaConversions.asJavaList(ret.candidates());
}
 

开发者ID:lorthos,
项目名称:incubator-zeppelin-druid,
代码行数:15,
代码来源:SparkInterpreter.java

示例3: completion

点赞 2

import scala.tools.nsc.interpreter.Completion.Candidates; //导入依赖的package包/类
@Override
public List<String> completion(String buf, int cursor) {
  ScalaCompleter c = completor.completer();
  Candidates ret = c.complete(buf, cursor);
  return scala.collection.JavaConversions.asJavaList(ret.candidates());
}
 

开发者ID:lorthos,
项目名称:incubator-zeppelin-druid,
代码行数:7,
代码来源:DepInterpreter.java

示例4: run

点赞 2

import scala.tools.nsc.interpreter.Completion.Candidates; //导入依赖的package包/类
static void run(
        Socket socket, ILoopWithCompletion iloop, Runnable socketCleaner
) throws IOException, InterruptedException {
    InputStream  in  = socket.getInputStream();
    OutputStream out = socket.getOutputStream();

    BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));

    Net.throwSocketTimeoutExceptionForLongInactivity(socket);
    try {
        while (true) {
            // See throwSocketTimeoutExceptionForLongInactivity above
            String line = reader.readLine();

            // Socket closed
            if (line == null) break;

            int idx = line.indexOf(" ");
            String cursorString = line.substring(0, idx);
            int cursor = Integer.parseInt(cursorString);
            String buffer = line.substring(idx + 1);

            Completion completion = getCompletion(iloop);
            Candidates candidates = completion.completer().complete(buffer, cursor);

            out.write(("" + candidates.cursor()).getBytes("UTF-8"));

            List<String> list = candidates.candidates();
            Iterator<String> it = list.iterator();
            while (it.hasNext()) {
                String candidate = it.next();
                out.write(' ');
                out.write(candidate.getBytes("UTF-8"));
            }

            out.write('\n');
            out.flush();
        }
    } catch (IOException e) {
        // Socket closed
    }

    socketCleaner.run();

    // Before logging this out, wait a litte for System.out to be restored back to the target process
    Thread.sleep(1000);
    Log.log("Completer closed");
}
 

开发者ID:xitrum-framework,
项目名称:scalive,
代码行数:49,
代码来源:Completer.java

示例5: completion

点赞 2

import scala.tools.nsc.interpreter.Completion.Candidates; //导入依赖的package包/类
public List<String> completion(String buf, int cursor) {
    ScalaCompleter c = completor.completer();
    Candidates ret = c.complete(buf, cursor);
    return scala.collection.JavaConversions.asJavaList(ret.candidates());
}
 

开发者ID:Stratio,
项目名称:Explorer,
代码行数:6,
代码来源:SparkInterpreter.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)