Fix JavaDoc errors
This commit is contained in:
parent
d621964863
commit
780e865870
14 changed files with 124 additions and 128 deletions
|
|
@ -15,13 +15,13 @@ public class BitCoderContext
|
|||
this.ab = ab;
|
||||
idxMax = ab.length-1;
|
||||
}
|
||||
|
||||
|
||||
public final void reset( byte[] ab )
|
||||
{
|
||||
this.ab = ab;
|
||||
idxMax = ab.length-1;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
public final void reset()
|
||||
{
|
||||
|
|
@ -29,16 +29,16 @@ public class BitCoderContext
|
|||
bm = 0x100;
|
||||
bits = 0;
|
||||
b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* encode a distance with a variable bit length
|
||||
* (poor mans huffman tree)
|
||||
* 1 -> 0
|
||||
* 01 -> 1 + following 1-bit word ( 1..2 )
|
||||
* 001 -> 3 + following 2-bit word ( 3..6 )
|
||||
* 0001 -> 7 + following 3-bit word ( 7..14 ) etc.
|
||||
*
|
||||
* {@code 1 -> 0}
|
||||
* {@code 01 -> 1} + following 1-bit word ( 1..2 )
|
||||
* {@code 001 -> 3} + following 2-bit word ( 3..6 )
|
||||
* {@code 0001 -> 7} + following 3-bit word ( 7..14 ) etc.
|
||||
*
|
||||
* @see #decodeVarBits
|
||||
*/
|
||||
public final void encodeVarBits( int value )
|
||||
|
|
@ -175,7 +175,7 @@ public class BitCoderContext
|
|||
bits -= count;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
private void fillBuffer()
|
||||
{
|
||||
while (bits < 24)
|
||||
|
|
@ -186,7 +186,7 @@ public class BitCoderContext
|
|||
}
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the encoded length in bytes
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public final class ByteArrayUnifier implements IByteArrayUnifier
|
|||
* Unify a byte array in order to reuse instances when possible.
|
||||
* The byte arrays are assumed to be treated as immutable,
|
||||
* allowing the reuse
|
||||
* @param the byte array to unify
|
||||
* @param ab the byte array to unify
|
||||
* @return the cached instance or the input instanced if not cached
|
||||
*/
|
||||
public byte[] unify( byte[] ab )
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ public final class CheapRulerSingleton {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate the degree->meter scale for given latitude
|
||||
* Calculate the degree->meter scale for given latitude
|
||||
*
|
||||
* @result [lon->meter,lat->meter]
|
||||
* @return [lon->meter,lat->meter]
|
||||
*/
|
||||
public static double[] getLonLatToMeterScales( int ilat ) {
|
||||
return SCALE_CACHE[ ilat / SCALE_CACHE_INCREMENT ];
|
||||
|
|
@ -67,8 +67,9 @@ public final class CheapRulerSingleton {
|
|||
* @param ilat2 Integer latitude for the end point, this is (latitude + 90) * 1e6.
|
||||
* @return The distance between the two points, in meters.
|
||||
*
|
||||
* @note Integer longitude is ((longitude in degrees) + 180) * 1e6.
|
||||
* Integer latitude is ((latitude in degrees) + 90) * 1e6.
|
||||
* Note:
|
||||
* Integer longitude is ((longitude in degrees) + 180) * 1e6.
|
||||
* Integer latitude is ((latitude in degrees) + 90) * 1e6.
|
||||
*/
|
||||
public static double distance(int ilon1, int ilat1, int ilon2, int ilat2) {
|
||||
double[] kxky = getLonLatToMeterScales( ( ilat1 + ilat2 ) >> 1 );
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ public class DenseLongMap
|
|||
* Creates a DenseLongMap for the default block size
|
||||
* ( 512 bytes per bitplane, covering a key range of 4096 keys )
|
||||
* Note that one value range is limited to 0..254
|
||||
*
|
||||
* @param valuebits number of bits to use per value
|
||||
*/
|
||||
public DenseLongMap()
|
||||
{
|
||||
|
|
@ -85,7 +83,7 @@ public class DenseLongMap
|
|||
while (blocklist.size() < blockn+1 )
|
||||
{
|
||||
blocklist.add(null);
|
||||
}
|
||||
}
|
||||
blocklist.set( blockn, block );
|
||||
}
|
||||
else
|
||||
|
|
@ -99,7 +97,7 @@ public class DenseLongMap
|
|||
int headersize = 1 << valuebits;
|
||||
|
||||
byte v = (byte)(value + 1); // 0 is reserved (=unset)
|
||||
|
||||
|
||||
// find the index in the lookup table or the first entry
|
||||
int idx = 1;
|
||||
while( idx < headersize )
|
||||
|
|
@ -122,7 +120,7 @@ public class DenseLongMap
|
|||
valuebits++;
|
||||
headersize = 1 << valuebits;
|
||||
}
|
||||
|
||||
|
||||
int bitmask = 1 << (offset & 0x7);
|
||||
int invmask = bitmask ^ 0xff;
|
||||
int probebit = 1;
|
||||
|
|
@ -149,7 +147,7 @@ public class DenseLongMap
|
|||
// size is lookup table + datablocks
|
||||
return ( 1 << bits ) + blocksize * bits;
|
||||
}
|
||||
|
||||
|
||||
private byte[] expandBlock( byte[] block, int valuebits )
|
||||
{
|
||||
bitplaneCount[valuebits] ++;
|
||||
|
|
@ -204,7 +202,7 @@ public class DenseLongMap
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// check how many bitplanes we have from the arrayzize
|
||||
int valuebits = 1;
|
||||
while( sizeForBits( valuebits) < block.length )
|
||||
|
|
@ -212,7 +210,7 @@ public class DenseLongMap
|
|||
valuebits++;
|
||||
}
|
||||
int headersize = 1 << valuebits;
|
||||
|
||||
|
||||
int bitmask = 1 << (offset & 7);
|
||||
int probebit = 1;
|
||||
int blockidx = (offset >> 3) + headersize;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import java.util.Random;
|
|||
|
||||
/**
|
||||
* Memory efficient and lightning fast heap to get the lowest-key value of a set of key-object pairs
|
||||
*
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
public final class SortedHeap<V>
|
||||
|
|
@ -54,7 +54,7 @@ public final class SortedHeap<V>
|
|||
Object[] vla; // value array
|
||||
int lv; // low value
|
||||
int lp; // low pointer
|
||||
|
||||
|
||||
SortedBin( int binsize, SortedHeap parent )
|
||||
{
|
||||
this.binsize = binsize;
|
||||
|
|
@ -63,7 +63,7 @@ public final class SortedHeap<V>
|
|||
vla = new Object[binsize];
|
||||
lp = binsize;
|
||||
}
|
||||
|
||||
|
||||
SortedBin next()
|
||||
{
|
||||
if ( next == null )
|
||||
|
|
@ -108,7 +108,7 @@ public final class SortedHeap<V>
|
|||
neBin = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void add( int key, Object value )
|
||||
{
|
||||
int p = lp;
|
||||
|
|
@ -126,17 +126,15 @@ public final class SortedHeap<V>
|
|||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add a key value pair to the heap
|
||||
*
|
||||
* @param id
|
||||
* the key to insert
|
||||
* @param value
|
||||
* the value to insert object
|
||||
*
|
||||
* @param key the key to insert
|
||||
* @param value the value to insert object
|
||||
*/
|
||||
public void add( int key, V value )
|
||||
{
|
||||
|
|
@ -164,16 +162,16 @@ public final class SortedHeap<V>
|
|||
first.nextNonEmpty = second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void sortUp()
|
||||
{
|
||||
if ( size > peaksize )
|
||||
{
|
||||
peaksize = size;
|
||||
}
|
||||
|
||||
|
||||
// determine the first array big enough to take them all
|
||||
int cnt = 8; // value count of first 2 bins is always 8
|
||||
SortedBin tbin = second; // target bin
|
||||
|
|
@ -193,10 +191,10 @@ public final class SortedHeap<V>
|
|||
int[] al_t = tbin.al;
|
||||
Object[] vla_t = tbin.vla;
|
||||
int tp = tbin.binsize-cnt; // target pointer
|
||||
|
||||
|
||||
// unlink any higher, non-empty arrays
|
||||
SortedBin otherNonEmpty = lastNonEmpty.nextNonEmpty;
|
||||
lastNonEmpty.nextNonEmpty = null;
|
||||
lastNonEmpty.nextNonEmpty = null;
|
||||
|
||||
// now merge the content of these non-empty bins into the target bin
|
||||
while( firstNonEmpty != null )
|
||||
|
|
@ -215,7 +213,7 @@ public final class SortedHeap<V>
|
|||
}
|
||||
|
||||
// current minimum found, copy to target array
|
||||
al_t[tp] = minId;
|
||||
al_t[tp] = minId;
|
||||
vla_t[tp++] = minBin.dropLowest();
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +231,7 @@ public final class SortedHeap<V>
|
|||
second = new SortedBin( 4, this );
|
||||
firstNonEmpty = null;
|
||||
}
|
||||
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return size;
|
||||
|
|
@ -267,7 +265,7 @@ public final class SortedHeap<V>
|
|||
}
|
||||
return tp;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SortedHeap<String> sh = new SortedHeap<String>();
|
||||
|
|
@ -296,6 +294,6 @@ System.out.println( "popLowestKeyValue: " + val);
|
|||
// Assert.assertTrue( "total count test", cnt == 100000 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue