|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.server.control.ChangeSet
public class ChangeSet
Changes to be sent to the client.
| Nested Class Summary | |
|---|---|
private static class |
ChangeSet.AttackChange
Encapsulate an attack. |
private static class |
ChangeSet.AttributeChange
Encapsulate an attribute change. |
private static class |
ChangeSet.Change
|
static class |
ChangeSet.ChangePriority
|
private static class |
ChangeSet.MessageChange
Encapsulate a Message. |
private static class |
ChangeSet.MoveChange
Encapsulate a move. |
private static class |
ChangeSet.ObjectChange
Encapsulate a FreeColGameObject update. |
private static class |
ChangeSet.OwnedChange
Encapsulate an owned object change. |
private static class |
ChangeSet.PartialObjectChange
Encapsulate a partial update of a FreeColGameObject. |
private static class |
ChangeSet.RemoveChange
|
static class |
ChangeSet.See
|
private static class |
ChangeSet.SpyChange
|
private static class |
ChangeSet.StanceChange
Encapsulate a stance change. |
private static class |
ChangeSet.TrivialChange
Encapsulate trivial element, which will only have attributes apart from its name. |
| Field Summary | |
|---|---|
private static java.util.Comparator<ChangeSet.Change> |
changeComparator
|
private java.util.ArrayList<ChangeSet.Change> |
changes
|
| Constructor Summary | |
|---|---|
ChangeSet()
Simple constructor. |
|
ChangeSet(ChangeSet other)
Copying constructor. |
|
| Method Summary | |
|---|---|
ChangeSet |
add(ChangeSet.See see,
ChangeSet.ChangePriority cp,
DOMMessage message)
Helper function to add a Message to a ChangeSet. |
ChangeSet |
add(ChangeSet.See see,
FreeColGameObject... objects)
Helper function to add updates for multiple objects to a ChangeSet. |
ChangeSet |
add(ChangeSet.See see,
java.util.List<FreeColGameObject> objects)
Helper function to add updates for multiple objects to a ChangeSet. |
ChangeSet |
addAttack(ChangeSet.See see,
Unit unit,
Unit defender,
boolean success)
Helper function to add an attack to a ChangeSet. |
ChangeSet |
addAttribute(ChangeSet.See see,
java.lang.String key,
java.lang.String value)
Helper function to add an attribute setting to a ChangeSet. |
ChangeSet |
addDead(ServerPlayer serverPlayer)
Helper function to add a dead player event to a ChangeSet. |
ChangeSet |
addDisappear(ServerPlayer owner,
Tile tile,
FreeColGameObject fcgo)
Helper function to add a removal for an object that disappears (that is, moves where it can not be seen) to a ChangeSet. |
ChangeSet |
addDispose(ChangeSet.See see,
Location loc,
FreeColGameObject obj)
Helper function to add a removal for a disposal list to a ChangeSet. |
ChangeSet |
addFather(ServerPlayer serverPlayer,
FoundingFather father)
Helper function to add a founding father addition event to a ChangeSet. |
ChangeSet |
addGlobalHistory(Game game,
HistoryEvent history)
Helper function to add a global history event to a ChangeSet. |
ChangeSet |
addHistory(ServerPlayer serverPlayer,
HistoryEvent history)
Helper function to add a history event to a ChangeSet. |
ChangeSet |
addMessage(ChangeSet.See see,
ModelMessage message)
Helper function to add a message to a ChangeSet. |
ChangeSet |
addMove(ChangeSet.See see,
Unit unit,
Location loc,
Tile tile)
Helper function to add a move to a ChangeSet. |
ChangeSet |
addPartial(ChangeSet.See see,
FreeColGameObject fcgo,
java.lang.String... fields)
Helper function to add a partial update change for an object to a ChangeSet. |
ChangeSet |
addRegion(ServerPlayer serverPlayer,
Region region,
java.lang.String name)
Helper function to add a region discovery to a ChangeSet. |
ChangeSet |
addSale(ServerPlayer serverPlayer,
Settlement settlement,
GoodsType type,
int price)
Helper function to add a sale change to a ChangeSet. |
ChangeSet |
addSpy(ChangeSet.See see,
Settlement settlement)
Helper function to add a spying change to a ChangeSet. |
ChangeSet |
addStance(ChangeSet.See see,
Player first,
Player.Stance stance,
Player second)
Helper function to add a stance change to a ChangeSet. |
ChangeSet |
addTradeRoute(ServerPlayer serverPlayer,
TradeRoute tradeRoute)
Helper function to add a new trade route change to a ChangeSet. |
ChangeSet |
addTrivial(ChangeSet.See see,
java.lang.String name,
ChangeSet.ChangePriority cp,
java.lang.String... attributes)
Helper function to add a trivial element to a ChangeSet. |
org.w3c.dom.Element |
build(ServerPlayer serverPlayer)
Build a generalized update. |
private static java.util.List<org.w3c.dom.Element> |
collapseElementList(java.util.List<org.w3c.dom.Element> elements)
Collapse adjacent elements in a list with the same tag. |
private static void |
collapseElements(org.w3c.dom.Element head,
org.w3c.dom.Element tail)
Collapse one element into another. |
private static boolean |
collapseOK(org.w3c.dom.Element e1,
org.w3c.dom.Element e2)
Can two elements be collapsed? They need to have the same name and attributes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.util.ArrayList<ChangeSet.Change> changes
private static java.util.Comparator<ChangeSet.Change> changeComparator
| Constructor Detail |
|---|
public ChangeSet()
public ChangeSet(ChangeSet other)
other - The other ChangeSet to copy.| Method Detail |
|---|
public ChangeSet add(ChangeSet.See see,
FreeColGameObject... objects)
see - The visibility of this change.objects - The FreeColGameObjects that changed.
ChangeSet.
public ChangeSet add(ChangeSet.See see,
java.util.List<FreeColGameObject> objects)
see - The visibility of this change.objects - The FreeColGameObjects that changed.
ChangeSet.
public ChangeSet add(ChangeSet.See see,
ChangeSet.ChangePriority cp,
DOMMessage message)
see - The visibility of this change.cp - The priority of this change.message - The Message to add.
ChangeSet.
public ChangeSet addAttack(ChangeSet.See see,
Unit unit,
Unit defender,
boolean success)
see - The visibility of this change.unit - The Unit that is attacking.defender - The Unit that is defending.success - Did the attack succeed?
ChangeSet.
public ChangeSet addAttribute(ChangeSet.See see,
java.lang.String key,
java.lang.String value)
see - The visibility of this change.key - A key String.value - The corresponding value as a String.
ChangeSet.public ChangeSet addDead(ServerPlayer serverPlayer)
serverPlayer - The ServerPlayer that died.
ChangeSet.
public ChangeSet addDispose(ChangeSet.See see,
Location loc,
FreeColGameObject obj)
see - The visibility of this change.loc - The Location where the object was.obj - The FreeColGameObject to remove.
ChangeSet.
public ChangeSet addDisappear(ServerPlayer owner,
Tile tile,
FreeColGameObject fcgo)
owner - The ServerPlayer that owns this object.tile - The Tile where the object was.fcgo - The FreeColGameObject that disappears.
ChangeSet.
public ChangeSet addFather(ServerPlayer serverPlayer,
FoundingFather father)
serverPlayer - The ServerPlayer adding the father.father - The FoundingFather to add.
ChangeSet.
public ChangeSet addGlobalHistory(Game game,
HistoryEvent history)
game - The Game to find players in.history - The HistoryEvent to add.
ChangeSet.
public ChangeSet addHistory(ServerPlayer serverPlayer,
HistoryEvent history)
serverPlayer - The ServerPlayer making history.history - The HistoryEvent to add.
ChangeSet.
public ChangeSet addMessage(ChangeSet.See see,
ModelMessage message)
see - The visibility of this change.message - The ModelMessage to add.
ChangeSet.
public ChangeSet addMove(ChangeSet.See see,
Unit unit,
Location loc,
Tile tile)
see - The visibility of this change.unit - The Unit that is moving.loc - The location from which the unit is moving.tile - The Tile to which the unit is moving.
ChangeSet.
public ChangeSet addPartial(ChangeSet.See see,
FreeColGameObject fcgo,
java.lang.String... fields)
see - The visibility of this change.fcgo - The FreeColGameObject to update.fields - The fields to update.
ChangeSet.
public ChangeSet addRegion(ServerPlayer serverPlayer,
Region region,
java.lang.String name)
serverPlayer - The ServerPlayer discovering the region.region - The Region to discover.name - The name of the region.
ChangeSet.
public ChangeSet addSale(ServerPlayer serverPlayer,
Settlement settlement,
GoodsType type,
int price)
serverPlayer - The ServerPlayer making the sale.settlement - The Settlement that is buying.type - The GoodsType bought.price - The per unit price.
ChangeSet.
public ChangeSet addSpy(ChangeSet.See see,
Settlement settlement)
see - The visibility of this change.settlement - The Settlement to spy on.
ChangeSet.
public ChangeSet addStance(ChangeSet.See see,
Player first,
Player.Stance stance,
Player second)
see - The visibility of this change.first - The Player changing stance.stance - The Stance to change to.second - The Player wrt with to change.
ChangeSet.
public ChangeSet addTradeRoute(ServerPlayer serverPlayer,
TradeRoute tradeRoute)
serverPlayer - The ServerPlayer adding the route.tradeRoute - The new TradeRoute.
ChangeSet.
public ChangeSet addTrivial(ChangeSet.See see,
java.lang.String name,
ChangeSet.ChangePriority cp,
java.lang.String... attributes)
see - The visibility of this change.name - The name of the element.cp - The ChangePriority for this change.attributes - Attributes to add to this trivial change.
ChangeSet.
private static void collapseElements(org.w3c.dom.Element head,
org.w3c.dom.Element tail)
head - The Element to collapse into.tail - The Element to extract nodes from.
private static boolean collapseOK(org.w3c.dom.Element e1,
org.w3c.dom.Element e2)
e1 - The first Element.e2 - The second Element.
private static java.util.List<org.w3c.dom.Element> collapseElementList(java.util.List<org.w3c.dom.Element> elements)
elements - The list of Elements to consider.
public org.w3c.dom.Element build(ServerPlayer serverPlayer)
serverPlayer - The ServerPlayer to send the
update to.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||