rails.game.move
Class MapChange<K,V>

java.lang.Object
  extended by rails.game.move.Move
      extended by rails.game.move.MapChange<K,V>

public class MapChange<K,V>
extends Move

This Move class handles adding an entry to a Map.

Author:
Erik Vos

Field Summary
protected  K key
           
protected  boolean keyExisted
           
protected  java.util.Map<K,V> map
           
protected  V newValue
           
protected  V oldValue
           
 
Fields inherited from class rails.game.move.Move
log, models
 
Constructor Summary
MapChange(java.util.Map<K,V> map, K key, V newValue)
          Creates a move that changes a map pair
 
Method Summary
 boolean execute()
           
 java.lang.String toString()
           
 boolean undo()
           
 
Methods inherited from class rails.game.move.Move
registerModelToUpdate, updateModels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

map

protected java.util.Map<K,V> map

key

protected K key

newValue

protected V newValue

oldValue

protected V oldValue

keyExisted

protected boolean keyExisted
Constructor Detail

MapChange

public MapChange(java.util.Map<K,V> map,
                 K key,
                 V newValue)
Creates a move that changes a map pair

Method Detail

execute

public boolean execute()
Specified by:
execute in class Move

undo

public boolean undo()
Specified by:
undo in class Move

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object