rename phantom nodes members
This commit is contained in:
@@ -34,9 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
struct PhantomNode {
|
||||
PhantomNode() :
|
||||
forward_node_id( SPECIAL_NODEID ),
|
||||
reverse_node_id( SPECIAL_NODEID ),
|
||||
name_id( std::numeric_limits<unsigned>::max() ),
|
||||
forward_node_id(SPECIAL_NODEID),
|
||||
reverse_node_id(SPECIAL_NODEID),
|
||||
name_id(std::numeric_limits<unsigned>::max()),
|
||||
forward_weight(INVALID_EDGE_WEIGHT),
|
||||
reverse_weight(INVALID_EDGE_WEIGHT),
|
||||
forward_offset(0),
|
||||
@@ -59,18 +59,20 @@ struct PhantomNode {
|
||||
unsigned short fwd_segment_position;
|
||||
|
||||
|
||||
int GetForwardWeightPlusOffset() const {
|
||||
int GetForwardWeightPlusOffset() const
|
||||
{
|
||||
SimpleLogger().Write(logDEBUG) << "->fwd_offset: " << forward_offset << ", weight: " << forward_weight;
|
||||
return reverse_offset + forward_weight;
|
||||
}
|
||||
|
||||
int GetReverseWeightPlusOffset() const {
|
||||
int GetReverseWeightPlusOffset() const
|
||||
{
|
||||
SimpleLogger().Write(logDEBUG) << "->rev_offset: " << reverse_offset << ", weight: " << reverse_weight;
|
||||
|
||||
return forward_offset + reverse_weight;
|
||||
}
|
||||
|
||||
void Reset() {
|
||||
void Reset()
|
||||
{
|
||||
forward_node_id = SPECIAL_NODEID;
|
||||
name_id = SPECIAL_NODEID;
|
||||
forward_weight = INVALID_EDGE_WEIGHT;
|
||||
@@ -81,16 +83,19 @@ struct PhantomNode {
|
||||
location.Reset();
|
||||
}
|
||||
|
||||
bool isBidirected() const {
|
||||
return ( forward_node_id != SPECIAL_NODEID ) &&
|
||||
( reverse_node_id != SPECIAL_NODEID );
|
||||
bool isBidirected() const
|
||||
{
|
||||
return (forward_node_id != SPECIAL_NODEID) &&
|
||||
(reverse_node_id != SPECIAL_NODEID);
|
||||
}
|
||||
|
||||
bool IsCompressed() const {
|
||||
bool IsCompressed() const
|
||||
{
|
||||
return (forward_offset != 0) || (reverse_offset != 0);
|
||||
}
|
||||
|
||||
bool isValid(const unsigned numberOfNodes) const {
|
||||
bool isValid(const unsigned numberOfNodes) const
|
||||
{
|
||||
return
|
||||
location.isValid() &&
|
||||
(
|
||||
@@ -107,39 +112,45 @@ struct PhantomNode {
|
||||
);
|
||||
}
|
||||
|
||||
bool operator==(const PhantomNode & other) const {
|
||||
bool operator==(const PhantomNode & other) const
|
||||
{
|
||||
return location == other.location;
|
||||
}
|
||||
};
|
||||
|
||||
struct PhantomNodes {
|
||||
struct PhantomNodes
|
||||
{
|
||||
//TODO: rename to lower-case non-camel source_*,target_*
|
||||
PhantomNode startPhantom;
|
||||
PhantomNode targetPhantom;
|
||||
void Reset() {
|
||||
startPhantom.Reset();
|
||||
targetPhantom.Reset();
|
||||
PhantomNode source_phantom;
|
||||
PhantomNode target_phantom;
|
||||
void Reset()
|
||||
{
|
||||
source_phantom.Reset();
|
||||
target_phantom.Reset();
|
||||
}
|
||||
|
||||
bool PhantomsAreOnSameNodeBasedEdge() const {
|
||||
return (startPhantom.forward_node_id == targetPhantom.forward_node_id);
|
||||
bool PhantomsAreOnSameNodeBasedEdge() const
|
||||
{
|
||||
return (source_phantom.forward_node_id == target_phantom.forward_node_id);
|
||||
}
|
||||
|
||||
bool AtLeastOnePhantomNodeIsInvalid() const {
|
||||
return ((startPhantom.forward_node_id == SPECIAL_NODEID) && (startPhantom.reverse_node_id == SPECIAL_NODEID)) ||
|
||||
((targetPhantom.forward_node_id == SPECIAL_NODEID) && (targetPhantom.reverse_node_id == SPECIAL_NODEID));
|
||||
bool AtLeastOnePhantomNodeIsInvalid() const
|
||||
{
|
||||
return ((source_phantom.forward_node_id == SPECIAL_NODEID) && (source_phantom.reverse_node_id == SPECIAL_NODEID)) ||
|
||||
((target_phantom.forward_node_id == SPECIAL_NODEID) && (target_phantom.reverse_node_id == SPECIAL_NODEID));
|
||||
}
|
||||
|
||||
bool PhantomNodesHaveEqualLocation() const {
|
||||
return startPhantom == targetPhantom;
|
||||
bool PhantomNodesHaveEqualLocation() const
|
||||
{
|
||||
return source_phantom == target_phantom;
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream &out, const PhantomNodes & pn) {
|
||||
// out << "Node1: " << pn.startPhantom.forward_node_id << "\n";
|
||||
// out << "Node2: " << pn.targetPhantom.reverse_node_id << "\n";
|
||||
out << "start_coord: " << pn.startPhantom.location << "\n";
|
||||
out << "target_coord: " << pn.targetPhantom.location << std::endl;
|
||||
// out << "Node1: " << pn.source_phantom.forward_node_id << "\n";
|
||||
// out << "Node2: " << pn.target_phantom.reverse_node_id << "\n";
|
||||
out << "source_coord: " << pn.source_phantom.location << "\n";
|
||||
out << "target_coord: " << pn.target_phantom.location << std::endl;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user