rails.game.move
Class DoubleMapChange<K1,K2,V>

java.lang.Object
  extended by rails.game.move.Move
      extended by rails.game.move.DoubleMapChange<K1,K2,V>

public class DoubleMapChange<K1,K2,V>
extends Move

This Move class handles adding an entry to a 2-D Map (a Map of Maps, or a matrix). An Undo will remove the second key, but not the first key.

Author:
Erik Vos

Field Summary
protected  K1 firstKey
           
protected  java.util.HashMap<K1,java.util.HashMap<K2,V>> map
           
protected  K2 secondKey
           
protected  V value
           
 
Fields inherited from class rails.game.move.Move
log, models
 
Constructor Summary
DoubleMapChange(java.util.HashMap<K1,java.util.HashMap<K2,V>> map, K1 firstKey, K2 secondKey, V value)
           
 
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.HashMap<K1,java.util.HashMap<K2,V>> map

firstKey

protected K1 firstKey

secondKey

protected K2 secondKey

value

protected V value
Constructor Detail

DoubleMapChange

public DoubleMapChange(java.util.HashMap<K1,java.util.HashMap<K2,V>> map,
                       K1 firstKey,
                       K2 secondKey,
                       V value)
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