[Debtags-commits] [svn] r1726 - in tagcoll/2.0: . tagcoll
Enrico Zini
enrico at costa.debian.org
Tue May 9 00:21:22 UTC 2006
Author: enrico
Date: Tue May 9 00:21:21 2006
New Revision: 1726
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/DerivedTags.cc
tagcoll/2.0/tagcoll/Expression.cc
tagcoll/2.0/tagcoll/Implications.cc
tagcoll/2.0/tagcoll/Implications.h
tagcoll/2.0/tagcoll/Makefile.am
Log:
r2613 at viaza: enrico | 2006-05-07 18:41:40 -0500
Disabled building of not-yet-refactored parts
Fixes to all the various filter parts
Modified: tagcoll/2.0/tagcoll/DerivedTags.cc
==============================================================================
--- tagcoll/2.0/tagcoll/DerivedTags.cc (original)
+++ tagcoll/2.0/tagcoll/DerivedTags.cc Tue May 9 00:21:21 2006
@@ -70,10 +70,10 @@
derivations.add("cappuccino", Expression("coffee && milk && !sugar"));
derivations.add("sweet_cappuccino", Expression("coffee && milk && sugar"));
- parseCollection(input_coll, addDerived(derivations, consumer(result)));
+ parseCollection(input_coll, addDerived(derivations, inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
@@ -99,10 +99,10 @@
derivations.add("cappuccino", Expression("coffee && milk && !sugar"));
derivations.add("sweet_cappuccino", Expression("coffee && milk && sugar"));
- parseCollection(input_coll, removeDerived(derivations, consumer(result)));
+ parseCollection(input_coll, removeDerived(derivations, inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
Modified: tagcoll/2.0/tagcoll/Expression.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Expression.cc (original)
+++ tagcoll/2.0/tagcoll/Expression.cc Tue May 9 00:21:21 2006
@@ -271,10 +271,10 @@
);
InputMerger<string, string> result;
parseCollection(input_coll, filterItemsByExpression(
- "(*::D && e::F) || c", consumer(result)));
+ "(*::D && e::F) || c", inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
@@ -295,10 +295,10 @@
);
InputMerger<string, string> result;
parseCollection(input_coll, filterTagsByExpression(
- "*::D || e::F || c", ExpressionFilter::PLAIN, consumer(result)));
+ "*::D || e::F || c", ExpressionFilter::PLAIN, inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
Modified: tagcoll/2.0/tagcoll/Implications.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Implications.cc (original)
+++ tagcoll/2.0/tagcoll/Implications.cc Tue May 9 00:21:21 2006
@@ -31,8 +31,8 @@
template<class TAG>
std::set<TAG> Implications<TAG>::getDestinations(const TAG& tag, const std::set<TAG>& seen) const
{
- typename impl_t::const_iterator i = implications.find(tag);
- if (i == implications.end())
+ typename Implications<TAG>::const_iterator i = this->coll.find(tag);
+ if (i == this->coll.end())
return std::set<TAG>();
// res <- the union of all the destinations of the tag
@@ -60,8 +60,8 @@
return true;
// No: see if we have other paths to follow
- typename impl_t::const_iterator i = implications.find(tag1);
- if (i == implications.end())
+ typename Implications<TAG>::const_iterator i = this->coll.find(tag1);
+ if (i == this->coll.end())
return false;
// Try all paths
@@ -79,8 +79,8 @@
void Implications<TAG>::pack()
{
// For every tag
- for (typename impl_t::iterator i = implications.begin();
- i != implications.end(); i++)
+ for (typename Implications<TAG>::iterator i = this->coll.begin();
+ i != this->coll.end(); i++)
{
std::set<TAG> redundant;
@@ -155,11 +155,11 @@
InputMerger<string, string> result;
Implications<string> implications;
- parseCollection(input_impl, consumer(implications));
- parseCollection(input_coll, addImplied(implications, consumer(result)));
+ parseCollection(input_impl, inserter(implications));
+ parseCollection(input_coll, addImplied(implications, inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
@@ -187,11 +187,11 @@
InputMerger<string, string> result;
Implications<string> implications;
- parseCollection(input_impl, consumer(implications));
- parseCollection(input_coll, removeImplied(implications, consumer(result)));
+ parseCollection(input_impl, inserter(implications));
+ parseCollection(input_coll, removeImplied(implications, inserter(result)));
InputMerger<string, string> reference;
- parseCollection(output_coll, consumer(reference));
+ parseCollection(output_coll, inserter(reference));
ensure_coll_equals(reference, result);
}
Modified: tagcoll/2.0/tagcoll/Implications.h
==============================================================================
--- tagcoll/2.0/tagcoll/Implications.h (original)
+++ tagcoll/2.0/tagcoll/Implications.h Tue May 9 00:21:21 2006
@@ -23,10 +23,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <tagcoll/Consumer.h>
-
#include <wibble/operators.h>
#include <wibble/mixin.h>
+#include <tagcoll/InputMerger.h>
#include <map>
namespace tagcoll
@@ -36,31 +35,16 @@
* List of explicit implications that can be applied to a tagged collection.
*/
template <class TAG>
-class Implications : public Consumer<TAG, TAG>
+class Implications : public InputMerger<TAG, TAG>
{
protected:
- // DAG of arcs: child -> {parents}
- typedef std::map< TAG, std::set<TAG> > impl_t;
- impl_t implications;
-
/// Get the set of all tags seen when walking through all parent lists
std::set<TAG> getDestinations(const TAG& tag, const std::set<TAG>& seen = std::set<TAG>()) const;
/// Return true if tag1 can reach tag2 walking through some path in its parent list
bool reaches(const TAG& tag1, const TAG& tag2, const std::set<TAG>& seen = std::set<TAG>()) const;
- virtual void consumeItemUntagged(const TAG& item) {}
-
- virtual void consumeItem(const TAG& item, const std::set<TAG>& tags)
- {
- implications.insert(make_pair(item, tags));
- }
-
public:
- virtual ~Implications() {}
-
- bool empty() const { return implications.empty(); }
-
/// Expand a single tag
std::set<TAG> expand(const TAG& tag) const
{
@@ -110,7 +94,8 @@
// Remove unnecessary arcs from the dag
void pack();
-
+
+#if 0
// Output the fully expanded implication dag to a TagcollConsumer
void outputFull(Consumer<TAG, TAG>& consumer) const
{
@@ -136,6 +121,7 @@
else
consumer.consume(i->first, i->second);
}
+#endif
};
/**
Modified: tagcoll/2.0/tagcoll/Makefile.am
==============================================================================
--- tagcoll/2.0/tagcoll/Makefile.am (original)
+++ tagcoll/2.0/tagcoll/Makefile.am Tue May 9 00:21:21 2006
@@ -70,23 +70,24 @@
\
TDBIndexer.cc \
\
- MMapIndex.cc \
- IntIndex.cc \
- StringIndex.cc \
- IntDiskIndex.cc \
- BasicStringDiskIndex.cc \
- \
Implications.cc \
\
Expression.cc \
DerivedTags.cc \
\
- CardinalityStore.cc \
- SmartHierarchy.cc \
- \
- experiments.cc \
- \
test-utils.cc
+
+# MMapIndex.cc \
+# IntIndex.cc \
+# StringIndex.cc \
+# IntDiskIndex.cc \
+# BasicStringDiskIndex.cc \
+# \
+# CardinalityStore.cc \
+# SmartHierarchy.cc \
+# \
+# experiments.cc
+
libtagcoll_la_LIBADD = tagexpr/libtagexpr.la
libtagcoll_la_LDFLAGS = $(LIBWIBBLE_LIBS) -version-info @LIBTAGCOLL_VERSION_INFO@
More information about the Debtags-commits
mailing list