• R/O
  • SSH
  • HTTPS

unf: Commit


Commit MetaInfo

Revision52 (tree)
Time2011-11-19 17:53:26
Authorphjgt

Log Message

DAWG版が全てのテストをパスするようになった

Change Summary

Incremental Difference

--- trunk/src/unf/trie/node.hh (revision 51)
+++ trunk/src/unf/trie/node.hh (revision 52)
@@ -24,7 +24,8 @@
2424 private:
2525 unsigned base() const { return data & 0xFFFFFF; }
2626
27- private:
27+ //XXX: private:
28+ public:
2829 // TODO: bit-fieldを使ってみる
2930 unsigned data;
3031 };
--- trunk/src/unf/trie/searcher.hh (revision 51)
+++ trunk/src/unf/trie/searcher.hh (revision 52)
@@ -13,6 +13,7 @@
1313 : nodes(nodes), root(root), value(value) {}
1414
1515 unsigned find_value(const char* key, int default_value) const {
16+ //std::cout << "# " << key << std::endl;
1617 unsigned node_index=root;
1718 for(CharStream in(key);; in.read()) {
1819 node_index = nodes[node_index].jump(in.peek());
@@ -19,6 +20,7 @@
1920 if(nodes[node_index].check_char()==in.peek()) {
2021 unsigned terminal_index = nodes[node_index].jump('\0');
2122 if(nodes[terminal_index].check_char()=='\0') {
23+ //std::cout << " => " << nodes[terminal_index].value() << std::endl;
2224 return nodes[terminal_index].value();
2325 }
2426 } else
@@ -153,8 +155,8 @@
153155 }
154156
155157 retry:
156- unsigned next_index = nodes[node_index].jump(in.read());
157- if(nodes[next_index].check_char()==in.prev()) {
158+ unsigned next_index = nodes[node_index].jump(in.peek());
159+ if(nodes[next_index].check_char()==in.read()) {
158160 // succeeded
159161 node_index = next_index;
160162 unsigned terminal_index = nodes[node_index].jump('\0');
Show on old repository browser