KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnet > Search > SearchPattern


1 /*
2  * SearchPattern.java
3  *
4  * Created on 28. duben 2004, 15:42
5  */

6
7 package SOFA.SOFAnet.Search;
8
9 import java.io.Serializable JavaDoc;
10
11 /**
12  * Describes real search request - what is looked for.
13  * <p>
14  * Meaning of parameters:
15  * <ul>
16  * <li> pattern:
17  * <ul>
18  * <li> false: "str" contains exact bundle(or component) name
19  * <li> true: "str" contains pattern of bundle(or component) name
20  * </ul>
21  * <li> component:
22  * <ul>
23  * <li> false: look only for bundles, not their components
24  * <li> true: look also for components in bundles ("str" must contain name/pattern of a single component)
25  * </ul>
26  * <li> completeComponent (only if component == true):
27  * <ul>
28  * <li> CC_TRY: try to find complete component, but it needn't be
29  * <li> CC_NO: look only for single components
30  * <li> CC_ONLY: found bundle must surely contain complete component
31  * </ul>
32  * </ul>
33  *
34  * @author Ladislav Sobr
35  */

36 public class SearchPattern implements Serializable JavaDoc
37 {
38   final static public int CC_TRY = 0;
39   final static public int CC_NO = 1;
40   final static public int CC_ONLY = 2;
41   
42   private boolean pattern;
43   private boolean component;
44   private int completeComponent;
45   
46   private String JavaDoc str;
47   
48   /** Creates a new instance of SearchPattern */
49   public SearchPattern()
50   {
51     pattern = false;
52     component = false;
53     completeComponent = CC_TRY;
54   }
55   
56   public boolean isPattern()
57   {
58     return pattern;
59   }
60   
61   public boolean isComponent()
62   {
63     return component;
64   }
65   
66   public int getCompleteComponent()
67   {
68     return completeComponent;
69   }
70   
71   public String JavaDoc getStr()
72   {
73     return str;
74   }
75   
76   public void setPattern(boolean pattern)
77   {
78     this.pattern = pattern;
79   }
80   
81   public void setComponent(boolean component)
82   {
83     this.component = component;
84   }
85   
86   public void setCompleteComponent(int completeComponent)
87   {
88     if (completeComponent != CC_NO && completeComponent != CC_ONLY) completeComponent = CC_TRY;
89     this.completeComponent = completeComponent;
90   }
91   
92   public void setStr(String JavaDoc str)
93   {
94     this.str = str;
95   }
96 }
97
Popular Tags