001    /*
002     * Copyright (c) 2000 World Wide Web Consortium,
003     * (Massachusetts Institute of Technology, Institut National de
004     * Recherche en Informatique et en Automatique, Keio University). All
005     * Rights Reserved. This program is distributed under the W3C's Software
006     * Intellectual Property License. This program is distributed in the
007     * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008     * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009     * PURPOSE.
010     * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011     *
012     * $Id: DirectAdjacentSelectorImpl.java,v 1.1.1.1 2006/04/23 14:51:53 taqua Exp $
013     */
014    package org.w3c.flute.parser.selectors;
015    
016    import org.w3c.css.sac.SiblingSelector;
017    import org.w3c.css.sac.Selector;
018    import org.w3c.css.sac.SimpleSelector;
019    
020    /**
021     * @version $Revision: 1.1.1.1 $
022     * @author  Philippe Le Hegaret
023     */
024    public class DirectAdjacentSelectorImpl implements SiblingSelector {
025    
026        Selector       child;
027        SimpleSelector directAdjacent;
028    
029        /**
030         * An integer indicating the type of <code>Selector</code>
031         */
032        public short getSelectorType() {
033            return Selector.SAC_DIRECT_ADJACENT_SELECTOR;
034        }
035    
036        /**
037         * Creates a new DescendantSelectorImpl
038         */
039        public DirectAdjacentSelectorImpl(Selector child, 
040                                          SimpleSelector directAdjacent) {
041            this.child = child;
042            this.directAdjacent = directAdjacent;
043        }
044        
045        public short getNodeType() {
046            return 1;
047        }
048            
049        /**
050         * Returns the parent selector.
051         */    
052        public Selector getSelector() {
053            return child;
054        }
055    
056        /*
057         * Returns the simple selector.
058         */    
059        public SimpleSelector getSiblingSelector() {
060            return directAdjacent;
061        }
062    }