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