diff --git a/src/graph/edge.cc b/src/graph/edge.cc index f0fad668f20c12b5108d248fb9f789418349d8e7..ee6453a33932ff7eca1b85ad8f41bc96546c4930 100644 --- a/src/graph/edge.cc +++ b/src/graph/edge.cc @@ -69,20 +69,6 @@ namespace hpp { const bool dst_contains_q0 = to ()->contains (q0); const bool src_contains_q1 = from()->contains (q1); const bool dst_contains_q1 = to ()->contains (q1); - if (!( - (src_contains_q0 && dst_contains_q1) - || (src_contains_q1 && dst_contains_q0) - )) { - if (src_contains_q0) { - assert (state ()->contains (q1)); - return false; - } else if (src_contains_q1) { - assert (state ()->contains (q0)); - return true; - } - throw std::runtime_error ("This path does not seem to have been " - "generated by this edge."); - } // Karnaugh table: // 1 = forward, 0 = reverse, ? = I don't know, * = 0 or 1 // s0s1 \ d0d1 | 00 | 01 | 11 | 10 @@ -92,6 +78,11 @@ namespace hpp { // 10 | ? | 1 | 1 | 1 // /// true if reverse + if ( (!src_contains_q0 && !src_contains_q1) + || (!dst_contains_q0 && !dst_contains_q1) + || (!src_contains_q0 && !dst_contains_q0)) + throw std::runtime_error ("This path does not seem to have been " + "generated by this edge."); return !(src_contains_q0 && (!src_contains_q1 || dst_contains_q1)); } @@ -103,23 +94,14 @@ namespace hpp { const bool dst_contains_q0 = to ()->contains (q0); const bool src_contains_q1 = waypoints_.back().second->contains (q1); const bool dst_contains_q1 = to ()->contains (q1); - if (!( - (src_contains_q0 && dst_contains_q1) - || (src_contains_q1 && dst_contains_q0) - )) { - if (src_contains_q0) { - assert (state ()->contains (q1)); - return false; - } else if (src_contains_q1) { - assert (state ()->contains (q0)); - return true; - } - throw std::runtime_error ("This path does not seem to have been " - "generated by this edge."); - } /// See Edge::direction for Karnaugh table /// true if reverse + if ( (!src_contains_q0 && !src_contains_q1) + || (!dst_contains_q0 && !dst_contains_q1) + || (!src_contains_q0 && !dst_contains_q0)) + throw std::runtime_error ("This path does not seem to have been " + "generated by this edge."); return !(src_contains_q0 && (!src_contains_q1 || dst_contains_q1)); }