refactor member names in ImportEdge
This commit is contained in:
@@ -29,19 +29,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
bool NodeBasedEdge::operator<(const NodeBasedEdge &e) const
|
||||
{
|
||||
if (source() == e.source())
|
||||
if (source == e.source)
|
||||
{
|
||||
if (target() == e.target())
|
||||
if (target == e.target)
|
||||
{
|
||||
if (weight() == e.weight())
|
||||
if (weight == e.weight)
|
||||
{
|
||||
return (isForward() && isBackward() && ((!e.isForward()) || (!e.isBackward())));
|
||||
return (forward && backward && ((!e.forward) || (!e.backward)));
|
||||
}
|
||||
return (weight() < e.weight());
|
||||
return (weight < e.weight);
|
||||
}
|
||||
return (target() < e.target());
|
||||
return (target < e.target);
|
||||
}
|
||||
return (source() < e.source());
|
||||
return (source < e.source);
|
||||
}
|
||||
|
||||
NodeBasedEdge::NodeBasedEdge(NodeID s,
|
||||
@@ -56,8 +56,8 @@ bool NodeBasedEdge::operator<(const NodeBasedEdge &e) const
|
||||
bool ar,
|
||||
bool cf,
|
||||
bool is_split)
|
||||
: _source(s), _target(t), _name(n), _weight(w), _type(ty), forward(f), backward(b),
|
||||
_roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _contraFlow(cf),
|
||||
: source(s), target(t), name(n), weight(w), type(ty), forward(f), backward(b),
|
||||
roundabout(ra), ignoreInGrid(ig), accessRestricted(ar), contraFlow(cf),
|
||||
is_split(is_split)
|
||||
{
|
||||
if (ty < 0)
|
||||
@@ -66,24 +66,6 @@ bool NodeBasedEdge::operator<(const NodeBasedEdge &e) const
|
||||
}
|
||||
}
|
||||
|
||||
NodeID NodeBasedEdge::target() const { return _target; }
|
||||
NodeID NodeBasedEdge::source() const { return _source; }
|
||||
NodeID NodeBasedEdge::name() const { return _name; }
|
||||
EdgeWeight NodeBasedEdge::weight() const { return _weight; }
|
||||
short NodeBasedEdge::type() const
|
||||
{
|
||||
BOOST_ASSERT_MSG(_type >= 0, "type of ImportEdge invalid");
|
||||
return _type;
|
||||
}
|
||||
bool NodeBasedEdge::isBackward() const { return backward; }
|
||||
bool NodeBasedEdge::isForward() const { return forward; }
|
||||
bool NodeBasedEdge::isLocatable() const { return _type != 14; }
|
||||
bool NodeBasedEdge::isRoundabout() const { return _roundabout; }
|
||||
bool NodeBasedEdge::ignoreInGrid() const { return _ignoreInGrid; }
|
||||
bool NodeBasedEdge::isAccessRestricted() const { return _accessRestricted; }
|
||||
bool NodeBasedEdge::isContraFlow() const { return _contraFlow; }
|
||||
bool NodeBasedEdge::IsSplit() const { return is_split; }
|
||||
|
||||
bool EdgeBasedEdge::operator<(const EdgeBasedEdge &e) const
|
||||
{
|
||||
if (source() == e.source())
|
||||
|
||||
@@ -52,32 +52,17 @@ class NodeBasedEdge
|
||||
bool cf,
|
||||
bool is_split);
|
||||
|
||||
NodeID target() const;
|
||||
NodeID source() const;
|
||||
NodeID name() const;
|
||||
EdgeWeight weight() const;
|
||||
short type() const;
|
||||
bool isBackward() const;
|
||||
bool isForward() const;
|
||||
bool isLocatable() const;
|
||||
bool isRoundabout() const;
|
||||
bool ignoreInGrid() const;
|
||||
bool isAccessRestricted() const;
|
||||
bool isContraFlow() const;
|
||||
bool IsSplit() const;
|
||||
|
||||
// TODO: names need to be fixed.
|
||||
NodeID _source;
|
||||
NodeID _target;
|
||||
NodeID _name;
|
||||
EdgeWeight _weight;
|
||||
short _type;
|
||||
NodeID source;
|
||||
NodeID target;
|
||||
NodeID name;
|
||||
EdgeWeight weight;
|
||||
short type;
|
||||
bool forward : 1;
|
||||
bool backward : 1;
|
||||
bool _roundabout : 1;
|
||||
bool _ignoreInGrid : 1;
|
||||
bool _accessRestricted : 1;
|
||||
bool _contraFlow : 1;
|
||||
bool roundabout : 1;
|
||||
bool ignoreInGrid : 1;
|
||||
bool accessRestricted : 1;
|
||||
bool contraFlow : 1;
|
||||
bool is_split : 1;
|
||||
|
||||
NodeBasedEdge() = delete;
|
||||
|
||||
@@ -60,19 +60,19 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
|
||||
for (const ImportEdge &import_edge : input_edge_list)
|
||||
{
|
||||
// TODO: give ImportEdge a proper c'tor to use emplace_back's below
|
||||
if (!import_edge.isForward())
|
||||
if (!import_edge.forward)
|
||||
{
|
||||
edge.source = import_edge.target();
|
||||
edge.target = import_edge.source();
|
||||
edge.data.backward = import_edge.isForward();
|
||||
edge.data.forward = import_edge.isBackward();
|
||||
edge.source = import_edge.target;
|
||||
edge.target = import_edge.source;
|
||||
edge.data.backward = import_edge.forward;
|
||||
edge.data.forward = import_edge.backward;
|
||||
}
|
||||
else
|
||||
{
|
||||
edge.source = import_edge.source();
|
||||
edge.target = import_edge.target();
|
||||
edge.data.forward = import_edge.isForward();
|
||||
edge.data.backward = import_edge.isBackward();
|
||||
edge.source = import_edge.source;
|
||||
edge.target = import_edge.target;
|
||||
edge.data.forward = import_edge.forward;
|
||||
edge.data.backward = import_edge.backward;
|
||||
}
|
||||
|
||||
if (edge.source == edge.target)
|
||||
@@ -80,18 +80,18 @@ NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge
|
||||
continue;
|
||||
}
|
||||
|
||||
edge.data.distance = (std::max)((int)import_edge.weight(), 1);
|
||||
edge.data.distance = (std::max)((int)import_edge.weight, 1);
|
||||
BOOST_ASSERT(edge.data.distance > 0);
|
||||
edge.data.shortcut = false;
|
||||
edge.data.roundabout = import_edge.isRoundabout();
|
||||
edge.data.ignore_in_grid = import_edge.ignoreInGrid();
|
||||
edge.data.nameID = import_edge.name();
|
||||
edge.data.type = import_edge.type();
|
||||
edge.data.isAccessRestricted = import_edge.isAccessRestricted();
|
||||
edge.data.contraFlow = import_edge.isContraFlow();
|
||||
edge.data.roundabout = import_edge.roundabout;
|
||||
edge.data.ignore_in_grid = import_edge.ignoreInGrid;
|
||||
edge.data.nameID = import_edge.name;
|
||||
edge.data.type = import_edge.type;
|
||||
edge.data.isAccessRestricted = import_edge.accessRestricted;
|
||||
edge.data.contraFlow = import_edge.contraFlow;
|
||||
edges_list.push_back(edge);
|
||||
|
||||
if (!import_edge.IsSplit())
|
||||
if (!import_edge.is_split)
|
||||
{
|
||||
using std::swap; // enable ADL
|
||||
swap(edge.source, edge.target);
|
||||
|
||||
Reference in New Issue
Block a user