@Deprecated public class ScoredIdListBuilder extends Object implements org.apache.commons.lang3.builder.Builder<PackedScoredIdList>
Builder for packed lists of scored ids. All ids in the resulting list will have the same set of side channels.
Constructor and Description |
---|
ScoredIdListBuilder()
Deprecated.
|
ScoredIdListBuilder(int cap)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ScoredIdListBuilder |
add(long id,
double score)
Deprecated.
Add a scored ID without boxing.
|
ScoredIdListBuilder |
add(ScoredId id)
Deprecated.
Add a scored ID.
|
ScoredIdListBuilder |
addAll(Iterable<ScoredId> ids)
Deprecated.
Add a collection of IDs.
|
ScoredIdListBuilder |
addChannel(Symbol sym)
Deprecated.
Add a side channel to the list builder with a default value of 0.
|
ScoredIdListBuilder |
addChannel(Symbol sym,
double dft)
Deprecated.
Add a side channel to the list builder.
|
ScoredIdListBuilder |
addChannel(TypedSymbol<?> sym)
Deprecated.
Add a side channel to the list builder.
|
<T> ScoredIdListBuilder |
addChannel(TypedSymbol<T> sym,
T dft)
Deprecated.
Add a typed side channel to the list builder.
|
ScoredIdListBuilder |
addChannels(Iterable<Symbol> channels)
Deprecated.
Add multiple unboxed channels with a default value of 0.
|
ScoredIdListBuilder |
addTypedChannels(Iterable<? extends TypedSymbol<?>> channels)
Deprecated.
Add multiple channels with a default value of
null . |
PackedScoredIdList |
build()
Deprecated.
|
ImmutableSparseVector |
buildVector()
Deprecated.
Build a sparse vector directly from the list of IDs.
|
void |
clear()
Deprecated.
Clear the builder.
|
ScoredIdListBuilder |
failOnUnknownChannels()
Deprecated.
Set the builder to fail on unknown channels.
|
PackedScoredIdList |
finish()
Deprecated.
Destructive version of
build() , re-using storage if possible. |
ScoredIdListBuilder |
ignoreUnknownChannels()
Deprecated.
Set the builder to ignore unknown channels on IDs passed to
add(ScoredId) . |
int |
size()
Deprecated.
Get the number of items currently in the builder.
|
ScoredIdListBuilder |
sort(Comparator<ScoredId> order)
Deprecated.
Sort the list-in-progress by the specified comparator.
|
public ScoredIdListBuilder()
public ScoredIdListBuilder(int cap)
public PackedScoredIdList build()
build
in interface org.apache.commons.lang3.builder.Builder<PackedScoredIdList>
public PackedScoredIdList finish()
Destructive version of build()
, re-using storage if possible. Future use of the builder is impossible, and all memory used by it is released.
public void clear()
Clear the builder. After it is cleared, it can no longer be used.
public ImmutableSparseVector buildVector()
Build a sparse vector directly from the list of IDs. This allows a scored ID list builder to be used to efficiently accumulate a sparse vector. If the same ID is added multiple times, the first instance is used.
public int size()
Get the number of items currently in the builder.
public ScoredIdListBuilder add(long id, double score)
Add a scored ID without boxing. The default value will be used for each channel.
id
- The ID to add.score
- The score for the ID.public ScoredIdListBuilder add(ScoredId id)
Add a scored ID. The ID is copied into the builder, not referenced. All side channels on the ID must have already been added with one of the addChannel
methods.
id
- The ID.public ScoredIdListBuilder addAll(Iterable<ScoredId> ids)
Add a collection of IDs. The IDs are copied into the builder, not referenced.
ids
- The IDs to add.public ScoredIdListBuilder addChannel(Symbol sym)
Add a side channel to the list builder with a default value of 0. It is an error to add the same symbol multiple times. All side channels that will be used must be added prior to calling add(ScoredId)
.
sym
- The symbol to add.addChannel(Symbol, double)
public ScoredIdListBuilder addChannel(Symbol sym, double dft)
Add a side channel to the list builder. It is an error to add the same symbol multiple times. All side channels that will be used must be added prior to calling add(ScoredId)
.
sym
- The symbol to add.dft
- The default value when adding IDs that lack this channel.public ScoredIdListBuilder addChannels(Iterable<Symbol> channels)
Add multiple unboxed channels with a default value of 0.
channels
- The channels to add.public ScoredIdListBuilder addChannel(TypedSymbol<?> sym)
Add a side channel to the list builder. It is an error to add the same symbol multiple times. All side channels that will be used must be added prior to calling add(ScoredId)
.
sym
- The symbol to add.addChannel(TypedSymbol, Object)
public <T> ScoredIdListBuilder addChannel(TypedSymbol<T> sym, T dft)
Add a typed side channel to the list builder. It is an error to add the same symbol multiple times. All side channels that will be used must be added prior to calling add(ScoredId)
.
sym
- The symbol to add.dft
- The default value when adding ids that lack this channel. If null
, it will be omitted from such ids.public ScoredIdListBuilder addTypedChannels(Iterable<? extends TypedSymbol<?>> channels)
Add multiple channels with a default value of null
.
channels
- The channels to add.public ScoredIdListBuilder ignoreUnknownChannels()
Set the builder to ignore unknown channels on IDs passed to add(ScoredId)
.
public ScoredIdListBuilder failOnUnknownChannels()
Set the builder to fail on unknown channels. This is the default response to unknown channels.
public ScoredIdListBuilder sort(Comparator<ScoredId> order)
Sort the list-in-progress by the specified comparator.
order
- The comparator.