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


Java FreeColXMLReader.shouldIntern方法代码示例

本文整理汇总了Java中net.sf.freecol.common.io.FreeColXMLReader.shouldIntern方法的典型用法代码示例。如果您正苦于以下问题:Java FreeColXMLReader.shouldIntern方法的具体用法?Java FreeColXMLReader.shouldIntern怎么用?Java FreeColXMLReader.shouldIntern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.freecol.common.io.FreeColXMLReader的用法示例。


在下文中一共展示了FreeColXMLReader.shouldIntern方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    final Game game = getGame();

    name = xr.getAttribute(NAME_TAG, (String)null);

    Player oldOwner = owner;
    owner = xr.findFreeColGameObject(game, OWNER_TAG,
                                     Player.class, (Player)null, true);
    if (xr.shouldIntern()) game.checkOwners(this, oldOwner);

    tile = xr.findFreeColGameObject(game, TILE_TAG,
                                    Tile.class, (Tile)null, true);

    String newType = xr.getAttribute(SETTLEMENT_TYPE_TAG, (String)null);
    type = owner.getNationType().getSettlementType(newType);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:23,代码来源:Settlement.java

示例2: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    if (xr.shouldIntern()) internId(getId());
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:FreeColGameObject.java

示例3: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    final Specification spec = getSpecification();
    final Game game = getGame();

    name = xr.getAttribute(NAME_TAG, (String)null);

    Player oldOwner = owner;
    owner = xr.findFreeColGameObject(game, OWNER_TAG,
                                     Player.class, (Player)null, true);
    if (xr.shouldIntern()) game.checkOwners(this, oldOwner);

    UnitType oldUnitType = this.type;
    this.type = xr.getType(spec, UNIT_TYPE_TAG,
                           UnitType.class, (UnitType)null);

    state = xr.getAttribute(STATE_TAG, UnitState.class, UnitState.ACTIVE);

    role = xr.getType(spec, ROLE_TAG, Role.class, spec.getDefaultRole());

    roleCount = xr.getAttribute(ROLE_COUNT_TAG, role.getMaximumCount());

    setLocationNoUpdate(xr.getLocationAttribute(game, LOCATION_TAG, true));

    entryLocation = xr.getLocationAttribute(game, ENTRY_LOCATION_TAG,
                                            true);

    movesLeft = xr.getAttribute(MOVES_LEFT_TAG, 0);

    workLeft = xr.getAttribute(WORK_LEFT_TAG, 0);

    attrition = xr.getAttribute(ATTRITION_TAG, 0);

    nationality = xr.getAttribute(NATIONALITY_TAG, (String)null);

    ethnicity = xr.getAttribute(ETHNICITY_TAG, (String)null);

    turnsOfTraining = xr.getAttribute(TURNS_OF_TRAINING_TAG, 0);

    hitPoints = xr.getAttribute(HIT_POINTS_TAG, -1);

    teacher = xr.makeFreeColObject(game, TEACHER_TAG, Unit.class, false);

    student = xr.makeFreeColObject(game, STUDENT_TAG, Unit.class, false);

    setHomeIndianSettlement(xr.makeFreeColObject(game,
            INDIAN_SETTLEMENT_TAG, IndianSettlement.class, false));

    treasureAmount = xr.getAttribute(TREASURE_AMOUNT_TAG, 0);

    destination = xr.getLocationAttribute(game, DESTINATION_TAG, true);

    tradeRoute = xr.findFreeColGameObject(game, TRADE_ROUTE_TAG,
        TradeRoute.class, (TradeRoute)null, false);

    currentStop = (tradeRoute == null) ? -1
        : xr.getAttribute(CURRENT_STOP_TAG, 0);

    experienceType = xr.getType(spec, EXPERIENCE_TYPE_TAG,
                                GoodsType.class, (GoodsType)null);
    if (experienceType == null && workType != null) {
        experienceType = workType;
    }

    experience = xr.getAttribute(EXPERIENCE_TAG, 0);

    visibleGoodsCount = xr.getAttribute(VISIBLE_GOODS_COUNT_TAG, -1);

    // Make sure you do this after experience and location stuff.
    changeWorkType(xr.getType(spec, WORK_TYPE_TAG, GoodsType.class, null));
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:77,代码来源:Unit.java


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