public class PoolTradeSlot extends TradeSlot
Class PoolTradeSlot. Provides pooltradeslot functionality for the Hytale server.
java.lang.Object > TradeSlot > PoolTradeSlot
Field Summary
slotCount
protected
int
slotCount
Field slotCount.
trades
protected
WeightedTrade[]
trades
Field trades.
result
final
List
result
Field result.
available
final
ObjectArrayList
available
Field available.
selectedIndex
final
int
selectedIndex
Field selectedIndex.
selected
final
WeightedTrade
selected
Field selected.
roll
final
double
roll
Field roll.
Method Detail
PoolTradeSlot
public
public
PoolTradeSlot
(final int slotCount, @Nonnull final WeightedTrade[] trades)
Method PoolTradeSlot.
- Parameters:
final intslotCount@Nonnull final WeightedTrade[]trades
getPoolSlotCount
public
int
getPoolSlotCount
()
Method getPoolSlotCount.
getTrades
public
WeightedTrade[]
getTrades
()
Method getTrades.
resolve
public
List
resolve
(@Nonnull final Random random)
Method resolve.
- Parameters:
@Nonnull final Randomrandom
getSlotCount
public
int
getSlotCount
()
Method getSlotCount.
selectWeightedIndex
private
int
selectWeightedIndex
(@Nonnull final List trades, @Nonnull final Random random)
Method selectWeightedIndex.
- Parameters:
@Nonnull final Listtrades@Nonnull final Randomrandom
toString
public
String
toString
()
Method toString.
KeyedCodec
public
new
KeyedCodec
("Trades", new ArrayCodec(WeightedTrade.CODEC, WeightedTrade[]::new)
Method KeyedCodec.
- Parameters:
"Trades""Trades"newArrayCodec(WeightedTrade.CODECWeightedTrade[]::newWeightedTrade[]::new