本文整理汇总了Java中net.sf.freecol.common.io.FreeColXMLReader.atTag方法的典型用法代码示例。如果您正苦于以下问题:Java FreeColXMLReader.atTag方法的具体用法?Java FreeColXMLReader.atTag怎么用?Java FreeColXMLReader.atTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.common.io.FreeColXMLReader
的用法示例。
在下文中一共展示了FreeColXMLReader.atTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readChild
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readChild(FreeColXMLReader xr) throws XMLStreamException {
final String tag = xr.getLocalName();
final String oid = xr.readId();
try {
Wish wish = null;
// The AI data is quite shallow, so we can get away with
// fixing up forward references just with this simple
// lookup. AIObjects that can be forward referenced must
// ensure they complete initialization somewhere in their
// serialization read* routines.
AIObject aio;
if (oid != null && (aio = getAIObject(oid)) != null) {
aio.readFromXML(xr);
} else if (AIColony.TAG.equals(tag)) {
new AIColony(this, xr);
} else if (AIGoods.TAG.equals(tag)) {
new AIGoods(this, xr);
} else if (AIPlayer.TAG.equals(tag)) {
Player p = getGame().getFreeColGameObject(oid, Player.class);
if (p != null) {
if (p.isIndian()) {
new NativeAIPlayer(this, xr);
} else if (p.isREF()) {
new REFAIPlayer(this, xr);
} else if (p.isEuropean()) {
new EuropeanAIPlayer(this, xr);
} else {
throw new RuntimeException("Bogus AIPlayer: " + p);
}
}
} else if (AIUnit.TAG.equals(tag)) {
new AIUnit(this, xr);
} else if (GoodsWish.TAG.equals(tag)
// @compat 0.11.3
|| OLD_GOODS_WISH_TAG.equals(tag)
// end @compat 0.11.3
) {
wish = new GoodsWish(this, xr);
} else if (TileImprovementPlan.TAG.equals(tag)
// @compat 0.11.3
|| OLD_TILE_IMPROVEMENT_PLAN_TAG.equals(tag)
// end @compat
) {
new TileImprovementPlan(this, xr);
} else if (WorkerWish.TAG.equals(tag)) {
wish = new WorkerWish(this, xr);
} else {
super.readChild(xr);
}
if (wish != null) {
AIColony ac = wish.getDestinationAIColony();
if (ac != null) ac.addWish(wish);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Exception reading AIObject: "
+ tag + ", id=" + oid, e);
// We are hosed. Try to resynchronize at the end of the tag
// or aiMain.
final String mainTag = TAG;
while (xr.moreTags() || !(xr.atTag(tag) || xr.atTag(mainTag)));
}
}