KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > steadystate > css > parser > selectors > ConditionFactoryImpl


1 /*
2  * ConditionFactoryImpl.java
3  *
4  * Steady State CSS2 Parser
5  *
6  * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * To contact the authors of the library, write to Steady State Software Ltd.,
23  * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24  *
25  * http://www.steadystate.com/css/
26  * mailto:css@steadystate.co.uk
27  *
28  * $Id: ConditionFactoryImpl.java,v 1.1.1.1 2003/12/28 21:23:41 davidsch Exp $
29  */

30
31 package com.steadystate.css.parser.selectors;
32
33 import org.w3c.css.sac.*;
34
35 public class ConditionFactoryImpl implements ConditionFactory {
36
37     public CombinatorCondition createAndCondition(
38         Condition first,
39         Condition second) throws CSSException {
40         return new AndConditionImpl(first, second);
41     }
42
43     public CombinatorCondition createOrCondition(
44         Condition first,
45         Condition second) throws CSSException {
46         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
47     }
48
49     public NegativeCondition createNegativeCondition(Condition condition)
50         throws CSSException {
51         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
52     }
53
54     public PositionalCondition createPositionalCondition(
55         int position,
56         boolean typeNode,
57         boolean type) throws CSSException {
58         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
59     }
60
61     public AttributeCondition createAttributeCondition(
62         String JavaDoc localName,
63         String JavaDoc namespaceURI,
64         boolean specified,
65         String JavaDoc value) throws CSSException {
66 // if ((namespaceURI != null) || !specified) {
67
// throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
68
// } else {
69
return new AttributeConditionImpl(localName, value);
70 // }
71
}
72
73     public AttributeCondition createIdCondition(String JavaDoc value)
74         throws CSSException {
75         return new IdConditionImpl(value);
76     }
77
78     public LangCondition createLangCondition(String JavaDoc lang)
79         throws CSSException {
80         return new LangConditionImpl(lang);
81     }
82
83     public AttributeCondition createOneOfAttributeCondition(
84         String JavaDoc localName,
85         String JavaDoc namespaceURI,
86         boolean specified,
87         String JavaDoc value) throws CSSException {
88 // if ((namespaceURI != null) || !specified) {
89
// throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
90
// } else {
91
return new OneOfAttributeConditionImpl(localName, value);
92 // }
93
}
94
95     public AttributeCondition createBeginHyphenAttributeCondition(
96         String JavaDoc localName,
97         String JavaDoc namespaceURI,
98         boolean specified,
99         String JavaDoc value) throws CSSException {
100 // if ((namespaceURI != null) || !specified) {
101
// throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
102
// } else {
103
return new BeginHyphenAttributeConditionImpl(localName, value);
104 // }
105
}
106
107     public AttributeCondition createClassCondition(
108         String JavaDoc namespaceURI,
109         String JavaDoc value) throws CSSException {
110         return new ClassConditionImpl(value);
111     }
112
113     public AttributeCondition createPseudoClassCondition(
114         String JavaDoc namespaceURI,
115         String JavaDoc value) throws CSSException {
116         return new PseudoClassConditionImpl(value);
117     }
118
119     public Condition createOnlyChildCondition() throws CSSException {
120         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
121     }
122
123     public Condition createOnlyTypeCondition() throws CSSException {
124         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
125     }
126
127     public ContentCondition createContentCondition(String JavaDoc data)
128         throws CSSException {
129         throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR);
130     }
131 }
132
Popular Tags