本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}