So basically if you have two points in 2D space
$p_1=\left(x_1,y_1\right)$ and $p_2=\left(x_2,y_2\right)$.
Its distance, as calculated in this Java code, is the Euclidean distance
$d=\sqrt{\left(x_1-x_2\right)^2+\left(y_1-y_2\right)^2}$
In parts, the function _locationDistance_ computes the parts inside the parenthesis in the square root and the function _vectorDistance_ computes _d_.
It is not clear from your piece of code but I suspect that the variables _prev_ and _curr_ will be part of a loop that tries to compare a given location ( _targetLocation_ ) with a set of other locations ( _locationData_ ) and keep always the minimum in _prev_ comparing with the new ones in _curr_. And that's what is done in the reduce statement.