Top Description Fields Constructors Methods
jdk.internal.org.jline.utils

public Class AttributedString

extends AttributedCharSequence
Class Inheritance
Imports
java.security.InvalidParameterException, java.util.Arrays, .List, .Objects, java.util.regex.Matcher, .Pattern

Attributed string. Instances of this class are immutables. Substrings are created without any memory copy.
Author
Guillaume Nodet

Field Summary

Modifier and TypeField and Description
pack-priv final char[]
public static final AttributedString
pack-priv final int
public static final AttributedString
pack-priv final int
pack-priv final long[]
Inherited from jdk.internal.org.jline.utils.AttributedCharSequence:
DISABLE_ALTERNATE_CHARSETTRUE_COLORS

Constructor Summary

AccessConstructor and Description
public
public
AttributedString(CharSequence str, int start, int end)

public
public
AttributedString(CharSequence str, int start, int end, AttributedStyle s)

pack-priv
AttributedString(char[] buffer, long[] style, int start, int end)

Method Summary

Modifier and TypeMethod and Description
private boolean
arrEq(char[] a1, char[] a2, int s1, int s2, int l)

private boolean
arrEq(long[] a1, long[] a2, int s1, int s2, int l)

protected char[]
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static AttributedString
public static AttributedString
fromAnsi(String ansi, int tabs)

public static AttributedString
fromAnsi(String ansi, List<Integer> tabs)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public static AttributedString
join(AttributedString delimiter, AttributedString... elements)

public static AttributedString
public int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.
protected int
public static String
public AttributedStyle
pack-priv long
public AttributedString
public AttributedString
subSequence(int
the start index, inclusive
start
,
int
the end index, exclusive
end
)

Implements abstract jdk.internal.org.jline.utils.AttributedCharSequence.subSequence.

Implements java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence.
Inherited from jdk.internal.org.jline.utils.AttributedCharSequence:
charAtcodePointAtcodePointBeforecodePointCountcolumnLengthcolumnSplitLengthcolumnSplitLengthcolumnSubSequencecontainsisHiddenprintprintlnrgbColorroundColorroundRgbColorrunLimitrunStartsubstringtoAnsitoAnsitoAnsitoAnsitoAnsitoAnsitoAnsitoAttributedStringtoString

Field Detail

bufferback to summary
pack-priv final char[] buffer
EMPTYback to summary
public static final AttributedString EMPTY
endback to summary
pack-priv final int end
NEWLINEback to summary
public static final AttributedString NEWLINE
startback to summary
pack-priv final int start
styleback to summary
pack-priv final long[] style

Constructor Detail

AttributedStringback to summary
public AttributedString(CharSequence str)
AttributedStringback to summary
public AttributedString(CharSequence str, int start, int end)
AttributedStringback to summary
public AttributedString(CharSequence str, AttributedStyle s)
AttributedStringback to summary
public AttributedString(CharSequence str, int start, int end, AttributedStyle s)
AttributedStringback to summary
pack-priv AttributedString(char[] buffer, long[] style, int start, int end)

Method Detail

arrEqback to summary
private boolean arrEq(char[] a1, char[] a2, int s1, int s2, int l)
arrEqback to summary
private boolean arrEq(long[] a1, long[] a2, int s1, int s2, int l)
bufferback to summary
protected char[] buffer()

Implements abstract jdk.internal.org.jline.utils.AttributedCharSequence.buffer.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fromAnsiback to summary
public static AttributedString fromAnsi(String ansi)
fromAnsiback to summary
public static AttributedString fromAnsi(String ansi, int tabs)
fromAnsiback to summary
public static AttributedString fromAnsi(String ansi, List<Integer> tabs)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
joinback to summary
public static AttributedString join(AttributedString delimiter, AttributedString... elements)
joinback to summary
public static AttributedString join(AttributedString delimiter, Iterable<AttributedString> elements)
lengthback to summary
public int length()

Implements java.lang.CharSequence.length.

Doc from java.lang.CharSequence.length.

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Returns:int

the number of chars in this sequence

Annotations
@Override
offsetback to summary
protected int offset()

Implements abstract jdk.internal.org.jline.utils.AttributedCharSequence.offset.

Annotations
@Override
stripAnsiback to summary
public static String stripAnsi(String ansi)
styleAtback to summary
public AttributedStyle styleAt(int index)

Implements abstract jdk.internal.org.jline.utils.AttributedCharSequence.styleAt.

Annotations
@Override
styleCodeAtback to summary
pack-priv long styleCodeAt(int index)

Overrides jdk.internal.org.jline.utils.AttributedCharSequence.styleCodeAt.

Annotations
@Override
styleMatchesback to summary
public AttributedString styleMatches(Pattern pattern, AttributedStyle style)
subSequenceback to summary
public AttributedString subSequence(int start, int end)

Implements abstract jdk.internal.org.jline.utils.AttributedCharSequence.subSequence.

Implements java.lang.CharSequence.subSequence.

Doc from java.lang.CharSequence.subSequence.

Returns a CharSequence that is a subsequence of this sequence. The subsequence starts with the char value at the specified index and ends with the char value at index end - 1. The length (in chars) of the returned sequence is end - start, so if start == end then an empty sequence is returned.

Parameters
start:int

the start index, inclusive

end:int

the end index, exclusive

Returns:AttributedString

the specified subsequence

Annotations
@Override