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/utils/DiffHelper.java
/*
* Copyright (c) 2002-2016, 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.utils;
import java.util.LinkedList;
import java.util.List;
/**
* Class containing the diff method.
* This diff is ANSI aware and will correctly handle text attributes
* so that any text in a Diff object is a valid ansi string.
*/
public class DiffHelper {
/**
* The data structure representing a diff is a Linked list of Diff objects:
* {Diff(Operation.DELETE, "Hello"), Diff(Operation.INSERT, "Goodbye"),
* Diff(Operation.EQUAL, " world.")}
* which means: delete "Hello", add "Goodbye" and keep " world."
*/
public enum Operation {
DELETE, INSERT, EQUAL
}
/**
* Class representing one diff operation.
*/
public static class Diff {
/**
* One of: INSERT, DELETE or EQUAL.
*/
public final Operation operation;
/**
* The text associated with this diff operation.
*/
public final AttributedString text;
/**
* Constructor. Initializes the diff with the provided values.
* @param operation One of INSERT, DELETE or EQUAL.
* @param text The text being applied.
*/
public Diff(Operation operation, AttributedString text) {
// Construct a diff with the specified operation and text.
this.operation = operation;
this.text = text;
}
/**
* Display a human-readable version of this Diff.
* @return text version.
*/
public String toString() {
return "Diff(" + this.operation + ",\"" + this.text + "\")";
}
}
/**
* Compute a list of difference between two lines.
* The result will contain at most 4 Diff objects, as the method
* aims to return the common prefix, inserted text, deleted text and
* common suffix.
* The computation is done on characters and their attributes expressed
* as ansi sequences.
*
* @param text1 the old line
* @param text2 the new line
* @return a list of Diff
*/
public static List<Diff> diff(AttributedString text1, AttributedString text2) {
int l1 = text1.length();
int l2 = text2.length();
int n = Math.min(l1, l2);
int commonStart = 0;
// Given a run of contiguous "hidden" characters (which are
// sequences of uninterrupted escape sequences) we always want to
// print either the entire run or none of it - never a part of it.
int startHiddenRange = -1;
while (commonStart < n
&& text1.charAt(commonStart) == text2.charAt(commonStart)
&& text1.styleAt(commonStart).equals(text2.styleAt(commonStart))) {
if (text1.isHidden(commonStart)) {
if (startHiddenRange < 0)
startHiddenRange = commonStart;
} else
startHiddenRange = -1;
commonStart++;
}
if (startHiddenRange >= 0
&& ((l1 > commonStart && text1.isHidden(commonStart))
|| (l2 > commonStart && text2.isHidden(commonStart))))
commonStart = startHiddenRange;
startHiddenRange = -1;
int commonEnd = 0;
while (commonEnd < n - commonStart
&& text1.charAt(l1 - commonEnd - 1) == text2.charAt(l2 - commonEnd - 1)
&& text1.styleAt(l1 - commonEnd - 1).equals(text2.styleAt(l2 - commonEnd - 1))) {
if (text1.isHidden(l1 - commonEnd - 1)) {
if (startHiddenRange < 0)
startHiddenRange = commonEnd;
} else
startHiddenRange = -1;
commonEnd++;
}
if (startHiddenRange >= 0)
commonEnd = startHiddenRange;
LinkedList<Diff> diffs = new LinkedList<>();
if (commonStart > 0) {
diffs.add(new Diff(DiffHelper.Operation.EQUAL,
text1.subSequence(0, commonStart)));
}
if (l2 > commonStart + commonEnd) {
diffs.add(new Diff(DiffHelper.Operation.INSERT,
text2.subSequence(commonStart, l2 - commonEnd)));
}
if (l1 > commonStart + commonEnd) {
diffs.add(new Diff(DiffHelper.Operation.DELETE,
text1.subSequence(commonStart, l1 - commonEnd)));
}
if (commonEnd > 0) {
diffs.add(new Diff(DiffHelper.Operation.EQUAL,
text1.subSequence(l1 - commonEnd, l1)));
}
return diffs;
}
}
⏎ jdk/internal/org/jline/utils/DiffHelper.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, ≈22🔥, 0💬
Popular Posts:
Apache Ant Source Code Files are inside the Apache Ant source package file like apache-ant-1.10.10-s...
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...
What Is commons-lang3-3.1.jar? commons-lang3-3.1.jar is the JAR file for Apache Commons Lang 3.1, wh...
What Is poi-examples-5.2.3.jar? poi-examples-5.2.3.jar is one of the JAR files for Apache POI 5.2.3,...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...