map access layer cleanup

This commit is contained in:
Arndt 2015-09-12 16:12:24 +02:00
parent 2cec35f3cc
commit f8dee5b7d1
7 changed files with 163 additions and 150 deletions

View file

@ -11,10 +11,12 @@ import btools.util.ByteArrayUnifier;
public final class OsmNodesMap
{
private HashMap<Long,OsmNode> hmap = new HashMap<Long,OsmNode>();
private HashMap<OsmNode,OsmNode> hmap = new HashMap<OsmNode,OsmNode>();
private ByteArrayUnifier abUnifier = new ByteArrayUnifier( 16384, false );
private OsmNode testKey = new OsmNode();
public ByteArrayUnifier getByteArrayUnifier()
{
return abUnifier;
@ -26,22 +28,24 @@ public final class OsmNodesMap
*/
public OsmNode get( long id )
{
return hmap.get( new Long( id ) );
testKey.ilon = (int)(id >> 32);
testKey.ilat = (int)(id & 0xffffffff);
return hmap.get( testKey );
}
public void remove( long id )
public void remove( OsmNode node )
{
hmap.remove( new Long( id ) );
hmap.remove( node );
}
/**
* Put a node into the map
* @return the previous node if that id existed, else null
*/
public OsmNode put( long id, OsmNode node )
public OsmNode put( OsmNode node )
{
return hmap.put( new Long( id ), node );
return hmap.put( node, node );
}