| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Adam Barth. All rights reserved. | 2 * Copyright (C) 2010 Adam Barth. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef SuffixTree_h | 26 #ifndef SuffixTree_h |
| 27 #define SuffixTree_h | 27 #define SuffixTree_h |
| 28 | 28 |
| 29 #include "wtf/Vector.h" | 29 #include "wtf/Vector.h" |
| 30 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace blink { |
| 33 | 33 |
| 34 class UnicodeCodebook { | 34 class UnicodeCodebook { |
| 35 public: | 35 public: |
| 36 static int codeWord(UChar c) { return c; } | 36 static int codeWord(UChar c) { return c; } |
| 37 enum { codeSize = 1 << 8 * sizeof(UChar) }; | 37 enum { codeSize = 1 << 8 * sizeof(UChar) }; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 class ASCIICodebook { | 40 class ASCIICodebook { |
| 41 public: | 41 public: |
| 42 static int codeWord(UChar c) { return c & (codeSize - 1); } | 42 static int codeWord(UChar c) { return c & (codeSize - 1); } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 Node m_root; | 111 Node m_root; |
| 112 unsigned m_depth; | 112 unsigned m_depth; |
| 113 | 113 |
| 114 // Instead of allocating a fresh empty leaf node for ever leaf in the tree | 114 // Instead of allocating a fresh empty leaf node for ever leaf in the tree |
| 115 // (there can be a lot of these), we alias all the leaves to this "static" | 115 // (there can be a lot of these), we alias all the leaves to this "static" |
| 116 // leaf node. | 116 // leaf node. |
| 117 Node m_leaf; | 117 Node m_leaf; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace WebCore | 120 } // namespace blink |
| 121 | 121 |
| 122 #endif // SuffixTree_h | 122 #endif // SuffixTree_h |
| OLD | NEW |