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


Java FreeColXMLReader.getAttribute方法代码示例

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


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

示例1: readAttributes

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

    final AIMain aiMain = getAIMain();
    final Specification spec = getSpecification();

    // Delegated from Wish
    transportable = (xr.hasAttribute(TRANSPORTABLE_TAG))
        ? xr.makeAIObject(aiMain, TRANSPORTABLE_TAG,
                          AIGoods.class, (AIGoods)null, true)
        : null;

    goodsType = xr.getType(spec, GOODS_TYPE_TAG,
                           GoodsType.class, (GoodsType)null);

    amountRequested = xr.getAttribute(AMOUNT_REQUESTED_TAG,
                                      GoodsContainer.CARGO_SIZE);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:23,代码来源:GoodsWish.java

示例2: readChildren

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readChildren(FreeColXMLReader xr) throws XMLStreamException {
    // We can not set the value until we have read the select options
    // so as to be able to check its validity.
    String value = xr.getAttribute(VALUE_TAG, (String)null);
    String defaultValue = xr.getAttribute(DEFAULT_VALUE_TAG, (String)null);

    // Clear containers.
    clearItemValues();
    
    super.readChildren(xr);

    // Now we can correctly set the value.
    setValue(value, defaultValue);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:19,代码来源:SelectOption.java

示例3: readAttributes

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

    int width = xr.getAttribute(WIDTH_TAG, -1);
    if (width < 0) {
        throw new XMLStreamException("Bogus width: " + width);
    }
    int height = xr.getAttribute(HEIGHT_TAG, -1);
    if (height < 0) {
        throw new XMLStreamException("Bogus height: " + height);
    }
    setTiles(width, height);

    setLayer(xr.getAttribute(LAYER_TAG, Layer.class, Layer.ALL));

    minimumLatitude = xr.getAttribute(MINIMUM_LATITUDE_TAG, -90);

    maximumLatitude = xr.getAttribute(MAXIMUM_LATITUDE_TAG, 90);

    calculateLatitudePerRow();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:26,代码来源:Map.java

示例4: readAttributes

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

    final AIMain aiMain = getAIMain();
    final Specification spec = getSpecification();
    
    type = xr.getType(spec, TYPE_TAG, 
                      TileImprovementType.class, (TileImprovementType)null);

    pioneer = (xr.hasAttribute(PIONEER_TAG))
        ? xr.makeAIObject(aiMain, PIONEER_TAG,
                          AIUnit.class, (AIUnit)null, true)
        : null;

    target = xr.getAttribute(getGame(), TARGET_TAG,
                             Tile.class, (Tile)null);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:22,代码来源:TileImprovementPlan.java

示例5: readChild

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

    if (MARKET_TAG.equals(tag)) {
        initialAmount = xr.getAttribute(INITIAL_AMOUNT_TAG, 0);

        initialPrice = xr.getAttribute(INITIAL_PRICE_TAG, 1);

        priceDiff = xr.getAttribute(PRICE_DIFFERENCE_TAG, 1);

        xr.closeTag(MARKET_TAG);

    } else {
        super.readChild(xr);
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:21,代码来源:GoodsType.java

示例6: readAttributes

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

    maxValue = xr.getAttribute(MAXIMUM_VALUE_TAG, -1);
    minValue = xr.getAttribute(MINIMUM_VALUE_TAG, -1);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:ResourceType.java

示例7: readChild

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readChild(FreeColXMLReader xr) throws XMLStreamException {
    final Specification spec = getSpecification();
    final String tag = xr.getLocalName();

    if (TILE_TYPE_CHANGE_TAG.equals(tag)
        // @compat 0.11.6
        || OLD_CHANGE_TAG.equals(tag)
        // end @compat 0.11.6
        ) {
        TileTypeChange change = new TileTypeChange(xr, spec);
        if (change != null) addChange(change);

    } else if (DISASTER_TAG.equals(tag)) {
        Disaster disaster = xr.getType(spec, ID_ATTRIBUTE_TAG,
                                       Disaster.class, (Disaster)null);
        int probability = xr.getAttribute(PROBABILITY_TAG, 100);
        addDisaster(disaster, probability);
        xr.closeTag(DISASTER_TAG);

    } else if (WORKER_TAG.equals(tag)) {
        addAllowedWorker(xr.readId());
        xr.closeTag(WORKER_TAG);

    } else {
        super.readChild(xr);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:32,代码来源:TileImprovementType.java

示例8: readAttributes

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

    roleId = xr.getAttribute(ROLE_TAG, Specification.DEFAULT_ROLE_ID);

    number = xr.getAttribute(NUMBER_TAG, 1);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:12,代码来源:AbstractUnit.java

示例9: 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();

    type = xr.getType(spec, NATION_TYPE_TAG,
                      NationType.class, (NationType)null);

    selectable = xr.getAttribute(SELECTABLE_TAG, false);

    // @compat 0.11.3
    if (xr.hasAttribute(OLD_PREFERRED_LATITUDE_TAG)) {
        preferredLatitude = xr.getAttribute(OLD_PREFERRED_LATITUDE_TAG, 0);
    } else
    // end @compat 0.11.3
        preferredLatitude = xr.getAttribute(PREFERRED_LATITUDE_TAG, 0);

    // @compat 0.11.3
    if (xr.hasAttribute(OLD_STARTS_ON_EAST_COAST_TAG)) {
        startsOnEastCoast = xr.getAttribute(OLD_STARTS_ON_EAST_COAST_TAG, true);
    } else
    // end @compat 0.11.3
        startsOnEastCoast = xr.getAttribute(STARTS_ON_EAST_COAST_TAG, true);

    refNation = xr.getType(spec, REF_TAG, Nation.class, (Nation)null);

    int rgb = xr.getAttribute(COLOR_TAG, UNDEFINED);
    if (rgb != UNDEFINED) setColor(new Color(rgb));
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:34,代码来源:Nation.java

示例10: readAttributes

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

    colonyId = xr.getAttribute(COLONY_TAG, (String)null);

    colonyName = xr.getAttribute(COLONY_NAME_TAG, (String)null);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:12,代码来源:ColonyTradeItem.java

示例11: readAttributes

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

    target = xr.getAttribute(getGame(), SETTLEMENT_TAG,
                             Settlement.class, (Settlement)null);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:11,代码来源:DefendSettlementMission.java

示例12: readAttributes

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

    index = xr.getAttribute(INDEX_TAG, 0);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:10,代码来源:CompoundMission.java

示例13: readAttributes

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

    maximumNumber = xr.getAttribute(MAXIMUM_NUMBER_TAG, 1);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:ListOption.java

示例14: readAttributes

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

    stance = xr.getAttribute(STANCE_TAG, Stance.class, Stance.PEACE);

    numberOfSettlements = xr.getAttribute(NUMBER_OF_SETTLEMENTS_TAG, -1);

    numberOfUnits = xr.getAttribute(NUMBER_OF_UNITS_TAG, -1);

    militaryStrength = xr.getAttribute(MILITARY_STRENGTH_TAG, -1);

    navalStrength = xr.getAttribute(NAVAL_STRENGTH_TAG, -1);

    gold = xr.getAttribute(GOLD_TAG, -1);

    soL = xr.getAttribute(SOL_TAG, -1);

    foundingFathers = xr.getAttribute(FOUNDING_FATHERS_TAG, -1);

    tax = xr.getAttribute(TAX_TAG, -1);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:26,代码来源:NationSummary.java

示例15: readFromXML

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
public void readFromXML(AIMain aiMain, FreeColXMLReader xr) throws XMLStreamException {
    final Game game = aiMain.getGame();

    String tid = xr.readId();
    TransportableAIObject tao = null;
    if (tid != null) {
        AIObject aio = aiMain.getAIObject(tid);
        if (aio == null) {
            if (tid.startsWith(Unit.TAG)) {
                tao = new AIUnit(aiMain, tid);
            } else if (tid.startsWith(AIGoods.TAG)) {
                tao = new AIGoods(aiMain, tid);
            }
        } else {
            tao = (TransportableAIObject)aio;
        }
    }
    if (tao == null) {
        throw new XMLStreamException("Transportable expected: " + tid);
    }
    this.transportable = tao;

    this.carrier = xr.getAttribute(game, CARRIER_TAG,
                                   Unit.class, (Unit)null);

    this.tries = xr.getAttribute(TRIES_TAG, 0);
    
    this.spaceLeft = xr.getAttribute(SPACELEFT_TAG, -1);
        
    this.wrapped = null;

    this.plan = new CargoPlan();

    this.plan.twait = xr.getLocationAttribute(game, TWAIT_TAG, false);

    this.plan.cwait = xr.getLocationAttribute(game, CWAIT_TAG, false);

    this.plan.cdst = xr.getLocationAttribute(game, CDST_TAG, false);

    this.plan.tdst = xr.getLocationAttribute(game, TDST_TAG, false);
        
    this.plan.turns = xr.getAttribute(TURNS_TAG, -1);

    this.plan.mode = xr.getAttribute(MODE_TAG, 
                                     CargoMode.class, (CargoMode)null);

    this.plan.fallback = xr.getAttribute(FALLBACK_TAG, false);

    xr.closeTag(TAG);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:51,代码来源:Cargo.java


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