01: package test.it.unimi.dsi.mg4j.query.nodes;
02:
03: import it.unimi.dsi.mg4j.query.nodes.AbstractTermExpander;
04: import it.unimi.dsi.mg4j.query.nodes.MultiTerm;
05: import it.unimi.dsi.mg4j.query.nodes.Prefix;
06: import it.unimi.dsi.mg4j.query.nodes.Query;
07: import it.unimi.dsi.mg4j.query.nodes.Term;
08: import it.unimi.dsi.lang.MutableString;
09:
10: public class DoublingTermExpander extends AbstractTermExpander {
11:
12: @Override
13: public Query expand(Term term) {
14: return new MultiTerm(term, new Term(
15: new MutableString(term.term).append(term.term)));
16: }
17:
18: @Override
19: public Query expand(Prefix prefix) {
20: return new MultiTerm(new Term(prefix.prefix), new Term(
21: new MutableString(prefix.prefix).append(prefix.prefix)));
22: }
23: }
|