summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2007-02-08 07:48:08 +0000
committerpp <pp@455248ca-bdda-0310-9134-f4ebb693071a>2007-02-08 07:48:08 +0000
commit1c92fb22b404f1bbed9852d5b64fec98a85b515d (patch)
tree9fb46d42385ffe7dfe68c8579cc6c681d717e6ab
parentda078e85e32c1da7bddcbe02cd4c5e36ae2701be (diff)
- ChainFinder.walk marked as private
git-svn-id: https://siedziba.pl:790/svn/repos/dbxrecover@273 455248ca-bdda-0310-9134-f4ebb693071a
-rw-r--r--dbxrecover.d71
1 files changed, 35 insertions, 36 deletions
diff --git a/dbxrecover.d b/dbxrecover.d
index 3801f5a..2a3292e 100644
--- a/dbxrecover.d
+++ b/dbxrecover.d
@@ -52,6 +52,41 @@ class ChainFinder
ChunkInfo[][uint] infos;
bool[uint] first;
+ int walk(uint id, int delegate(inout Message) dg)
+ {
+ auto m = new Message(s);
+ return walk(id, &infos[id], dg, m, 1);
+ }
+
+ int walk(uint id, ChunkInfo[]* infosp, int delegate(inout Message) dg, Message m, uint combinations)
+ {
+ if (combinations > 16)
+ {
+ chainstats.dropped++;
+ return 0;
+ }
+ foreach(ChunkInfo info; *infosp)
+ {
+ m.push(id, info);
+ bool seen = m.seen(info.next);
+ ChunkInfo[]* nextp = info.next in infos;
+ if (nextp && (!seen))
+ {
+ walk(info.next, nextp, dg, m, combinations * nextp.length);
+ }
+ else
+ {
+ if (seen) chainstats.loops++;
+ if (m.broken()) chainstats.broken++;
+ chainstats.count++;
+ int result = dg(m);
+ if (result) return result;
+ }
+ m.pop(id);
+ }
+ return 0;
+ }
+
public:
struct ChunkStatistics
{
@@ -119,42 +154,6 @@ class ChainFinder
}
return 0;
}
-
- int walk(uint id, int delegate(inout Message) dg)
- {
- auto m = new Message(s);
- return walk(id, &infos[id], dg, m, 1);
- }
-
- int walk(uint id, ChunkInfo[]* infosp, int delegate(inout Message) dg, Message m, uint combinations)
- {
- if (combinations > 16)
- {
- chainstats.dropped++;
- return 0;
- }
- foreach(ChunkInfo info; *infosp)
- {
- m.push(id, info);
- bool seen = m.seen(info.next);
- ChunkInfo[]* nextp = info.next in infos;
- if (nextp && (!seen))
- {
- walk(info.next, nextp, dg, m, combinations * nextp.length);
- }
- else
- {
- if (seen) chainstats.loops++;
- if (m.broken()) chainstats.broken++;
- chainstats.count++;
- int result = dg(m);
- if (result) return result;
- }
- m.pop(id);
- }
- return 0;
- }
-
};
class Message