當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。