From ecd64456ae06d52250c818981948fdd0e884f9aa Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 25 May 2014 09:26:32 -0400 Subject: [PATCH] A3 - Removed obsolete ::sequence method. --- src/A3.cpp | 88 ------------------------------------------------------ src/A3.h | 1 - 2 files changed, 89 deletions(-) diff --git a/src/A3.cpp b/src/A3.cpp index 97aca0a57..71d239670 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -759,94 +759,6 @@ const A3 A3::tokenize (const A3& input) const return output; } -//////////////////////////////////////////////////////////////////////////////// -// Convert: 1-3,5 7 92bea814-2e3f-487b-92a1-3286dd1a7eda -// To: (id=1 or id=2 or id=3 or id=5 or id=7 or -// uuid=92bea814-2e3f-487b-92a1-3286dd1a7eda) -const A3 A3::sequence (const A3& input) const -{ - A3 sequenced; - - // Extract all the components of a sequence. - std::vector ids; - std::vector uuids; - std::vector ::const_iterator arg; - for (arg = input.begin (); arg != input.end (); ++arg) - { - if (arg->_category == Arg::cat_id) - extract_id (arg->_raw, ids); - - else if (arg->_category == Arg::cat_uuid) - extract_uuid (arg->_raw, uuids); - } - - // If there is no sequence, we're done. - if (ids.size () == 0 && uuids.size () == 0) - return input; - - if (ids.size () == 1 && ids[0] < 1) - throw format (STRING_A3_ZERO_ID, ids[0]); - - // Copy everything up to the first id/uuid. - for (arg = input.begin (); arg != input.end (); ++arg) - { - if (arg->_category == Arg::cat_id || arg->_category == Arg::cat_uuid) - break; - - sequenced.push_back (*arg); - } - - // Insert the algebraic form. - sequenced.push_back (Arg ("(", Arg::cat_op)); - - for (unsigned int i = 0; i < ids.size (); ++i) - { - if (i) - sequenced.push_back (Arg ("or", Arg::cat_op)); - - sequenced.push_back (Arg ("id", Arg::type_number, Arg::cat_dom)); - sequenced.push_back (Arg ("=", Arg::cat_op)); - sequenced.push_back (Arg (format(ids[i]), Arg::type_number, Arg::cat_literal)); - } - - for (unsigned int i = 0; i < uuids.size (); ++i) - { - if (ids.size () + i > 0) - sequenced.push_back (Arg ("or", Arg::cat_op)); - - // A full-length UUID requires a string comparison. - if (uuids[i].length () == 36) - { - sequenced.push_back (Arg ("uuid", Arg::type_string, Arg::cat_dom)); - sequenced.push_back (Arg ("=", Arg::cat_op)); - sequenced.push_back (Arg (uuids[i], Arg::type_string, Arg::cat_literal)); - } - // A UUID fragment is a leftmost comparison. - else - { - sequenced.push_back (Arg ("uuid", Arg::type_string, Arg::cat_dom)); - sequenced.push_back (Arg ("~", Arg::cat_op)); - sequenced.push_back (Arg ("^" + uuids[i], Arg::type_string, Arg::cat_rx)); - } - } - - sequenced.push_back (Arg (")", Arg::cat_op)); - - // Now copy everything after the last id/uuid. - bool found_id = false; - for (arg = input.begin (); arg != input.end (); ++arg) - { - if (arg->_category == Arg::cat_id || arg->_category == Arg::cat_uuid) - found_id = true; - - else if (found_id) - sequenced.push_back (*arg); - } - - sequenced.dump ("A3::sequence"); - return sequenced; -} - //////////////////////////////////////////////////////////////////////////////// // Dijkstra Shunting Algorithm. // http://en.wikipedia.org/wiki/Shunting-yard_algorithm diff --git a/src/A3.h b/src/A3.h index 03c1633af..231dd036e 100644 --- a/src/A3.h +++ b/src/A3.h @@ -62,7 +62,6 @@ public: const A3 extract_modifications () const; const A3 tokenize (const A3&) const; - const A3 sequence (const A3&) const; const A3 postfix (const A3&) const; static bool is_attr (Nibbler&, Arg&);