some microtuning
This commit is contained in:
parent
d963814d78
commit
2213d4f7fc
9 changed files with 278 additions and 149 deletions
|
|
@ -144,16 +144,8 @@ final class OsmFile
|
|||
asize = getDataInputForSubIdx( subIdx, ab );
|
||||
dataBuffers = new DataBuffers( ab );
|
||||
}
|
||||
// hack: the checksum contains the information
|
||||
// which type of microcache we have
|
||||
|
||||
int crcData = Crc32.crc( ab, 0, asize - 4 );
|
||||
int crcFooter = new ByteDataReader( ab, asize - 4 ).readInt();
|
||||
if ( crcData == crcFooter )
|
||||
{
|
||||
throw new IOException( "old, unsupported data-format" );
|
||||
}
|
||||
else if ( ( crcData ^ 2 ) == crcFooter )
|
||||
try
|
||||
{
|
||||
if ( !reallyDecode )
|
||||
{
|
||||
|
|
@ -166,7 +158,21 @@ final class OsmFile
|
|||
new DirectWeaver( dataBuffers, lonIdx, latIdx, divisor, wayValidator, waypointMatcher, hollowNodes );
|
||||
return MicroCache.emptyNonVirgin;
|
||||
}
|
||||
throw new IOException( "checkum error" );
|
||||
catch( Throwable t )
|
||||
{
|
||||
// checksum test now only in case of trouble
|
||||
int crcData = Crc32.crc( ab, 0, asize - 4 );
|
||||
int crcFooter = new ByteDataReader( ab, asize - 4 ).readInt();
|
||||
if ( crcData == crcFooter )
|
||||
{
|
||||
throw new IOException( "old, unsupported data-format" );
|
||||
}
|
||||
else if ( ( crcData ^ 2 ) == crcFooter )
|
||||
{
|
||||
throw new IOException( "checkum error" );
|
||||
}
|
||||
throw t instanceof Exception ? (Exception)t : new Exception( t.toString(), t );
|
||||
}
|
||||
}
|
||||
|
||||
// set this OsmFile to ghost-state:
|
||||
|
|
|
|||
|
|
@ -45,13 +45,8 @@ public class OsmLink
|
|||
*/
|
||||
public final OsmNode getTarget( OsmNode source )
|
||||
{
|
||||
/* if ( isBidirectional() )
|
||||
{
|
||||
return n2 != source ? n2 : n1;
|
||||
}
|
||||
return n2 != null ? n2 : n1; */
|
||||
// return n2 != source && n2 != null ? n2 : n1;
|
||||
if ( n2 != null && n2 != source )
|
||||
return n2 != source && n2 != null ? n2 : n1;
|
||||
/* if ( n2 != null && n2 != source )
|
||||
{
|
||||
return n2;
|
||||
}
|
||||
|
|
@ -63,7 +58,7 @@ public class OsmLink
|
|||
{
|
||||
new Throwable( "ups" ).printStackTrace();
|
||||
throw new IllegalArgumentException( "internal error: getTarget: unknown source; " + source + " n1=" + n1 + " n2=" + n2 );
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,8 +66,8 @@ public class OsmLink
|
|||
*/
|
||||
public final OsmLink getNext( OsmNode source )
|
||||
{
|
||||
// return n2 != source && n2 != null ? next : previous;
|
||||
if ( n2 != null && n2 != source )
|
||||
return n2 != source && n2 != null ? next : previous;
|
||||
/* if ( n2 != null && n2 != source )
|
||||
{
|
||||
return next;
|
||||
}
|
||||
|
|
@ -83,7 +78,7 @@ public class OsmLink
|
|||
else
|
||||
{
|
||||
throw new IllegalArgumentException( "internal error: gextNext: unknown source" );
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -152,8 +147,8 @@ public class OsmLink
|
|||
|
||||
public final boolean isReverse( OsmNode source )
|
||||
{
|
||||
// return n1 != source && n1 != null;
|
||||
if ( n2 != null && n2 != source )
|
||||
return n1 != source && n1 != null;
|
||||
/* if ( n2 != null && n2 != source )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -164,7 +159,7 @@ public class OsmLink
|
|||
else
|
||||
{
|
||||
throw new IllegalArgumentException( "internal error: isReverse: unknown source" );
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
public final boolean isBidirectional()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue