summaryrefslogtreecommitdiff
path: root/src/util/trans_closure.h
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2011-04-28 23:32:16 +0000
committerAndrew Reynolds <andrew.j.reynolds@gmail.com>2011-04-28 23:32:16 +0000
commit40449557777db2d1170cb86274f83b431b5fef04 (patch)
tree92fbf29e66bcce618cd61d1d88494fc8ed6c3d5b /src/util/trans_closure.h
parentc21ca8353370eb44aa6318e6ee4bffee64197fd8 (diff)
more fixes/improvements to datatypes theory and transitive closure
Diffstat (limited to 'src/util/trans_closure.h')
-rw-r--r--src/util/trans_closure.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/util/trans_closure.h b/src/util/trans_closure.h
index 4d811d0c9..af16d2e13 100644
--- a/src/util/trans_closure.h
+++ b/src/util/trans_closure.h
@@ -23,6 +23,10 @@
#include "expr/node.h"
#include <map>
+#include "context/cdlist.h"
+#include "context/cdmap.h"
+#include "context/cdo.h"
+
namespace CVC4 {
/*
@@ -65,14 +69,14 @@ public:
}
bool read(unsigned index) {
- if (index < 64) return (d_data & (unsigned(1) << index)) != 0;
+ if (index < 64) return (d_data & (uint64_t(1) << index)) != 0;
else if (d_next == NULL) return false;
else return d_next->read(index - 64);
}
void write(unsigned index) {
if (index < 64) {
- unsigned mask = unsigned(1) << index;
+ unsigned mask = uint64_t(1) << index;
if ((d_data & mask) != 0) return;
makeCurrent();
d_data = d_data | mask;
@@ -111,6 +115,8 @@ public:
/* Add an edge from node i to node j. Return false if successful, true if this edge would create a cycle */
bool addEdge(unsigned i, unsigned j);
+ /** whether node i is connected to node j */
+ bool isConnected(unsigned i, unsigned j);
void debugPrintMatrix();
};
@@ -119,17 +125,26 @@ public:
*
*/
class TransitiveClosureNode : public TransitiveClosure{
- static unsigned d_counter;
- std::map< Node, unsigned > nodeMap;
+ context::CDO< unsigned > d_counter;
+ context::CDMap< Node, unsigned, NodeHashFunction > nodeMap;
unsigned getId( Node i );
+ //for debugging
+ context::CDList< std::pair< Node, Node > > currEdges;
public:
- TransitiveClosureNode(context::Context* context) : TransitiveClosure(context) {}
+ TransitiveClosureNode(context::Context* context) :
+ TransitiveClosure(context), d_counter( context, 0 ), nodeMap( context ), currEdges(context) {}
~TransitiveClosureNode(){}
/* Add an edge from node i to node j. Return false if successful, true if this edge would create a cycle */
bool addEdgeNode(Node i, Node j) {
+ currEdges.push_back( std::pair< Node, Node >( i, j ) );
return addEdge( getId( i ), getId( j ) );
}
+ /** whether node i is connected to node j */
+ bool isConnectedNode(Node i, Node j) {
+ return isConnected( getId( i ), getId( j ) );
+ }
+ void debugPrint();
};
}/* CVC4 namespace */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback