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:
JDK 17 jdk.internal.le.jmod - Internal Line Editing Module
JDK 17 jdk.internal.le.jmod is the JMOD file for JDK 17 Internal Line Editing module.
JDK 17 Internal Line Editing module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.internal.le.jmod.
JDK 17 Internal Line Editing module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Internal Line Editing module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.internal.le.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/internal/org/jline/reader/impl/completer/ArgumentCompleter.java
/*
* Copyright (c) 2002-2019, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package jdk.internal.org.jline.reader.impl.completer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import jdk.internal.org.jline.reader.Candidate;
import jdk.internal.org.jline.reader.Completer;
import jdk.internal.org.jline.reader.LineReader;
import jdk.internal.org.jline.reader.ParsedLine;
/**
* A {@link Completer} implementation that invokes a child completer using the appropriate <i>separator</i> argument.
* This can be used instead of the individual completers having to know about argument parsing semantics.
*
* @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
* @since 2.3
*/
public class ArgumentCompleter implements Completer
{
private final List<Completer> completers = new ArrayList<>();
private boolean strict = true;
private boolean strictCommand = true;
/**
* Create a new completer.
*
* @param completers The embedded completers
*/
public ArgumentCompleter(final Collection<Completer> completers) {
Objects.requireNonNull(completers);
this.completers.addAll(completers);
}
/**
* Create a new completer.
*
* @param completers The embedded completers
*/
public ArgumentCompleter(final Completer... completers) {
this(Arrays.asList(completers));
}
/**
* If true, a completion at argument index N will only succeed
* if all the completions from 0-(N-1) also succeed.
*
* @param strict the strict flag
*/
public void setStrict(final boolean strict) {
this.strict = strict;
}
/**
* If true, a completion at argument index N will only succeed
* if all the completions from 1-(N-1) also succeed.
*
* @param strictCommand the strictCommand flag
*/
public void setStrictCommand(final boolean strictCommand) {
this.strictCommand = strictCommand;
}
/**
* Returns whether a completion at argument index N will success
* if all the completions from arguments 0-(N-1) also succeed.
*
* @return True if strict.
* @since 2.3
*/
public boolean isStrict() {
return this.strict;
}
/**
* Returns the list of completers used inside this <code>ArgumentCompleter</code>.
* @return The list of completers.
* @since 2.3
*/
public List<Completer> getCompleters() {
return completers;
}
public void complete(LineReader reader, ParsedLine line, final List<Candidate> candidates) {
Objects.requireNonNull(line);
Objects.requireNonNull(candidates);
if (line.wordIndex() < 0) {
return;
}
List<Completer> completers = getCompleters();
Completer completer;
// if we are beyond the end of the completers, just use the last one
if (line.wordIndex() >= completers.size()) {
completer = completers.get(completers.size() - 1);
}
else {
completer = completers.get(line.wordIndex());
}
// ensure that all the previous completers are successful before allowing this completer to pass (only if strict).
for (int i = strictCommand ? 0 : 1; isStrict() && (i < line.wordIndex()); i++) {
int idx = i >= completers.size() ? (completers.size() - 1) : i;
if (idx == 0 && !strictCommand) {
continue;
}
Completer sub = completers.get(idx);
List<? extends CharSequence> args = line.words();
String arg = (args == null || i >= args.size()) ? "" : args.get(i).toString();
List<Candidate> subCandidates = new LinkedList<>();
sub.complete(reader, new ArgumentLine(arg, arg.length()), subCandidates);
boolean found = false;
for (Candidate cand : subCandidates) {
if (cand.value().equals(arg)) {
found = true;
break;
}
}
if (!found) {
return;
}
}
completer.complete(reader, line, candidates);
}
public static class ArgumentLine implements ParsedLine {
private final String word;
private final int cursor;
public ArgumentLine(String word, int cursor) {
this.word = word;
this.cursor = cursor;
}
@Override
public String word() {
return word;
}
@Override
public int wordCursor() {
return cursor;
}
@Override
public int wordIndex() {
return 0;
}
@Override
public List<String> words() {
return Collections.singletonList(word);
}
@Override
public String line() {
return word;
}
@Override
public int cursor() {
return cursor;
}
}
}
⏎ jdk/internal/org/jline/reader/impl/completer/ArgumentCompleter.java
Or download all of them as a single archive file:
File name: jdk.internal.le-17.0.5-src.zip File size: 231458 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.internal.opt.jmod - Internal Opt Module
⇐ JDK 17 jdk.internal.jvmstat.jmod - Internal JVM Stat Module
2023-08-25, ≈26🔥, 0💬
Popular Posts:
Guava is a suite of core and expanded libraries that include utility classes, google's collections, ...
What Is javax.websocket-api-1.1. jar?javax.websocket-api-1.1. jaris the JAR file for Java API for We...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.0.2? The if y...
Java-WebSocket Source Code Files are provided in the source package file, java-websocket-1.5.4-src .z...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....