當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。