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


Java FreeColXMLReader.ReadScope方法代码示例

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


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

示例1: UpdateMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    List<FreeColObject> fcos = new ArrayList<>();
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            fcos.add(xr.readFreeColObject(game));
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChildren(fcos);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:27,代码来源:UpdateMessage.java

示例2: AddPlayerMessage

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

    this.destination = null;
    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    List<Player> players = new ArrayList<>();
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (Player.TAG.equals(tag)) {
                Player p = xr.readFreeColObject(game, Player.class);
                if (p != null) players.add(p);
            } else {
                expected(Player.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChildren(players);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:33,代码来源:AddPlayerMessage.java

示例3: AnimateAttackMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    List<Unit> units = new ArrayList<>();
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (Unit.TAG.equals(tag)) {
                Unit u =  xr.readFreeColObject(game, Unit.class);
                if (u != null) units.add(u);
            } else {
                expected(Unit.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChildren(units);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:33,代码来源:AnimateAttackMessage.java

示例4: UpdateMapGeneratorOptionsMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    OptionGroup optionGroup = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (OptionGroup.TAG.equals(tag)) {
                if (optionGroup == null) {
                    optionGroup = xr.readFreeColObject(game, OptionGroup.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(OptionGroup.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(optionGroup);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:UpdateMapGeneratorOptionsMessage.java

示例5: SpySettlementMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    Tile spyTile = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (Tile.TAG.equals(tag)) {
                if (spyTile == null) {
                    spyTile = xr.readFreeColObject(game, Tile.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(Tile.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(spyTile);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:SpySettlementMessage.java

示例6: UpdateGameOptionsMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    OptionGroup optionGroup = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (OptionGroup.TAG.equals(tag)) {
                if (optionGroup == null) {
                    optionGroup = xr.readFreeColObject(game, OptionGroup.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(OptionGroup.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(optionGroup);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:UpdateGameOptionsMessage.java

示例7: AnimateMoveMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    Unit unit = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (Unit.TAG.equals(tag)) {
                if (unit == null) {
                    unit = xr.readFreeColObject(game, Unit.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(Unit.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(unit);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:35,代码来源:AnimateMoveMessage.java

示例8: UpdateTradeRouteMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    TradeRoute tradeRoute = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (TradeRoute.TAG.equals(tag)) {
                if (tradeRoute == null) {
                    tradeRoute = xr.readFreeColObject(game, TradeRoute.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(TradeRoute.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(tradeRoute);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:UpdateTradeRouteMessage.java

示例9: NativeTradeMessage

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

    NativeTrade nt = null;
    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (NativeTrade.TAG.equals(tag)) {
                if (nt == null) {
                    nt = xr.readFreeColObject(game, NativeTrade.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(NativeTrade.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(nt);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:NativeTradeMessage.java

示例10: NewTradeRouteMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    TradeRoute tradeRoute = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (TradeRoute.TAG.equals(tag)) {
                if (tradeRoute == null) {
                    tradeRoute = xr.readFreeColObject(game, TradeRoute.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected(TradeRoute.TAG, tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(tradeRoute);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:35,代码来源:NewTradeRouteMessage.java

示例11: FeatureChangeMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            FreeColObject fco = null;
            if (Ability.TAG.equals(tag)) {
                fco = xr.readFreeColObject(game, Ability.class);
            } else if (Modifier.TAG.equals(tag)) {
                fco = xr.readFreeColObject(game, Modifier.class);
            } else if (HistoryEvent.TAG.equals(tag)) {
                fco = xr.readFreeColObject(game, HistoryEvent.class);
            } else if (LastSale.TAG.equals(tag)) {
                fco = xr.readFreeColObject(game, LastSale.class);
            } else if (ModelMessage.TAG.equals(tag)) {
                fco = xr.readFreeColObject(game, ModelMessage.class);
            } else {
                expected("Feature", tag);
            }
            appendChild(fco);
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:39,代码来源:FeatureChangeMessage.java

示例12: DiplomacyMessage

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

    FreeColXMLReader.ReadScope rs
        = xr.replaceScope(FreeColXMLReader.ReadScope.NOINTERN);
    DiplomaticTrade agreement = null;
    Unit extraUnit = null;
    try {
        while (xr.moreTags()) {
            String tag = xr.getLocalName();
            if (DiplomaticTrade.TAG.equals(tag)) {
                if (agreement == null) {
                    agreement = xr.readFreeColObject(game, DiplomaticTrade.class);
                } else {
                    expected(TAG, tag);
                }
            } else if (Unit.TAG.equals(tag)) {
                if (extraUnit == null) {
                    extraUnit = xr.readFreeColObject(game, Unit.class);
                } else {
                    expected(TAG, tag);
                }
            } else {
                expected((agreement == null) ? DiplomaticTrade.TAG : Unit.TAG,
                    tag);
            }
            xr.expectTag(tag);
        }
        xr.expectTag(TAG);
    } finally {
        xr.replaceScope(rs);
    }
    appendChild(agreement);
    appendChild(extraUnit);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:43,代码来源:DiplomacyMessage.java


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