KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > flute > parser > selectors > ConditionFactoryImpl


1 /*
2  * Copyright (c) 2000 World Wide Web Consortium,
3  * (Massachusetts Institute of Technology, Institut National de
4  * Recherche en Informatique et en Automatique, Keio University). All
5  * Rights Reserved. This program is distributed under the W3C's Software
6  * Intellectual Property License. This program is distributed in the
7  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  * PURPOSE.
10  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
11  *
12  * $Id: ConditionFactoryImpl.java,v 1.1.1.1 2006/04/23 14:51:55 taqua Exp $
13  */

14 package org.w3c.flute.parser.selectors;
15
16 import org.w3c.css.sac.CSSException;
17 import org.w3c.css.sac.Condition;
18 import org.w3c.css.sac.AttributeCondition;
19 import org.w3c.css.sac.LangCondition;
20 import org.w3c.css.sac.ContentCondition;
21 import org.w3c.css.sac.CombinatorCondition;
22 import org.w3c.css.sac.PositionalCondition;
23 import org.w3c.css.sac.NegativeCondition;
24 import org.w3c.css.sac.ConditionFactory;
25
26 /**
27  * @version $Revision: 1.1.1.1 $
28  * @author Philippe Le Hegaret
29  */

30 public class ConditionFactoryImpl implements ConditionFactory {
31
32     /**
33      * Creates an and condition
34      *
35      * @param first the first condition
36      * @param second the second condition
37      * @return A combinator condition
38      * @exception CSSException if this exception is not supported.
39      */

40     public CombinatorCondition createAndCondition(Condition first,
41                           Condition second)
42         throws CSSException {
43     return new AndConditionImpl(first, second);
44     }
45
46     /**
47      * Creates an or condition
48      *
49      * @param first the first condition
50      * @param second the second condition
51      * @return A combinator condition
52      * @exception CSSException if this exception is not supported.
53      */

54     public CombinatorCondition createOrCondition(Condition first,
55                          Condition second)
56         throws CSSException {
57     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
58     }
59
60     /**
61      * Creates a negative condition
62      *
63      * @param condition the condition
64      * @return A negative condition
65      * @exception CSSException if this exception is not supported.
66      */

67     public NegativeCondition createNegativeCondition(Condition condition)
68         throws CSSException {
69     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
70     }
71
72
73     /**
74      * Creates a positional condition
75      *
76      * @param position the position of the node in the list.
77      * @param typeNode <code>true</code> if the list should contain
78      * only nodes of the same type (element, text node, ...).
79      * @param type <code>true</code> true if the list should contain
80      * only nodes of the same node (for element, same localName
81      * and same namespaceURI).
82      * @return A positional condition
83      * @exception CSSException if this exception is not supported.
84      */

85     public PositionalCondition createPositionalCondition(int position,
86                           boolean typeNode,
87                           boolean type)
88         throws CSSException {
89     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
90     }
91
92     /**
93      * creates an attribute condition
94      *
95      * @param localName the localName of the attribute
96      * @param namespaceURI the namespace URI of the attribute
97      * @param specified <code>true</code> if the attribute must be specified
98      * in the document.
99      * @param value the value of this attribute.
100      * @return An attribute condition
101      * @exception CSSException if this exception is not supported.
102      */

103     public AttributeCondition createAttributeCondition(String JavaDoc localName,
104                         String JavaDoc namespaceURI,
105                         boolean specified,
106                         String JavaDoc value)
107         throws CSSException {
108     if ((namespaceURI != null) || specified) {
109         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
110     } else {
111         return new AttributeConditionImpl(localName, value);
112     }
113     }
114
115     /**
116      * Creates an id condition
117      *
118      * @param value the value of the id.
119      * @return An Id condition
120      * @exception CSSException if this exception is not supported.
121      */

122     public AttributeCondition createIdCondition(String JavaDoc value)
123         throws CSSException {
124     return new IdConditionImpl(value);
125     }
126
127     /**
128      * Creates a lang condition
129      *
130      * @param value the value of the language.
131      * @return A lang condition
132      * @exception CSSException if this exception is not supported.
133      */

134     public LangCondition createLangCondition(String JavaDoc lang)
135         throws CSSException {
136     return new LangConditionImpl(lang);
137     }
138
139     /**
140      * Creates a "one of" attribute condition
141      *
142      * @param localName the localName of the attribute
143      * @param namespaceURI the namespace URI of the attribute
144      * @param specified <code>true</code> if the attribute must be specified
145      * in the document.
146      * @param value the value of this attribute.
147      * @return A "one of" attribute condition
148      * @exception CSSException if this exception is not supported.
149      */

150     public AttributeCondition createOneOfAttributeCondition(String JavaDoc localName,
151                              String JavaDoc namespaceURI,
152                              boolean specified,
153                              String JavaDoc value)
154         throws CSSException {
155     if ((namespaceURI != null) || specified) {
156         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
157     } else {
158         return new OneOfAttributeConditionImpl(localName, value);
159     }
160     }
161
162     /**
163      * Creates a "begin hyphen" attribute condition
164      *
165      * @param localName the localName of the attribute
166      * @param namespaceURI the namespace URI of the attribute
167      * @param specified <code>true</code> if the attribute must be specified
168      * in the document.
169      * @param value the value of this attribute.
170      * @return A "begin hyphen" attribute condition
171      * @exception CSSException if this exception is not supported.
172      */

173     public AttributeCondition createBeginHyphenAttributeCondition(String JavaDoc localName,
174                                String JavaDoc namespaceURI,
175                                boolean specified,
176                                String JavaDoc value)
177         throws CSSException {
178     if ((namespaceURI != null) || specified) {
179         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
180     } else {
181         return new BeginHyphenAttributeConditionImpl(localName, value);
182     }
183     }
184
185     /**
186      * Creates a class condition
187      *
188      * @param localName the localName of the attribute
189      * @param namespaceURI the namespace URI of the attribute
190      * @param specified <code>true</code> if the attribute must be specified
191      * in the document.
192      * @param value the name of the class.
193      * @return A class condition
194      * @exception CSSException if this exception is not supported.
195      */

196     public AttributeCondition createClassCondition(String JavaDoc namespaceURI,
197                         String JavaDoc value)
198         throws CSSException {
199     return new ClassConditionImpl(value);
200     }
201
202     /**
203      * Creates a pseudo class condition
204      *
205      * @param namespaceURI the namespace URI of the attribute
206      * @param value the name of the pseudo class
207      * @return A pseudo class condition
208      * @exception CSSException if this exception is not supported.
209      */

210     public AttributeCondition createPseudoClassCondition(String JavaDoc namespaceURI,
211                              String JavaDoc value)
212         throws CSSException {
213     return new PseudoClassConditionImpl(value);
214     }
215
216     /**
217      * Creates a "only one" child condition
218      *
219      * @return A "only one" child condition
220      * @exception CSSException if this exception is not supported.
221      */

222     public Condition createOnlyChildCondition() throws CSSException {
223     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
224     }
225
226     /**
227      * Creates a "only one" type condition
228      *
229      * @return A "only one" type condition
230      * @exception CSSException if this exception is not supported.
231      */

232     public Condition createOnlyTypeCondition() throws CSSException {
233     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
234     }
235
236     /**
237      * Creates a content condition
238      *
239      * @param data the data in the content
240      * @return A content condition
241      * @exception CSSException if this exception is not supported.
242      */

243     public ContentCondition createContentCondition(String JavaDoc data)
244         throws CSSException {
245     throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
246     }
247 }
248
Popular Tags