findMinWidth, findMaxWidth: width for a given top

Currently only implemented for Castle suffixes.
This commit is contained in:
Justin Viiret
2015-12-02 10:24:54 +11:00
committed by Matthew Barr
parent 03953f34b1
commit 8dac64d1dc
5 changed files with 53 additions and 5 deletions

View File

@@ -907,6 +907,18 @@ depth findMinWidth(const suffix_id &s) {
}
}
depth findMinWidth(const suffix_id &s, u32 top) {
assert(s.graph() || s.castle() || s.haig() || s.dfa());
// TODO: take top into account for non-castle suffixes.
if (s.graph()) {
return findMinWidth(*s.graph());
} else if (s.castle()) {
return findMinWidth(*s.castle(), top);
} else {
return s.dfa_min_width;
}
}
depth findMaxWidth(const suffix_id &s) {
assert(s.graph() || s.castle() || s.haig() || s.dfa());
if (s.graph()) {
@@ -918,6 +930,18 @@ depth findMaxWidth(const suffix_id &s) {
}
}
depth findMaxWidth(const suffix_id &s, u32 top) {
assert(s.graph() || s.castle() || s.haig() || s.dfa());
// TODO: take top into account for non-castle suffixes.
if (s.graph()) {
return findMaxWidth(*s.graph());
} else if (s.castle()) {
return findMaxWidth(*s.castle(), top);
} else {
return s.dfa_max_width;
}
}
bool has_eod_accepts(const suffix_id &s) {
assert(s.graph() || s.castle() || s.haig() || s.dfa());
if (s.graph()) {