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


Java FreeColXMLReader.expectTag方法代码示例

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


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

示例1: NationSummaryMessage

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

    NationSummary ns = null;
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (NationSummary.TAG.equals(tag)) {
            if (ns == null) {
                ns = xr.readFreeColObject(game, NationSummary.class);
            } else {
                expected(TAG, tag);
            }
        } else {
            expected(NationSummary.TAG, tag);
        }
        xr.expectTag(tag);
    }
    xr.expectTag(TAG);
    appendChild(ns);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:29,代码来源:NationSummaryMessage.java

示例2: HighScoresMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code HighScoresMessage} 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 HighScoresMessage(Game game, FreeColXMLReader xr)
    throws XMLStreamException {
    super(TAG, xr, KEY_TAG);

    List<HighScore> scores = new ArrayList<>();
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (HighScore.TAG.equals(tag)) {
            HighScore hs = new HighScore(xr);
            if (hs != null) scores.add(hs);
        } else {
            expected(HighScore.TAG, tag);
        }
        xr.expectTag(tag);
    }
    xr.expectTag(TAG);
    appendChildren(scores);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:26,代码来源:HighScoresMessage.java

示例3: ServerListMessage

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

    List<ServerInfo> svs = new ArrayList<>();
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (ServerInfo.TAG.equals(tag)) {
            svs.add(new ServerInfoMessage(tag, game, xr).getServerInfo());
        } else {
            expected(ServerInfo.TAG, tag);
        }
    }
    xr.expectTag(TAG);
    addServers(svs);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:24,代码来源:ServerListMessage.java

示例4: WrapperMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code WrapperMessage} from a stream.
 *
 * @param tag The actual message tag.
 * @param game The {@code Game} to read within.
 * @param xr The {@code FreeColXMLReader} to read from.
 * @exception XMLStreamException if the stream is corrupt.
 * @exception FreeColException if the internal message can not be read.
 */
protected WrapperMessage(String tag, Game game, FreeColXMLReader xr)
    throws XMLStreamException, FreeColException {
    super(tag, REPLY_ID_TAG, xr.getAttribute(REPLY_ID_TAG, (String)null));

    this.message = null;
    while (xr.moreTags()) {
        final String mt = xr.getLocalName();
        if (this.message == null) {
            this.message = Message.read(game, xr);
            xr.expectTag(mt);
        } else {
            xr.expectTag(tag);
        }
    }
    xr.expectTag(tag);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:26,代码来源:WrapperMessage.java

示例5: DeliverGiftMessage

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

    Goods goods = null;
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (Goods.TAG.equals(tag)) {
            if (goods == null) {
                goods = xr.readFreeColObject(game, Goods.class);
            } else {
                expected(TAG, tag);
            }
        } else {
            expected(Goods.TAG, tag);
        }
        xr.expectTag(tag);
    }
    xr.expectTag(TAG);
    appendChild(goods);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:29,代码来源:DeliverGiftMessage.java

示例6: ErrorMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code ErrorMessage} 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 ErrorMessage(Game game, FreeColXMLReader xr)
    throws XMLStreamException {
    super(TAG, xr, MESSAGE_TAG);

    StringTemplate template = null;
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (StringTemplate.TAG.equals(tag)) {
            if (template == null) {
                template = xr.readFreeColObject(game, StringTemplate.class);
            } else {
                expected(TAG, tag);
            }
        } else {
            expected(StringTemplate.TAG, tag);
        }
    }
    xr.expectTag(TAG);
    appendChild(template);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:28,代码来源:ErrorMessage.java

示例7: MonarchActionMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code MonarchActionMessage} 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 MonarchActionMessage(Game game, FreeColXMLReader xr)
    throws XMLStreamException {
    super(TAG, xr, ACTION_TAG, MONARCH_TAG, TAX_TAG, RESULT_TAG);

    StringTemplate template = null;
    while (xr.moreTags()) {
        String tag = xr.getLocalName();
        if (StringTemplate.TAG.equals(tag)) {
            if (template == null) {
                template = xr.readFreeColObject(game, StringTemplate.class);
            } else {
                expected(TAG, tag);
            }
        } else {
            expected(StringTemplate.TAG, tag);
        }
        xr.expectTag(tag);
    }
    xr.expectTag(TAG);
    appendChild(template);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:29,代码来源:MonarchActionMessage.java

示例8: 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:wintertime,项目名称:FreeCol,代码行数:33,代码来源:AnimateAttackMessage.java

示例9: 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:wintertime,项目名称:FreeCol,代码行数:27,代码来源:UpdateMessage.java

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

示例11: 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:wintertime,项目名称:FreeCol,代码行数:35,代码来源:UpdateMapGeneratorOptionsMessage.java

示例12: 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:wintertime,项目名称:FreeCol,代码行数:35,代码来源:SpySettlementMessage.java

示例13: 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:wintertime,项目名称:FreeCol,代码行数:35,代码来源:NativeTradeMessage.java

示例14: MultipleMessage

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * Create a new {@code MultipleMessage} from a stream.
 *
 * @param game The {@code Game} to read within.
 * @param xr The {@code FreeColXMLReader} to read from.
 * @exception XMLStreamException if the stream is corrupt.
 * @exception FreeColException if the internal message can not be read.
 */
public MultipleMessage(Game game, FreeColXMLReader xr)
    throws XMLStreamException, FreeColException {
    this();
    
    this.messages.clear();
    while (xr.moreTags()) {
        final String mt = xr.getLocalName();
        Message m = Message.read(game, xr);
        if (m != null) this.messages.add(m);
        xr.expectTag(mt);
    }
    xr.expectTag(TAG);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:22,代码来源:MultipleMessage.java

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


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