| 1 | |
package org.webslinger.rules; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import java.util.List; |
| 5 | |
import javax.servlet.ServletException; |
| 6 | |
import javax.servlet.ServletRequest; |
| 7 | |
|
| 8 | |
import org.webslinger.Webslinger; |
| 9 | |
|
| 10 | |
public class CSSChild extends AbstractSelector { |
| 11 | |
public CSSChild(int id) { |
| 12 | 0 | super(id); |
| 13 | 0 | } |
| 14 | |
|
| 15 | |
public CSSChild(Rules p, int id) { |
| 16 | 4 | super(p, id); |
| 17 | 4 | } |
| 18 | |
|
| 19 | |
|
| 20 | |
public Object jjtAccept(RulesVisitor visitor, Object data) { |
| 21 | 0 | return visitor.visit(this, data); |
| 22 | |
} |
| 23 | |
|
| 24 | |
public void updateSpecificity(int[] specificity, boolean[] isConstantHolder) { |
| 25 | 10 | isConstantHolder[0] = false; |
| 26 | 10 | super.updateSpecificity(specificity, isConstantHolder); |
| 27 | 10 | } |
| 28 | |
|
| 29 | |
public boolean matches(ServletRequest request, Webslinger top) throws IOException, ServletException { |
| 30 | 50 | if (!super.matches(request, top)) return false; |
| 31 | 10 | Webslinger ptr = top; |
| 32 | 30 | while (ptr.getParent() != null) { |
| 33 | 20 | Webslinger save = ptr; |
| 34 | |
try { |
| 35 | 50 | while (ptr.getParent() != null) { |
| 36 | 30 | ptr = ptr.getParent(); |
| 37 | |
|
| 38 | 30 | if (super.matches(request, ptr)) return true; |
| 39 | |
} |
| 40 | |
} finally { |
| 41 | 0 | ptr = save;; |
| 42 | 20 | } |
| 43 | |
|
| 44 | 20 | ptr = ptr.getParent(); |
| 45 | 20 | } |
| 46 | 10 | return false; |
| 47 | |
} |
| 48 | |
} |