Make an adapter for the board to serialize the one and only inner map only

This commit is contained in:
Olof Larsson
2013-04-11 09:38:08 +02:00
parent 1ebb6a3f69
commit 2c12fb7739
3 changed files with 67 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package com.massivecraft.factions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -50,8 +51,24 @@ public class Board extends Entity<Board, String> implements BoardInterface
// FIELDS
// -------------------------------------------- //
// TODO: Make TerritoryAccess immutable!
private ConcurrentSkipListMap<PS, TerritoryAccess> map = new ConcurrentSkipListMap<PS, TerritoryAccess>();
// TODO: Make TerritoryAccess immutable.
private ConcurrentSkipListMap<PS, TerritoryAccess> map;
public Map<PS, TerritoryAccess> getMap() { return Collections.unmodifiableMap(this.map); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Board()
{
this.map = new ConcurrentSkipListMap<PS, TerritoryAccess>();
}
public Board(Map<PS, TerritoryAccess> map)
{
this.map = new ConcurrentSkipListMap<PS, TerritoryAccess>(map);
}
// -------------------------------------------- //
// OVERRIDE: BOARD