some more cleanup and performance squeezing

This commit is contained in:
Arndt 2016-08-23 14:33:37 +02:00
parent f70dd3c3ac
commit 12d8cae46f
16 changed files with 265 additions and 212 deletions

View file

@ -1,16 +0,0 @@
/**
* Container for routig configs
*
* @author ab
*/
package btools.mapaccess;
public interface DistanceChecker
{
/**
* Checks whether the given path is within a maximum distance
* known to the distance checker
* @return true if close enough
*/
boolean isWithinRadius( int ilon0, int ilat0, OsmTransferNode firstTransfer, int ilon1, int ilat1 );
}

View file

@ -42,6 +42,11 @@ public final class NodesCache
private long cacheSum = 0;
private boolean garbageCollectionEnabled = false;
public String formatStatus()
{
return "collecting=" + garbageCollectionEnabled + " cacheSum=" + cacheSum;
}
public NodesCache( String segmentDir, OsmNodesMap nodesMap, BExpressionContextWay ctxWay, boolean carMode, boolean forceSecondaryData,
NodesCache oldCache )
@ -91,7 +96,7 @@ public final class NodesCache
// clean all ghosts and enable garbage collection
private void checkEnableCacheCleaning()
{
if ( cacheSum < 500000 || garbageCollectionEnabled )
if ( cacheSum < 3000000 || garbageCollectionEnabled )
return;
for ( int i = 0; i < fileRows.length; i++ )

View file

@ -178,8 +178,7 @@ public class OsmNode implements OsmPos
OsmLink link = getCompatibleLink( linklon, linklat, isReverse, 2 );
if ( link == null ) // .. not found, then check the hollow nodes
{
long targetNodeId = ( (long) linklon ) << 32 | linklat;
OsmNode tn = hollowNodes.get( targetNodeId ); // target node
OsmNode tn = hollowNodes.get( linklon, linklat ); // target node
if ( tn == null ) // node not yet known, create a new hollow proxy
{
tn = new OsmNode( linklon, linklat );

View file

@ -26,10 +26,10 @@ public final class OsmNodesMap
* Get a node from the map
* @return the node for the given id if exist, else null
*/
public OsmNode get( long id )
public OsmNode get( int ilon, int ilat )
{
testKey.ilon = (int)(id >> 32);
testKey.ilat = (int)(id & 0xffffffff);
testKey.ilon = ilon;
testKey.ilat = ilat;
return hmap.get( testKey );
}
@ -48,13 +48,4 @@ public final class OsmNodesMap
return hmap.put( node, node );
}
/**
* @return the number of nodes in that map
*/
public int size()
{
return hmap.size();
}
}