~ubuntu-branches/ubuntu/trusty/hyperestraier/trusty-proposed

« back to all changes in this revision

Viewing changes to javapure/Condition.java

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2006-11-14 05:28:32 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061114052832-0lzqzcefn8mt4yqe
Tags: 1.4.9-1.1
* Non-maintainer upload.
* High-urgency upload for RC bugfix.
* Set HOME=$(CURDIR)/junkhome when building, otherwise the package build
  will incorrectly look for headers there -- and fail when the directory
  exists and is unreadable, as happens sometimes on sudo-using
  autobuilders!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*************************************************************************************************
2
2
 * Pure Java interface of Hyper Estraier
3
 
 *                                                      Copyright (C) 2004-2005 Mikio Hirabayashi
 
3
 *                                                      Copyright (C) 2004-2006 Mikio Hirabayashi
4
4
 *                                                                           All rights reserved.
5
5
 * This file is part of Hyper Estraier.
6
6
 * Redistribution and use in source and binary forms, with or without modification, are
43
43
  // public constants
44
44
  //----------------------------------------------------------------
45
45
  /** option: check every N-gram key */
46
 
  public static int SURE = 1 << 0;
 
46
  public static final int SURE = 1 << 0;
47
47
  /** option: check N-gram keys skipping by one */
48
 
  public static int USUAL = 1 << 1;
 
48
  public static final int USUAL = 1 << 1;
49
49
  /** option: check N-gram keys skipping by two */
50
 
  public static int FAST = 1 << 2;
 
50
  public static final int FAST = 1 << 2;
51
51
  /** option: check N-gram keys skipping by three */
52
 
  public static int AGITO = 1 << 3;
 
52
  public static final int AGITO = 1 << 3;
53
53
  /** option: without TF-IDF tuning */
54
 
  public static int NOIDF = 1 << 4;
 
54
  public static final int NOIDF = 1 << 4;
55
55
  /** option: with the simplified phrase */
56
 
  public static int SIMPLE = 1 << 10;
57
 
  /** option: attach keywords */
58
 
  public static int ETCH = 1 << 20;
 
56
  public static final int SIMPLE = 1 << 10;
 
57
  /** option: with the rough phrase */
 
58
  public static final int ROUGH = 1 << 11;
 
59
  /** option: with the union phrase */
 
60
  public static final int UNION = 1 << 15;
 
61
  /** option: with the intersection phrase */
 
62
  public static final int ISECT = 1 << 16;
59
63
  //----------------------------------------------------------------
60
64
  // private fields
61
65
  //----------------------------------------------------------------
63
67
  private List attrs;
64
68
  private String order;
65
69
  private int max;
 
70
  private int skip;
66
71
  private int options;
 
72
  private int auxiliary;
 
73
  private String distinct;
 
74
  private int mask;
67
75
  //----------------------------------------------------------------
68
76
  // constructors
69
77
  //----------------------------------------------------------------
73
81
  public Condition(){
74
82
    phrase = null;
75
83
    attrs = new ArrayList(31);
 
84
    order = null;
76
85
    max = -1;
 
86
    skip = 0;
77
87
    options = 0;
 
88
    auxiliary = 32;
 
89
    distinct = null;
 
90
    mask = 0;
78
91
  }
79
92
  //----------------------------------------------------------------
80
93
  // public methods
98
111
   * @param expr an expression for the order.  By default, the order is by score descending.
99
112
   */
100
113
  public void set_order(String expr){
101
 
    this.order = order;
 
114
    order = expr;
102
115
  }
103
116
  /**
104
117
   * Set the maximum number of retrieval.
106
119
   * limited.
107
120
   */
108
121
  public void set_max(int max){
109
 
    this.max = max;
 
122
    if(max >= 0) this.max = max;
 
123
  }
 
124
  /**
 
125
   * Set the number of skipped documents.
 
126
   * @param skip the number of documents to be skipped in the search result.
 
127
   */
 
128
  public void set_skip(int skip){
 
129
    if(skip >= 0) this.skip = skip;
110
130
  }
111
131
  /**
112
132
   * Set options of retrieval.
114
134
   * `Condition.USUAL', which is the default, specifies that it checks N-gram keys with skipping
115
135
   * one key, `Condition.FAST' skips two keys, `Condition.AGITO' skips three keys,
116
136
   * `Condition.NOIDF' specifies not to perform TF-IDF tuning, `Condition.SIMPLE' specifies to
117
 
   * use simplified phrase.  `Condition.ETCH' specifies to attach the keyword vector.  Each
 
137
   * use simplified phrase, `Condition.ROUGH' specifies to use rough phrase, `Condition.UNION'
 
138
   * specifies to use union phrase, `Condition.ISECT' specifies to use intersection phrase.  Each
118
139
   * option can be specified at the same time by bitwise or.  If keys are skipped, though search
119
140
   * speed is improved, the relevance ratio grows less.
120
141
   */
121
142
  public void set_options(int options){
122
143
    this.options |= options;
123
144
  }
 
145
  /**
 
146
   * Set permission to adopt result of the auxiliary index.
 
147
   * @param min the minimum hits to adopt result of the auxiliary index.  If it is not more
 
148
   * than 0, the auxiliary index is not used.  By default, it is 32.
 
149
   */
 
150
  public void set_auxiliary(int min){
 
151
    this.auxiliary = min;
 
152
  }
 
153
  /**
 
154
   * Set the attribute distinction filter.
 
155
   * @param name the name of an attribute to be distinct.
 
156
   */
 
157
  public void set_distinct(String name){
 
158
    distinct = name;
 
159
  }
 
160
  /**
 
161
   * Set the mask of targets of meta search.
 
162
   * @param mask a masking number.  1 means the first target, 2 means the second target, 4 means
 
163
   * the third target and, power values of 2 and their summation compose the mask.
 
164
   */
 
165
  public void set_mask(int mask){
 
166
    this.mask = mask & 0x7fffffff;
 
167
  }
124
168
  //----------------------------------------------------------------
125
169
  // package methods
126
170
  //----------------------------------------------------------------
155
199
    return max;
156
200
  }
157
201
  /**
 
202
   * Get the number of skipped documents.
 
203
   * @return the number of documents to be skipped in the search result.
 
204
   */
 
205
  int skip(){
 
206
    return skip;
 
207
  }
 
208
  /**
158
209
   * Get options of retrieval.
159
210
   * @return options by bitwise or.
160
211
   */
161
212
  int options(){
162
213
    return options;
163
214
  }
 
215
  /**
 
216
   * Get permission to adopt result of the auxiliary index.
 
217
   * @return permission to adopt result of the auxiliary index.
 
218
   */
 
219
  int auxiliary(){
 
220
    return auxiliary;
 
221
  }
 
222
  /**
 
223
   * Get the attribute distinction filter.
 
224
   * @return the name of the distinct attribute.
 
225
   */
 
226
  String distinct(){
 
227
    if(distinct == null) return "";
 
228
    return distinct;
 
229
  }
 
230
  /**
 
231
   * Get the mask of targets of meta search.
 
232
   * @return the mask of targets of meta search.
 
233
   */
 
234
  int mask(){
 
235
    return mask;
 
236
  }
164
237
}
165
238
 
166
239