1 |
/************************************************************************************************* |
2 |
* Java interface of Hyper Estraier |
3 |
* Copyright (C) 2004-2005 Mikio Hirabayashi |
4 |
* All rights reserved. |
5 |
* This file is part of Hyper Estraier. |
6 |
* Redistribution and use in source and binary forms, with or without modification, are |
7 |
* permitted provided that the following conditions are met: |
8 |
* |
9 |
* * Redistributions of source code must retain the above copyright notice, this list of |
10 |
* conditions and the following disclaimer. |
11 |
* * Redistributions in binary form must reproduce the above copyright notice, this list of |
12 |
* conditions and the following disclaimer in the documentation and/or other materials |
13 |
* provided with the distribution. |
14 |
* * Neither the name of Mikio Hirabayashi nor the names of its contributors may be used to |
15 |
* endorse or promote products derived from this software without specific prior written |
16 |
* permission. |
17 |
* |
18 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
19 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
20 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
21 |
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
22 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
23 |
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
25 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
26 |
* OF THE POSSIBILITY OF SUCH DAMAGE. |
27 |
*************************************************************************************************/ |
28 |
|
29 |
|
30 |
package estraier; |
31 |
|
32 |
import java.util.*; |
33 |
import java.io.*; |
34 |
import java.net.*; |
35 |
|
36 |
|
37 |
|
38 |
/** |
39 |
* Implementation of search condition. |
40 |
*/ |
41 |
class ConditionImpl implements Condition { |
42 |
//---------------------------------------------------------------- |
43 |
// private fields |
44 |
//---------------------------------------------------------------- |
45 |
private String phrase; |
46 |
private List attrs; |
47 |
private String order; |
48 |
private int max; |
49 |
private int options; |
50 |
//---------------------------------------------------------------- |
51 |
// public methods |
52 |
//---------------------------------------------------------------- |
53 |
/** |
54 |
* Create a search condition object. |
55 |
*/ |
56 |
public ConditionImpl(){ |
57 |
phrase = null; |
58 |
attrs = new ArrayList(31); |
59 |
max = -1; |
60 |
options = 0; |
61 |
} |
62 |
/* |
63 |
* Implementation of Condition. |
64 |
*/ |
65 |
public void set_phrase(String phrase){ |
66 |
this.phrase = phrase; |
67 |
} |
68 |
/* |
69 |
* Implementation of Condition. |
70 |
*/ |
71 |
public void add_attr(String expr){ |
72 |
attrs.add(expr); |
73 |
} |
74 |
/* |
75 |
* Implementation of Condition. |
76 |
*/ |
77 |
public void set_order(String expr){ |
78 |
this.order = order; |
79 |
} |
80 |
/* |
81 |
* Implementation of Condition. |
82 |
*/ |
83 |
public void set_max(int max){ |
84 |
this.max = max; |
85 |
} |
86 |
/* |
87 |
* Implementation of Condition. |
88 |
*/ |
89 |
public void set_options(int options){ |
90 |
this.options |= options; |
91 |
} |
92 |
/* |
93 |
* Implementation of Condition. |
94 |
*/ |
95 |
public String phrase(){ |
96 |
if(phrase == null) return ""; |
97 |
return phrase; |
98 |
} |
99 |
/* |
100 |
* Implementation of Condition. |
101 |
*/ |
102 |
public List attrs(){ |
103 |
return attrs; |
104 |
} |
105 |
/* |
106 |
* Implementation of Condition. |
107 |
*/ |
108 |
public String order(){ |
109 |
if(order == null) return ""; |
110 |
return order; |
111 |
} |
112 |
/* |
113 |
* Implementation of Condition. |
114 |
*/ |
115 |
public int max(){ |
116 |
return max; |
117 |
} |
118 |
/* |
119 |
* Implementation of Condition. |
120 |
*/ |
121 |
public int options(){ |
122 |
return options; |
123 |
} |
124 |
}; |
125 |
|
126 |
|
127 |
|
128 |
/* END OF FILE */ |