本文整理汇总了Java中net.sf.freecol.common.model.NativeTradeItem类的典型用法代码示例。如果您正苦于以下问题:Java NativeTradeItem类的具体用法?Java NativeTradeItem怎么用?Java NativeTradeItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NativeTradeItem类属于net.sf.freecol.common.model包,在下文中一共展示了NativeTradeItem类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: limitSettlementToUnit
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Limit the number of items offered by the settlement.
*
* Used in the client to implement a Col1 restriction.
*
* @param n The number of items to offer.
*/
public void limitSettlementToUnit(int n) {
List<NativeTradeItem> best = transform(this.settlementToUnit,
NativeTradeItem::priceIsValid, Function.identity(),
NativeTradeItem.descendingPriceComparator);
if (best.size() <= n) return;
for (NativeTradeItem nti : best.subList(n, best.size())) {
nti.setPrice(NativeTradeItem.PRICE_INVALID);
}
}
示例2: canBuy
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Can the unit owner buy more items in this session at present?
*
* @return True if not blocked, at peace, there are purchases to
* be made and space available.
*/
public boolean canBuy() {
return getBuy() && !atWar() && this.unit.getSpaceLeft() > 0
&& any(getSettlementToUnit(), NativeTradeItem::priceIsValid);
}
示例3: canSell
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Can the unit owner buy more items in this session at present?
*
* @return True if not blocked, at peace, and there are sales to be made.
*/
public boolean canSell() {
return getSell() && !atWar()
&& any(getUnitToSettlement(), NativeTradeItem::priceIsValid);
}
示例4: getItem
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Get the item being traded.
*
* @return The current {@code NativeTradeItem}.
*/
public NativeTradeItem getItem() {
return this.item;
}
示例5: setItem
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Set the item being traded.
*
* @param nti The new {@code NativeTradeItem}.
*/
public void setItem(NativeTradeItem nti) {
this.item = nti;
}
示例6: getUnitToSettlement
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Get the list of items the unit is able to offer the settlement.
*
* Note: some of these items might be currently invalid.
*
* @return A list of {@code NativeTradeItem}s the unit might sell.
*/
public List<NativeTradeItem> getUnitToSettlement() {
return this.unitToSettlement;
}
示例7: getSettlementToUnit
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Get the list of items the settlement is able to offer the unit.
*
* Note: some of these items might be currently invalid.
*
* @return A list of {@code NativeTradeItem}s the unit might buy.
*/
public List<NativeTradeItem> getSettlementToUnit() {
return this.settlementToUnit;
}
示例8: addToUnit
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Add an item to the unit list of items.
*
* @param nti The {@code NativeTradeItem} to add.
*/
public void addToUnit(NativeTradeItem nti) {
this.unitToSettlement.add(nti);
}
示例9: removeFromUnit
import net.sf.freecol.common.model.NativeTradeItem; //导入依赖的package包/类
/**
* Remove an item from the unit list of items.
*
* @param nti The {@code NativeTradeItem} to remove.
*/
public void removeFromUnit(NativeTradeItem nti) {
removeInPlace(this.unitToSettlement, nti.goodsMatcher());
}