本文整理汇总了Java中net.sf.freecol.common.io.FreeColXMLReader.getLocationAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java FreeColXMLReader.getLocationAttribute方法的具体用法?Java FreeColXMLReader.getLocationAttribute怎么用?Java FreeColXMLReader.getLocationAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.common.io.FreeColXMLReader
的用法示例。
在下文中一共展示了FreeColXMLReader.getLocationAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
final Specification spec = getSpecification();
super.readAttributes(xr);
this.type = xr.getType(spec, TYPE_TAG, GoodsType.class, (GoodsType)null);
if (this.type == null) {
throw new XMLStreamException("Null goods type.");
} else {
setId(this.type.getId());
}
this.amount = xr.getAttribute(AMOUNT_TAG, 0);
this.location = xr.getLocationAttribute(game, LOCATION_TAG, true);
}
示例2: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final AIMain aiMain = getAIMain();
// Do not use setTarget in serialization
target = xr.getLocationAttribute(getGame(), TARGET_TAG, false);
tileImprovementPlan = (xr.hasAttribute(TileImprovementPlan.TAG))
? xr.makeAIObject(aiMain, TileImprovementPlan.TAG,
TileImprovementPlan.class, (TileImprovementPlan)null, true)
: null;
}
示例3: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
target = xr.getLocationAttribute(getGame(), TARGET_TAG, false);
}
示例4: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final AIMain aiMain = getAIMain();
destination = xr.getLocationAttribute(aiMain.getGame(),
DESTINATION_TAG, false);
// Delegate transportable one level down
}
示例5: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
target = xr.getLocationAttribute(getGame(), TARGET_TAG, false);
colonyValue = xr.getAttribute(VALUE_TAG, -1);
}
示例6: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
target = xr.getLocationAttribute(getGame(), TARGET_TAG, false);
}
示例7: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Game game = getAIMain().getGame();
destination = xr.getLocationAttribute(game, DESTINATION_TAG, false);
}
示例8: readFromXML
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
public void readFromXML(AIMain aiMain, FreeColXMLReader xr) throws XMLStreamException {
final Game game = aiMain.getGame();
String tid = xr.readId();
TransportableAIObject tao = null;
if (tid != null) {
AIObject aio = aiMain.getAIObject(tid);
if (aio == null) {
if (tid.startsWith(Unit.TAG)) {
tao = new AIUnit(aiMain, tid);
} else if (tid.startsWith(AIGoods.TAG)) {
tao = new AIGoods(aiMain, tid);
}
} else {
tao = (TransportableAIObject)aio;
}
}
if (tao == null) {
throw new XMLStreamException("Transportable expected: " + tid);
}
this.transportable = tao;
this.carrier = xr.getAttribute(game, CARRIER_TAG,
Unit.class, (Unit)null);
this.tries = xr.getAttribute(TRIES_TAG, 0);
this.spaceLeft = xr.getAttribute(SPACELEFT_TAG, -1);
this.wrapped = null;
this.plan = new CargoPlan();
this.plan.twait = xr.getLocationAttribute(game, TWAIT_TAG, false);
this.plan.cwait = xr.getLocationAttribute(game, CWAIT_TAG, false);
this.plan.cdst = xr.getLocationAttribute(game, CDST_TAG, false);
this.plan.tdst = xr.getLocationAttribute(game, TDST_TAG, false);
this.plan.turns = xr.getAttribute(TURNS_TAG, -1);
this.plan.mode = xr.getAttribute(MODE_TAG,
CargoMode.class, (CargoMode)null);
this.plan.fallback = xr.getAttribute(FALLBACK_TAG, false);
xr.closeTag(TAG);
}
示例9: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
location = xr.getLocationAttribute(getGame(), LOCATION_TAG, true);
}
示例10: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Specification spec = getSpecification();
final Game game = getGame();
x = xr.getAttribute(X_TAG, 0);
y = xr.getAttribute(Y_TAG, 0);
type = xr.getType(spec, TYPE_TAG, TileType.class, (TileType)null);
if (type == null) { // Unexplored tile.
style = 0;
highSeasCount = -1;
owner = null;
region = null;
moveToEurope = null;
contiguity = -1;
owningSettlement = null;
return;
}
style = xr.getAttribute(STYLE_TAG, 0);
String str = xr.getAttribute(CONNECTED_TAG, (String)null);
if (str == null || str.isEmpty()) {
highSeasCount = -1;
} else {
try {
highSeasCount = Integer.parseInt(str);
} catch (NumberFormatException nfe) {
highSeasCount = -1;
}
}
owner = xr.findFreeColGameObject(game, OWNER_TAG,
Player.class, (Player)null, false);
region = xr.findFreeColGameObject(game, REGION_TAG,
Region.class, (Region)null, false);
moveToEurope = (xr.hasAttribute(MOVE_TO_EUROPE_TAG))
? xr.getAttribute(MOVE_TO_EUROPE_TAG, false)
: null;
contiguity = xr.getAttribute(CONTIGUITY_TAG, -1);
// Tiles are added to the settlement owned tiles list in Map.
// Doing it here can cause cache weirdness.
Location loc = xr.getLocationAttribute(game, OWNING_SETTLEMENT_TAG,
true);
owningSettlement = (loc instanceof Settlement) ? (Settlement)loc
: null;
}
示例11: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Specification spec = getSpecification();
final Game game = getGame();
name = xr.getAttribute(NAME_TAG, (String)null);
Player oldOwner = owner;
owner = xr.findFreeColGameObject(game, OWNER_TAG,
Player.class, (Player)null, true);
if (xr.shouldIntern()) game.checkOwners(this, oldOwner);
UnitType oldUnitType = this.type;
this.type = xr.getType(spec, UNIT_TYPE_TAG,
UnitType.class, (UnitType)null);
state = xr.getAttribute(STATE_TAG, UnitState.class, UnitState.ACTIVE);
role = xr.getType(spec, ROLE_TAG, Role.class, spec.getDefaultRole());
roleCount = xr.getAttribute(ROLE_COUNT_TAG, role.getMaximumCount());
setLocationNoUpdate(xr.getLocationAttribute(game, LOCATION_TAG, true));
entryLocation = xr.getLocationAttribute(game, ENTRY_LOCATION_TAG,
true);
movesLeft = xr.getAttribute(MOVES_LEFT_TAG, 0);
workLeft = xr.getAttribute(WORK_LEFT_TAG, 0);
attrition = xr.getAttribute(ATTRITION_TAG, 0);
nationality = xr.getAttribute(NATIONALITY_TAG, (String)null);
ethnicity = xr.getAttribute(ETHNICITY_TAG, (String)null);
turnsOfTraining = xr.getAttribute(TURNS_OF_TRAINING_TAG, 0);
hitPoints = xr.getAttribute(HIT_POINTS_TAG, -1);
teacher = xr.makeFreeColObject(game, TEACHER_TAG, Unit.class, false);
student = xr.makeFreeColObject(game, STUDENT_TAG, Unit.class, false);
setHomeIndianSettlement(xr.makeFreeColObject(game,
INDIAN_SETTLEMENT_TAG, IndianSettlement.class, false));
treasureAmount = xr.getAttribute(TREASURE_AMOUNT_TAG, 0);
destination = xr.getLocationAttribute(game, DESTINATION_TAG, true);
tradeRoute = xr.findFreeColGameObject(game, TRADE_ROUTE_TAG,
TradeRoute.class, (TradeRoute)null, false);
currentStop = (tradeRoute == null) ? -1
: xr.getAttribute(CURRENT_STOP_TAG, 0);
experienceType = xr.getType(spec, EXPERIENCE_TYPE_TAG,
GoodsType.class, (GoodsType)null);
if (experienceType == null && workType != null) {
experienceType = workType;
}
experience = xr.getAttribute(EXPERIENCE_TAG, 0);
visibleGoodsCount = xr.getAttribute(VISIBLE_GOODS_COUNT_TAG, -1);
// Make sure you do this after experience and location stuff.
changeWorkType(xr.getType(spec, WORK_TYPE_TAG, GoodsType.class, null));
}