Professional Documents
Culture Documents
Task 1:
Task 2:
● Determine Characteristics :
❖ Step 1 : identifty
adjacentHash(String hash,Direction direction)
Returns hash of adjacent hash
parameter:
hash : string hash relative to which the adjacent
is returned
direction : direction relative to hash for which
the adjacent is returned
right(String hash)
Returns the adjacent hash to the right (east).
Parameters:
hash : to check
left(String hash)
Parameters:
hash : origin
top(String hash)
Parameters:
hash - origin
bottom(String hash)
Parameters:
hash - origin
djacentHash(String hash,Direction
direction,int steps)
Returns the adjacent hash N steps in the given Direction
Parameters:
neighbours(String hash)
Returns a list of the 8 surrounding hashes for a given hash in order left
Parameters:
hash - source
Parameters:
p - point
encodeHash(LatLong p)
Returns a geohash of of length MAX_HASH_LENGTH (12)
Parameters:
p - point
length)
Parameters:
decodeHash(String geohash)
Returns a latitude,longitude pair as the centre of the given geohash.
Parameters:
hashLengthToCoverBoundingBox(double
topLeftLat,double topLeftLon,double
bottomRightLat,double bottomRightLon)
Returns the maximum length of hash that covers the bounding box.
Parameters:
east)
lon)
Returns true if and only if the bounding box corresponding to the hash contains the
Parameters:
lat - latitude
lon - longitude
overBoundingBox(double topLeftLat,double
topLeftLon,double bottomRightLat,double
bottomRightLon)
Returns the result of coverBoundingBoxMaxHashes with a maxHashes value of
GeoHash
Parameters:
east)
east)
coverBoundingBoxMaxHashes(double topLeftLat,
Parameters:
coverBoundingBox(double topLeftLat,double
topLeftLon,double bottomRightLat,double
bottomRightLon,int length)
Returns the hashes of given length that are required to cover the given bounding box.
Parameters:
length - of hash
heightDegrees(int n)
Returns height in degrees of all geohashes of length n
Parameters:
n - length of geohash
widthDegrees(int n)
Returns width in degrees of all geohashes of length n. Results are deterministic and cached to
increase performance (might be unnecessary, have not benchmarked).
Parameters:
n - length of hash
Returns a String of lines of hashes to represent the relative positions of hashes on a map
Parameters:
Returns a String of lines of hashes to represent the relative positions of hashes on a map.
Parameters:
negative).
negative).
negative).
negative).
gridAsString(String hash,int fromRight,int
fromBottom,int toRight,int toBottom,Set<String>
highlightThese)
Returns a String of lines of hashes to represent the relative positions of hashes on a map.
Parameters:
negative).
negative).
negative).
negative).
ID Char adja right left bott top adja enco enco enco enco part-
cent om cent deH deH deH deH itioning
Has Has ash ash ahs ash
h h
C1 val x x x x x x x x {1=<x<=12
idH ,x>12,
ash x<1
Len }
g
C2 Not x x {true,false}
Nul
lDi
rec
tio
n
C3 val x x {-90-
idL <x<=90,
ati x<-90,
tud x>90
e }
C4 Not x x {true,false}
Nul
l
Lat
lon
g
(x>12,L Null,
eft,
step>= step>=
0), 0)
(1=<x<
=12,TO
P,
step<0)
,
(1=<x<
=12,Rig
ht,
step>=
0),
(1=<x<
=12,RI
GHT,
step<0)
}
encode C3 {- none n/a 3
Hash 90=<x<
=90,x>
90,x<-
90}
encode C1 none n/a 3
Hash C4 {
(1=<x<
=12,Tru
e),
(x<1,Fal
se),
(x>12,F
alse),
}
encode C1 none n/a 3
Hash C3 {
(1=<x<
=12,-
90=<lat
<=90),
(x<1,lat
<-90),
(x>12,la
t>90),
}
encode C4 {true,fa none n/a 2
Hash lse}
1- testAdjacentHash:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
We will partition the input space of the direction on four spaces:
- When the direction is high.
- When the direction is low.
- When the direction is left.
- When the direction is right.
2- testAdjacentHash2:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
We will partition the input space of the direction on four spaces:
- When the direction is high.
- When the direction is low.
- When the direction is left.
- When the direction is right.
We will partition the input space of steps to three parts:
- When the steps are positive (like 2).
- When the steps are negative (like -2).
- When the steps are zero.
- When the steps are 1 because it’s a boundary value.
- When the steps are -1 because it’s a boundary value.
3- testCoverBoundingBoxMaxHashes:
We will partition each input to the following partitions:
- When the value is positive.
- When the value is negative.
- When the value is zero.
4- testLeft:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
5- testRight:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
6- testBottom:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
7- testTop:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
8- testCoverBoundingBox:
We will partition each input(integer or double) to the following partitions:
- When the value is positive or zero.
- When the value is negative.
9- testCoverBoundingBox2:
We will partition each input(integer or double) to the following partitions:
- When the value is positive or zero.
- When the value is negative.
10- testDecodeHash:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
11- testEncodeHash:
We will partition each input to the following partitions:
- When the value is positive.
- When the value is negative.
- When the value is zero.
We will partition the longitude and latitude into:
- When the value is between -90 and 90.
- When the value is greater than 90.
- When the value is less than -90.
12- testEncodeHash2:
We will partition each input to the following partitions:
- When the value is positive.
- When the value is negative.
- When the value is zero.
13- testEncodeHash3:
We will partition each input to the following partitions:
- When the value is positive.
- When the value is negative.
- When the value is zero.
14- testEncodeHash4:
We will partition each input to the following partitions:
- When the value is positive.
- When the value is negative.
- When the value is zero.
15- testGridAsString:
We will partition each integer input to the following:
- When the input is positive or zero.
- When the input is negative.
16- testGridAsString2:
We will partition each integer input to the following:
- When the input is positive or zero.
- When the input is negative.
17- testGridAsString3:
We will partition each integer input to the following:
- When the input is positive or zero.
- When the input is negative.
18- testHashContains:
We will partition the hash to three partitions:
- When the string is empty.
- When the string is of length >= 1 and <= 12.
- When the string is of length > 12.
We will partition the integer inputs into two partitions:
- When the input is positive or zero.
- When the input is negative.
We will partition the output into two partitions:
- When the hash doesn’t contain the location.(false)
- When the hash contains the location.(true)
19- testHashLengthToCoverBoundingBox:
We will partition the integer inputs into two partitions:
- When the input is positive or zero.
- When the input is negative.
We will partition the output to two partitions:
- When the output length is from 1 to 12.
- When the output length is greater than 12.
20- testHeightDegrees:
We will partition the input to two partitions:
- When the input is from 1 to 12.
- When the input is greater than 12.
21- testWidthDegrees:
We will partition the input to two partitions:
- When the input is from 1 to 12.
- When the input is greater than 12.
22- testNeighbours:
We will partition the input to two partitions:
- When the input length is from 1 to 12.
- When the input length is greater than 12.