public class ScoredIdListBuilder extends Object implements org.apache.commons.lang3.builder.Builder<PackedScoredIdList>
| Constructor and Description |
|---|
ScoredIdListBuilder() |
ScoredIdListBuilder(int cap) |
| Modifier and Type | Method and Description |
|---|---|
ScoredIdListBuilder |
add(long id,
double score)
Add a scored ID without boxing.
|
ScoredIdListBuilder |
add(ScoredId id)
Add a scored ID.
|
ScoredIdListBuilder |
addAll(Iterable<ScoredId> ids)
Add a collection of IDs.
|
ScoredIdListBuilder |
addChannel(Symbol sym)
Add a side channel to the list builder with a default value of 0.
|
ScoredIdListBuilder |
addChannel(Symbol sym,
double dft)
Add a side channel to the list builder.
|
ScoredIdListBuilder |
addChannel(TypedSymbol<?> sym)
Add a side channel to the list builder.
|
<T> ScoredIdListBuilder |
addChannel(TypedSymbol<T> sym,
T dft)
Add a typed side channel to the list builder.
|
ScoredIdListBuilder |
addChannels(Iterable<Symbol> channels)
Add multiple unboxed channels with a default value of 0.
|
ScoredIdListBuilder |
addTypedChannels(Iterable<? extends TypedSymbol<?>> channels)
Add multiple channels with a default value of
null. |
PackedScoredIdList |
build() |
ScoredIdListBuilder |
failOnUnknownChannels()
Set the builder to fail on unknown channels.
|
PackedScoredIdList |
finish()
Destructive version of
build(), re-using storage if possible. |
ScoredIdListBuilder |
ignoreUnknownChannels()
Set the builder to ignore unknown channels on IDs passed to
add(ScoredId). |
int |
size()
Get the number of items currently in the builder.
|
ScoredIdListBuilder |
sort(Comparator<ScoredId> order)
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()
build(), re-using storage if possible. Future use of the
builder is impossible, and all memory used by it is released.public int size()
public ScoredIdListBuilder add(long id, double score)
id - The ID to add.score - The score for the ID.public ScoredIdListBuilder add(ScoredId id)
addChannel methods.id - The ID.public ScoredIdListBuilder addAll(Iterable<ScoredId> ids)
ids - The IDs to add.public ScoredIdListBuilder addChannel(Symbol sym)
add(ScoredId).sym - The symbol to add.addChannel(Symbol, double)public ScoredIdListBuilder addChannel(Symbol sym, double dft)
add(ScoredId).sym - The symbol to add.dft - The default value when adding IDs that lack this channel.public ScoredIdListBuilder addChannels(Iterable<Symbol> channels)
channels - The channels to add.public ScoredIdListBuilder addChannel(TypedSymbol<?> sym)
add(ScoredId).sym - The symbol to add.addChannel(TypedSymbol, Object)public <T> ScoredIdListBuilder addChannel(TypedSymbol<T> sym, T dft)
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)
null.channels - The channels to add.public ScoredIdListBuilder ignoreUnknownChannels()
add(ScoredId).public ScoredIdListBuilder failOnUnknownChannels()
public ScoredIdListBuilder sort(Comparator<ScoredId> order)
order - The comparator.Copyright © 2013 GroupLens Research. All Rights Reserved.