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


Java FreeColXMLReader.getType方法代码示例

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


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

示例1: readChildren

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readChildren(FreeColXMLReader xr) throws XMLStreamException {
    // Clear containers.
    if (xr.shouldClearContainers()) {
        effects = null;
    }

    final Specification spec = getSpecification();
    Disaster parent = xr.getType(spec, EXTENDS_TAG, Disaster.class, this);

    if (parent != this && !parent.getEffects().isEmpty()) {
        if (effects == null) effects = new ArrayList<>();
        for (RandomChoice<Effect> choice : parent.getEffects()) {
            Effect effect = new Effect(choice.getObject());
            effect.getFeatureContainer().replaceSource(parent, this);
            addEffect(effect);
        }
    }

    super.readChildren(xr);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:25,代码来源:Disaster.java

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

示例3: readChildren

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readChildren(FreeColXMLReader xr) throws XMLStreamException {
    // Clear containers.
    if (xr.shouldClearContainers()) {
        skills = null;
        regions = null;
    }

    final Specification spec = getSpecification();
    IndianNationType parent = xr.getType(spec, EXTENDS_TAG,
                                         IndianNationType.class, this);
    if (parent != this) {
        if (parent.skills != null && !parent.skills.isEmpty()) {
            if (skills == null) skills = new ArrayList<>();
            skills.addAll(parent.skills);
        }

        if (parent.regions != null && !parent.regions.isEmpty()) {
            if (regions == null) regions = new ArrayList<>();
            regions.addAll(parent.regions);
        }
    }

    super.readChildren(xr);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:29,代码来源:IndianNationType.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();

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

    unitType = xr.getType(spec, UNIT_TYPE_TAG,
                          UnitType.class, (UnitType)null);
    
    expertNeeded = xr.getAttribute(EXPERT_NEEDED_TAG, false);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:22,代码来源:WorkerWish.java

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

    NationType parent = xr.getType(spec, EXTENDS_TAG,
                                   NationType.class, this);

    numberOfSettlements = xr.getAttribute(NUMBER_OF_SETTLEMENTS_TAG,
        SettlementNumber.class, parent.numberOfSettlements);

    aggression = xr.getAttribute(AGGRESSION_TAG,
                                 AggressionLevel.class, parent.aggression);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:19,代码来源:NationType.java

示例6: readChildren

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readChildren(FreeColXMLReader xr) throws XMLStreamException {
    // Clear containers.
    if (xr.shouldClearContainers()) {
        startingUnitMap.clear();
    }

    final Specification spec = getSpecification();
    EuropeanNationType parent = xr.getType(spec, EXTENDS_TAG,
                                           EuropeanNationType.class, this);
    if (parent != this) {
        forEachMapEntry(parent.startingUnitMap, e ->
            startingUnitMap.put(e.getKey(), new HashMap<>(e.getValue())));
    }

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

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

    lastTribute = xr.getAttribute(LAST_TRIBUTE_TAG, 0);

    convertProgress = xr.getAttribute(CONVERT_PROGRESS_TAG, 0);

    learnableSkill = xr.getType(spec, LEARNABLE_SKILL_TAG,
                                UnitType.class, (UnitType)null);

    mostHated = xr.findFreeColGameObject(getGame(), MOST_HATED_TAG,
                                         Player.class, (Player)null, false);

    for (int i = 0; i < WANTED_GOODS_COUNT; i++) {
        setWantedGoods(i, xr.getType(spec, WANTED_GOODS_TAG + i,
                                     GoodsType.class, (GoodsType)null));
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:25,代码来源:IndianSettlement.java

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

    natural = xr.getAttribute(NATURAL_TAG, false);

    magnitude = xr.getAttribute(MAGNITUDE_TAG, 1);

    addWorkTurns = xr.getAttribute(ADD_WORK_TURNS_TAG, 0);

    requiredImprovementType = xr.getType(spec, REQUIRED_IMPROVEMENT_TAG,
        TileImprovementType.class, (TileImprovementType)null);

    requiredRole = xr.getType(spec, REQUIRED_ROLE_TAG,
        Role.class, (Role)null);
    // @compat 0.11.x
    if (xr.hasAttribute(OLD_EXPENDED_EQUIPMENT_TYPE_TAG)) {
        requiredRole = spec.getRole("model.role.pioneer");
    }
    // end @compat 0.11.x

    expendedAmount = xr.getAttribute(EXPENDED_AMOUNT_TAG, 0);

    movementCost = xr.getAttribute(MOVEMENT_COST_TAG, 0);

    zIndex = xr.getAttribute(ZINDEX_TAG, 0);

    // @compat 0.11.3
    if (xr.hasAttribute(OLD_EXPOSE_RESOURCE_PERCENT_TAG)) {
        exposeResourcePercent = xr.getAttribute(OLD_EXPOSE_RESOURCE_PERCENT_TAG, 0);
    } else
    // end @compat 0.11.3
        exposeResourcePercent = xr.getAttribute(EXPOSE_RESOURCE_PERCENT_TAG, 0);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:40,代码来源:TileImprovementType.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();
    nationType = xr.getType(spec, NATION_TYPE_TAG,
                            NationType.class, (NationType)null);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:12,代码来源:AbstractUnitOption.java

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

    EuropeanNationType parent = xr.getType(spec, EXTENDS_TAG,
                                           EuropeanNationType.class, this);

    ref = xr.getAttribute(REF_TAG, parent.ref);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:15,代码来源:EuropeanNationType.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 (CONSUMES_TAG.equals(tag)) {
        addConsumption(xr.getType(spec, ID_ATTRIBUTE_TAG,
                GoodsType.class, (GoodsType)null),
                xr.getAttribute(VALUE_TAG, UNDEFINED));
        xr.closeTag(CONSUMES_TAG);

    // @compat 0.11.0
    } else if (OLD_DEFAULT_EQUIPMENT_TAG.equals(tag)) {
        xr.swallowTag(OLD_DEFAULT_EQUIPMENT_TAG);
    // end @compat 0.11.0

    } else if (DEFAULT_ROLE_TAG.equals(tag)) {
        defaultRole = xr.getType(spec, ID_ATTRIBUTE_TAG,
                Role.class, spec.getDefaultRole());
        xr.closeTag(DEFAULT_ROLE_TAG);

    // @compat 0.11.6
    } else if (DOWNGRADE_TAG.equals(tag) || UPGRADE_TAG.equals(tag)) {
        xr.closeTag(tag, Scope.TAG);
    // end @compat 0.11.6

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

示例12: readAttributes

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

    from = xr.getType(spec, FROM_TAG, TileType.class, (TileType)null);

    to = xr.getType(spec, TO_TAG, TileType.class, (TileType)null);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:13,代码来源:TileTypeChange.java

示例13: 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 (REQUIRED_ABILITY_TAG.equals(tag)) {
        String id = xr.readId();
        addRequiredAbility(id, xr.getAttribute(VALUE_TAG, true));
        spec.addAbility(id);
        xr.closeTag(REQUIRED_ABILITY_TAG);

    } else if (REQUIRED_GOODS_TAG.equals(tag)) {
        GoodsType type = xr.getType(spec, ID_ATTRIBUTE_TAG,
                GoodsType.class, (GoodsType)null);
        int amount = xr.getAttribute(VALUE_TAG, 0);
        addRequiredGoods(new AbstractGoods(type, amount));
        xr.closeTag(REQUIRED_GOODS_TAG);

    } else if (Limit.TAG.equals(tag)) {
        Limit limit = new Limit(xr, spec);
        if (limit.getLeftHandSide().getType() == null) {
            limit.getLeftHandSide().setType(getId());
        }
        addLimit(limit);

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

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

    buildingType = xr.getType(spec, BUILDING_TYPE_TAG,
                              BuildingType.class, (BuildingType)null);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:13,代码来源:Building.java

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

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

    type = xr.getType(spec, TYPE_TAG, TileImprovementType.class,
                      (TileImprovementType)null);

    turnsToComplete = xr.getAttribute(TURNS_TAG, 0);

    magnitude = xr.getAttribute(MAGNITUDE_TAG, 0);

    virtual = xr.getAttribute(VIRTUAL_TAG, false);

    style = null;
    String str = xr.getAttribute(STYLE_TAG, (String)null);
    List<Direction> dirns = getConnectionDirections();
    if (dirns == null) {
        if (str != null && !str.isEmpty())
            logger.warning("At " + tile + " ignored nonempty style for "
                + type + ": " + str);
    } else if (str == null) {
        if (!isComplete() || isVirtual()) {
            ; // Null style OK for incomplete or virtual roads
        } else {
            logger.warning("At " + tile + " unexpected null style for "
                + type);
        }
    } else if (str.length() != dirns.size()) {
        logger.warning("At " + tile + " ignored bogus style for "
            + type + ": " + str);
    } else {
        style = TileImprovementStyle.getInstance(str);
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:43,代码来源:TileImprovement.java


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