当前位置: 首页>>代码示例>>Java>>正文


Java NativeTradeItem类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:17,代码来源:NativeTrade.java

示例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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:NativeTrade.java

示例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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:NativeTrade.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:NativeTrade.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:NativeTrade.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:NativeTrade.java

示例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;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:NativeTrade.java

示例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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:NativeTrade.java

示例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());
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:NativeTrade.java


注:本文中的net.sf.freecol.common.model.NativeTradeItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。