Top Description Methods
org.apache.commons.text.similarity

public Interface SimilarityInput<E>

Known Direct Implementers
org.apache.commons.text.similarity.SimilarityCharacterInput
Type Parameters
<E>
the type of elements in this input.
Imports
java.util.Objects

An ordered input of elements used to compute a similarity score.

You can implement a SimilarityInput on a domain object instead of CharSequence where implementing CharSequence does not make sense.

Since
1.13.0

Method Summary

Modifier and TypeMethod and Description
public E

Returns:

the element in the input at the given 0-based index.
at
(int
a 0-based index.
index
)

Gets the element in the input at the given 0-based index.

public static SimilarityInput<Character>

Returns:

a new input.
input
(final CharSequence
input character sequence.
cs
)

Creates a new input for a CharSequence.

public static <
The type of similarity score unit.
T
>
SimilarityInput<T>

Returns:

a new input.
input
(final Object
character sequence or similarity input.
input
)

Creates a new input for a CharSequence or SimilarityInput.

public int

Returns:

the length of the input.
length
()

Gets the length of the input.

Method Detail

atback to summary
public E at(int index)

Gets the element in the input at the given 0-based index.

Parameters
index:int

a 0-based index.

Returns:E

the element in the input at the given 0-based index.

inputback to summary
public static SimilarityInput<Character> input(final CharSequence cs)

Creates a new input for a CharSequence.

Parameters
cs:CharSequence

input character sequence.

Returns:SimilarityInput<Character>

a new input.

inputback to summary
public static <T> SimilarityInput<T> input(final Object input)

Creates a new input for a CharSequence or SimilarityInput.

Parameters
<T>
The type of similarity score unit.
input:Object

character sequence or similarity input.

Returns:SimilarityInput<T>

a new input.

Annotations
@SuppressWarnings:unchecked
Exceptions
IllegalArgumentException:
when the input type is neither CharSequence or SimilarityInput.
lengthback to summary
public int length()

Gets the length of the input.

Returns:int

the length of the input.