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


Java FreeColXMLReader.closeTag方法代码示例

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


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

示例1: 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 (UNIT_TAG.equals(tag)) {
        addUnit(new AbstractUnit(xr));

    } else if (Event.TAG.equals(tag)) {
        addEvent(new Event(xr, spec));

    // @compat 0.11.6
    } else if (UPGRADE_TAG.equals(tag)) {
        xr.closeTag(UPGRADE_TAG);
    // end @compat 0.11.6

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

示例2: 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

示例3: readChild

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

    if (KEY_TAG.equals(tag)) {
        addKey(xr.getAttribute(VALUE_TAG, (String)null));
        xr.closeTag(KEY_TAG);

    } else if (StringTemplate.TAG.equals(tag)) {
        addReplacement(new StringTemplate(xr));
    
    } else {
        super.readChild(xr);
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:19,代码来源:StringTemplate.java

示例4: readFromXMLPartial

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Updates this object from an XML-representation of this object.
 *
 * All attributes are considered visible as this is
 * server-to-owner-client functionality.  It depends ultimately on
 * the presence of a setFieldName() method that takes a parameter
 * type T where T.valueOf(String) exists.
 *
 * @param xr The input stream with the XML.
 * @exception XMLStreamException if a problem was encountered
 *      during parsing.
 */
public final void readFromXMLPartial(FreeColXMLReader xr) throws XMLStreamException {
    final Class theClass = getClass();
    final String tag = xr.getLocalName();
    int n = xr.getAttributeCount();

    setId(xr.readId());

    for (int i = 0; i < n; i++) {
        String name = xr.getAttributeLocalName(i);

        if (ID_ATTRIBUTE_TAG.equals(name)
            || PARTIAL_ATTRIBUTE_TAG.equals(name)) continue;

        try {
            Introspector intro = new Introspector(theClass, name);
            intro.setter(this, xr.getAttributeValue(i));

        } catch (Exception e) {
            logger.log(Level.WARNING, "Could not set field " + name, e);
        }
    }

    xr.closeTag(tag);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:37,代码来源:FreeColObject.java

示例5: 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 (CARGO_TAG.equals(tag)) {
        cargo.add(xr.getType(spec, ID_ATTRIBUTE_TAG,
                             GoodsType.class, (GoodsType)null));

        xr.closeTag(CARGO_TAG);

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

示例6: readChild

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

    if (ROLE_CHANGE_TAG.equals(tag)) {
        String from = xr.getAttribute(FROM_TAG, (String)null);
        String capture = xr.getAttribute(CAPTURE_TAG, (String)null);
        addRoleChange(from, capture);
        xr.closeTag(ROLE_CHANGE_TAG);

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

示例7: readChild

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

    if (BUILD_QUEUE_TAG.equals(tag)) {
        BuildableType bt = xr.getType(spec, ID_ATTRIBUTE_TAG,
                BuildableType.class, (BuildableType)null);
        if (bt != null) buildQueue.add(bt);
        xr.closeTag(BUILD_QUEUE_TAG);

    } else if (POPULATION_QUEUE_TAG.equals(xr.getLocalName())) {
        UnitType ut = xr.getType(spec, ID_ATTRIBUTE_TAG,
                UnitType.class, (UnitType)null);
        if (ut != null) populationQueue.add(ut);
        xr.closeTag(POPULATION_QUEUE_TAG);

    } else if (Building.TAG.equals(tag)) {
        addBuilding(xr.readFreeColObject(game, Building.class));

    } else if (ColonyTile.TAG.equals(tag)) {
        addColonyTile(xr.readFreeColObject(game, ColonyTile.class));

    } else if (ExportData.TAG.equals(tag)) {
        ExportData data = new ExportData(xr);
        setExportData(data);

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

示例8: 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 (CHOICE_TAG.equals(tag)) {
        choices.add(xr.getType(spec, VALUE_TAG,
                               UnitType.class, (UnitType)null));
        xr.closeTag(CHOICE_TAG);

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

示例9: readChild

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

    if (CHOICE_TAG.equals(tag)) {
        choices.add(xr.getAttribute(VALUE_TAG, (String)null));
        xr.closeTag(CHOICE_TAG);

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

示例10: readChild

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

    if (getXMLItemElementTagName().equals(tag)) {
        addItemValue(xr.getAttribute(VALUE_TAG, INFINITY),
                     xr.getAttribute(LABEL_TAG, (String)null));
        xr.closeTag(tag);

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

示例11: 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

示例12: readChild

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

    if (AI_GOODS_LIST_TAG.equals(tag)) {
        addExportGoods(xr.makeAIObject(aiMain, ID_ATTRIBUTE_TAG,
                                       AIGoods.class, (AIGoods)null, true));
        xr.closeTag(AI_GOODS_LIST_TAG);

    } else if (GOODS_WISH_LIST_TAG.equals(tag)) {
        wishes.add(xr.makeAIObject(aiMain, ID_ATTRIBUTE_TAG,
                                   GoodsWish.class, (GoodsWish)null, true));
        xr.closeTag(GOODS_WISH_LIST_TAG);

    } else if (TILE_IMPROVEMENT_PLAN_LIST_TAG.equals(tag)
        // @compat 0.11.3
        || OLD_TILE_IMPROVEMENT_PLAN_LIST_TAG.equals(tag)
        // end @compat 0.11.3
               ) {
        tileImprovementPlans.add(xr.makeAIObject(aiMain, ID_ATTRIBUTE_TAG,
                TileImprovementPlan.class, (TileImprovementPlan)null, true));
        xr.closeTag(tag);// FIXME: tag -> TILE_IMPROVEMENT_PLAN_LIST_TAG

    } else if (WORKER_WISH_LIST_TAG.equals(tag)) {
        wishes.add(xr.makeAIObject(aiMain, ID_ATTRIBUTE_TAG,
                                   WorkerWish.class, (WorkerWish)null, true));
        xr.closeTag(WORKER_WISH_LIST_TAG);

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

示例13: readChild

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

    if (CIBOLA_TAG.equals(tag)) {
        String cibola = xr.readId();
        // @compat 0.11.3
        final String oldPrefix = "lostCityRumour.cityName";
        if (cibola.startsWith(oldPrefix)) cibola = "nameCache." + cibola;
        // end @compat 0.11.3
        NameCache.addCityOfCibola(cibola);
        xr.closeTag(CIBOLA_TAG);

    } else if (Map.TAG.equals(tag)) {
        if (this.specification == null) {
            throw new XMLStreamException("Tried to read " + tag
                + " with null specification");
        }
        map = xr.readFreeColObject(game, Map.class);

    } else if (NationOptions.TAG.equals(tag)) {
        if (this.specification == null) {
            throw new XMLStreamException("Tried to read " + tag
                + " with null specification");
        }
        nationOptions = new NationOptions(xr, specification);

    } else if (Player.TAG.equals(tag)) {
        if (this.specification == null) {
            throw new XMLStreamException("Tried to read " + tag
                + " with null specification");
        }
        Player player = xr.readFreeColObject(game, Player.class);
        if (player.isUnknownEnemy()) {
            setUnknownEnemy(player);
        } else {
            players.add(player);
        }

    } else if (Specification.TAG.equals(tag)) {
        logger.info(((this.specification == null) ? "Loading" : "Reloading")
            + " specification.");
        this.specification = new Specification(xr);

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

示例14: 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 (DISASTER_TAG.equals(tag)) {
        Disaster d = xr.getType(spec, ID_ATTRIBUTE_TAG,
                                Disaster.class, (Disaster)null);
        if (d != null) {
            addDisaster(d, xr.getAttribute(PROBABILITY_TAG, 100));
        }
        xr.closeTag(DISASTER_TAG);

    } else if (GEN_TAG.equals(tag)) {
        this.humidity[0] = xr.getAttribute(HUMIDITY_MIN_TAG, 0);
        this.humidity[1] = xr.getAttribute(HUMIDITY_MAX_TAG, 100);
        this.temperature[0] = xr.getAttribute(TEMPERATURE_MIN_TAG, -20);
        this.temperature[1] = xr.getAttribute(TEMPERATURE_MAX_TAG, 40);
        this.altitude[0] = xr.getAttribute(ALTITUDE_MIN_TAG, 0);
        this.altitude[1] = xr.getAttribute(ALTITUDE_MAX_TAG, 0);
        // @compat 0.11.3
        if (xr.hasAttribute(OLD_HUMIDITY_MIN_TAG)) {
            this.humidity[0] = xr.getAttribute(OLD_HUMIDITY_MIN_TAG, 0);
        }
        if (xr.hasAttribute(OLD_HUMIDITY_MAX_TAG)) {
            this.humidity[1] = xr.getAttribute(OLD_HUMIDITY_MAX_TAG, 100);
        }
        if (xr.hasAttribute(OLD_TEMPERATURE_MIN_TAG)) {
            this.temperature[0] = xr.getAttribute(OLD_TEMPERATURE_MIN_TAG, -20);
        }
        if (xr.hasAttribute(OLD_TEMPERATURE_MAX_TAG)) {
            this.temperature[1] = xr.getAttribute(OLD_TEMPERATURE_MAX_TAG, 40);
        }
        if (xr.hasAttribute(OLD_ALTITUDE_MIN_TAG)) {
            this.altitude[0] = xr.getAttribute(OLD_ALTITUDE_MIN_TAG, 0);
        }
        if (xr.hasAttribute(OLD_ALTITUDE_MAX_TAG)) {
            this.altitude[1] = xr.getAttribute(OLD_ALTITUDE_MAX_TAG, 0);
        }
        // end @compat 0.11.3
        xr.closeTag(GEN_TAG);

    } else if (PRODUCTION_TAG.equals(tag)
        && xr.getAttribute(DELETE_TAG, false)) {
        this.productionTypes.clear();
        xr.closeTag(PRODUCTION_TAG);

    } else if (PRODUCTION_TAG.equals(tag)) {
        this.productionTypes.add(new ProductionType(xr, spec));

    } else if (RESOURCE_TAG.equals(tag)) {
        addResourceType(xr.getType(spec, TYPE_TAG, ResourceType.class,
                                   (ResourceType)null),
                        xr.getAttribute(PROBABILITY_TAG, 100));
        xr.closeTag(RESOURCE_TAG);

    // @compat 0.11.x
    // Primary and secondary production was dropped at 0.11.0, but
    // some saved games slipped through.
    } else if (PRIMARY_PRODUCTION_TAG.equals(tag)
        || SECONDARY_PRODUCTION_TAG.equals(tag)) {
        GoodsType type = xr.getType(spec, GOODS_TYPE_TAG,
                                    GoodsType.class, (GoodsType)null);
        int amount = xr.getAttribute(VALUE_TAG, 0);
        ProductionType pt = new ProductionType(null, type, amount);
        pt.setUnattended(true);
        this.productionTypes.add(pt);
        xr.closeTag(tag);
    // @end compat 0.11.x

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

示例15: RemoveMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code RemoveMessage} from a stream.
 *
 * @param game The {@code Game} this message belongs to.
 * @param xr A {@code FreeColXMLReader} to read from.
 * @exception XMLStreamException if the stream is corrupt.
 */
public RemoveMessage(Game game, FreeColXMLReader xr)
    throws XMLStreamException {
    super(TAG, getAttributeMap(xr));

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


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