| 1 |
/* treeTraverser.h |
| 2 |
*/ |
| 3 |
#ifndef _CHECK_TREETRAVERSER_H |
| 4 |
#define _CHECK_TREETRAVERSER_H |
| 5 |
|
| 6 |
#include "analyzer/treeWriter.h" |
| 7 |
#include "analyzer/recordSet.h" |
| 8 |
#include "checkStack.h" |
| 9 |
namespace osl |
| 10 |
{ |
| 11 |
class PathEncoding; |
| 12 |
namespace hash |
| 13 |
{ |
| 14 |
class HashKey; |
| 15 |
} |
| 16 |
namespace checkmate |
| 17 |
{ |
| 18 |
class CheckHashRecord; |
| 19 |
class CheckMoveList; |
| 20 |
class TwinList; |
| 21 |
struct CorruptCheckTable; |
| 22 |
namespace analyzer |
| 23 |
{ |
| 24 |
class TreeWriter; |
| 25 |
class TreeTraverser |
| 26 |
{ |
| 27 |
protected: |
| 28 |
TreeWriter& writer; |
| 29 |
RecordSet visited; |
| 30 |
CheckStack analyzerStack; |
| 31 |
RecordSet leaves; |
| 32 |
const TwinTable& table; |
| 33 |
/** |
| 34 |
* @see CheckTableAnalyzer::proofTreeSize |
| 35 |
*/ |
| 36 |
public: |
| 37 |
TreeTraverser(TreeWriter&, const TwinTable&); |
| 38 |
|
| 39 |
const RecordSet& getVisited() const { return visited; } |
| 40 |
const RecordSet& getLeaveSet() const { return leaves; } |
| 41 |
unsigned int getLeaves() const { return leaves.size(); } |
| 42 |
|
| 43 |
void traverseOrNode(Move last_move, const CheckHashRecord *record, |
| 44 |
const HashKey& key, const PathEncoding& path); |
| 45 |
void traverseAndNode(Move, const CheckHashRecord *record, |
| 46 |
const HashKey& key, const PathEncoding& path); |
| 47 |
|
| 48 |
bool findLoopToStackByTwins(const TwinList& l) const; |
| 49 |
bool findLoopToStackByStack(const TwinList& l) const; |
| 50 |
bool findLoopToStack(const TwinList& l) const; |
| 51 |
protected: |
| 52 |
virtual ~TreeTraverser(); |
| 53 |
virtual void orNode(Move m, const CheckHashRecord *record, const HashKey& key, |
| 54 |
const PathEncoding& path)=0; |
| 55 |
virtual void andNode(Move, const CheckHashRecord *record, const HashKey& key, |
| 56 |
const PathEncoding& path)=0; |
| 57 |
}; |
| 58 |
} // namespace analyzer |
| 59 |
} // namespace checkmate |
| 60 |
} // namespace osl |
| 61 |
|
| 62 |
|
| 63 |
#endif /* _CHECK_TREETRAVERSER_H */ |
| 64 |
// ;;; Local Variables: |
| 65 |
// ;;; mode:c++ |
| 66 |
// ;;; c-basic-offset:2 |
| 67 |
// ;;; End: |