Package net.sf.freecol.common.networking
Class ChangeSet.RemoveChange
- java.lang.Object
-
- net.sf.freecol.common.networking.ChangeSet.Change<RemoveMessage>
-
- net.sf.freecol.common.networking.ChangeSet.RemoveChange
-
- Enclosing class:
- ChangeSet
private static class ChangeSet.RemoveChange extends ChangeSet.Change<RemoveMessage>
Encapsulates removing some objects. -vis: If removing settlements or units, visibility changes.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<? extends FreeColGameObject>
contents
private Tile
tile
-
Fields inherited from class net.sf.freecol.common.networking.ChangeSet.Change
see
-
-
Constructor Summary
Constructors Constructor Description RemoveChange(ChangeSet.See see, Location loc, java.util.stream.Stream<? extends FreeColGameObject> objects)
Build a new RemoveChange for an object that is disposed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
fullRemoval(Player player)
Should we tell a player to remove all the objects or just the main one?private FreeColGameObject
getMainObject()
By convention, the main object is last.boolean
isNotifiable(Player player)
Should a player be notified of this Change? Override in subclasses with special cases.RemoveMessage
toMessage(Player player)
Specialize a Change for a particular player.java.lang.String
toString()
-
Methods inherited from class net.sf.freecol.common.networking.ChangeSet.Change
check, consequence, matches
-
-
-
-
Field Detail
-
tile
private final Tile tile
-
contents
private final java.util.List<? extends FreeColGameObject> contents
-
-
Constructor Detail
-
RemoveChange
public RemoveChange(ChangeSet.See see, Location loc, java.util.stream.Stream<? extends FreeColGameObject> objects)
Build a new RemoveChange for an object that is disposed.- Parameters:
see
- The visibility of this change.loc
- TheLocation
where the object was.objects
- TheFreeColGameObject
s to remove.
-
-
Method Detail
-
getMainObject
private FreeColGameObject getMainObject()
By convention, the main object is last. All other objects are internal to it and should be removed first if visible.- Returns:
- The main object.
-
fullRemoval
private boolean fullRemoval(Player player)
Should we tell a player to remove all the objects or just the main one?- Parameters:
player
- APlayer
to check.- Returns:
- True if all the objects must go.
-
isNotifiable
public boolean isNotifiable(Player player)
Should a player be notified of this Change? Override in subclasses with special cases.- Overrides:
isNotifiable
in classChangeSet.Change<RemoveMessage>
- Parameters:
player
- ThePlayer
to consider.- Returns:
- True if this
Change
should be sent.
-
toMessage
public RemoveMessage toMessage(Player player)
Specialize a Change for a particular player.- Specified by:
toMessage
in classChangeSet.Change<RemoveMessage>
- Parameters:
player
- ThePlayer
to update.- Returns:
- A specialized
Message
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-