remove redundant local variable

This commit is contained in:
Dennis Luxen
2014-10-28 10:39:29 -04:00
parent 8a5538356b
commit b227c90c18
14 changed files with 43 additions and 40 deletions
+4 -4
View File
@@ -72,7 +72,7 @@ bool FixedPointCoordinate::isSet() const
{
return (std::numeric_limits<int>::min() != lat) && (std::numeric_limits<int>::min() != lon);
}
bool FixedPointCoordinate::isValid() const
bool FixedPointCoordinate::is_valid() const
{
if (lat > 90 * COORDINATE_PRECISION || lat < -90 * COORDINATE_PRECISION ||
lon > 180 * COORDINATE_PRECISION || lon < -180 * COORDINATE_PRECISION)
@@ -246,7 +246,7 @@ FixedPointCoordinate::ComputePerpendicularDistance(const FixedPointCoordinate &s
nearest_location.lon = static_cast<int>(q * COORDINATE_PRECISION);
}
BOOST_ASSERT(nearest_location.isValid());
BOOST_ASSERT(nearest_location.is_valid());
return FixedPointCoordinate::ApproximateEuclideanDistance(point, nearest_location);
}
@@ -256,7 +256,7 @@ float FixedPointCoordinate::ComputePerpendicularDistance(const FixedPointCoordin
FixedPointCoordinate &nearest_location,
float &ratio)
{
BOOST_ASSERT(query_location.isValid());
BOOST_ASSERT(query_location.is_valid());
// initialize values
const double x = lat2y(query_location.lat / COORDINATE_PRECISION);
@@ -319,7 +319,7 @@ float FixedPointCoordinate::ComputePerpendicularDistance(const FixedPointCoordin
nearest_location.lat = static_cast<int>(y2lat(p) * COORDINATE_PRECISION);
nearest_location.lon = static_cast<int>(q * COORDINATE_PRECISION);
}
BOOST_ASSERT(nearest_location.isValid());
BOOST_ASSERT(nearest_location.is_valid());
const float approximate_distance =
FixedPointCoordinate::ApproximateEuclideanDistance(query_location, nearest_location);
+5 -5
View File
@@ -640,7 +640,7 @@ class StaticRTree
}
}
}
return result_coordinate.isValid();
return result_coordinate.is_valid();
}
// implementation of the Hjaltason/Samet query [3], a BFS traversal of the tree
@@ -1097,7 +1097,7 @@ class StaticRTree
}
}
if (result_phantom_node.location.isValid())
if (result_phantom_node.location.is_valid())
{
// Hack to fix rounding errors and wandering via nodes.
FixUpRoundingIssue(input_coordinate, result_phantom_node);
@@ -1105,7 +1105,7 @@ class StaticRTree
// set forward and reverse weights on the phantom node
SetForwardAndReverseWeightsOnPhantomNode(nearest_edge, result_phantom_node);
}
return result_phantom_node.location.isValid();
return result_phantom_node.location.is_valid();
}
private:
@@ -1121,11 +1121,11 @@ class StaticRTree
if (SPECIAL_NODEID != result_phantom_node.forward_node_id)
{
result_phantom_node.forward_weight *= static_cast<decltype(result_phantom_node.forward_weight)>(ratio);
result_phantom_node.forward_weight *= ratio;
}
if (SPECIAL_NODEID != result_phantom_node.reverse_node_id)
{
result_phantom_node.reverse_weight *= static_cast<decltype(result_phantom_node.reverse_weight)>(1.f - ratio);
result_phantom_node.reverse_weight *= (1.f - ratio);
}
}
+10 -10
View File
@@ -78,37 +78,37 @@ int PhantomNode::GetReverseWeightPlusOffset() const
return reverse_offset + reverse_weight;
}
bool PhantomNode::isBidirected() const
bool PhantomNode::is_bidirected() const
{
return (forward_node_id != SPECIAL_NODEID) &&
(reverse_node_id != SPECIAL_NODEID);
}
bool PhantomNode::IsCompressed() const
bool PhantomNode::is_compressed() const
{
return (forward_offset != 0) || (reverse_offset != 0);
}
bool PhantomNode::isValid(const unsigned numberOfNodes) const
bool PhantomNode::is_valid(const unsigned number_of_nodes) const
{
return
location.isValid() &&
location.is_valid() &&
(
(forward_node_id < numberOfNodes) ||
(reverse_node_id < numberOfNodes)
(forward_node_id < number_of_nodes) ||
(reverse_node_id < number_of_nodes)
) &&
(
(forward_weight != INVALID_EDGE_WEIGHT) ||
(reverse_weight != INVALID_EDGE_WEIGHT)
) &&
(name_id != std::numeric_limits<unsigned>::max()
(name_id != INVALID_NAMEID
);
}
bool PhantomNode::isValid() const
bool PhantomNode::is_valid() const
{
return location.isValid() &&
(name_id != std::numeric_limits<unsigned>::max());
return location.is_valid() &&
(name_id != INVALID_NAMEID);
}
bool PhantomNode::operator==(const PhantomNode & other) const
+5 -5
View File
@@ -30,9 +30,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <osrm/Coordinate.h>
#include "../DataStructures/TravelMode.h"
#include "../Util/simple_logger.hpp"
#include "../typedefs.h"
#include <iostream>
#include <vector>
struct PhantomNode
@@ -62,13 +62,13 @@ struct PhantomNode
int GetReverseWeightPlusOffset() const;
bool isBidirected() const;
bool is_bidirected() const;
bool IsCompressed() const;
bool is_compressed() const;
bool isValid(const unsigned numberOfNodes) const;
bool is_valid(const unsigned numberOfNodes) const;
bool isValid() const;
bool is_valid() const;
bool operator==(const PhantomNode & other) const;
};