| Nils Diewald | 5def8bc | 2013-11-28 19:26:54 +0000 | [diff] [blame^] | 1 | package de.ids_mannheim.korap.filter; |
| 2 | import org.apache.lucene.search.Filter; |
| 3 | |
| 4 | public class FilterOperation { |
| 5 | private boolean extension; |
| 6 | public Filter filter; |
| 7 | |
| 8 | public FilterOperation (Filter filter, boolean extension) { |
| 9 | this.extension = extension; |
| 10 | this.filter = filter; |
| 11 | }; |
| 12 | |
| 13 | public boolean isExtension () { |
| 14 | return this.extension; |
| 15 | }; |
| 16 | |
| 17 | public boolean isFilter () { |
| 18 | return !(this.extension); |
| 19 | }; |
| 20 | |
| 21 | @Override |
| 22 | public Object clone () throws CloneNotSupportedException { |
| 23 | return (Object) new FilterOperation(this.filter, this.extension); |
| 24 | }; |
| 25 | |
| 26 | @Override |
| 27 | public String toString () { |
| 28 | StringBuilder sb = new StringBuilder(); |
| 29 | if (this.extension) { |
| 30 | sb.append("extend with "); |
| 31 | } |
| 32 | else { |
| 33 | sb.append("filter with "); |
| 34 | }; |
| 35 | sb.append(this.filter.toString()); |
| 36 | return sb.toString(); |
| 37 | }; |
| 38 | }; |