Package com.volantis.styling.impl.engine.matchers

Examples of com.volantis.styling.impl.engine.matchers.Matcher


        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new AttributeMatcher(null, "local", constraintMock);
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.MATCHED, actual);
    }
View Full Code Here


        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new AttributeMatcher(null, "local", constraintMock);
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.FAILED, actual);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new NamespaceMatcher("xyz");
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.MATCHED, actual);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new NamespaceMatcher("abc");
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.FAILED, actual);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new LocalNameMatcher("xyz");
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.MATCHED, actual);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Matcher matcher = new LocalNameMatcher("abc");
        MatcherResult actual = matcher.matches(matcherContextMock);
        assertEquals("Wrong result", MatcherResult.FAILED, actual);
    }
View Full Code Here

                // =====================================================================
                //   Test Expectations
                // =====================================================================

                Matcher matcher = new NthChildMatcher(a, b);
                MatcherResult actual = matcher.matches(matcherContextMock);
                assertEquals("Wrong result for position " + p +
                             " within sequence " + sequence + " with " +
                             a + "n + " + b,
                             sequence.expectedResult, actual);
            }
View Full Code Here

        // Iterate over the list of selectors.
        for (Iterator s = selectors.iterator(); s.hasNext();) {
            Selector selector = (Selector) s.next();

            // Get the matcher and associated information from the builder.
            Matcher matcher = matcherBuilder.getMatcher(selector);

            // Get the possibly empty list of pseudo style entities.
            List pseudoStyleEntities = matcherBuilder.getPseudoStyleEntities();

            // Get the specificity.
View Full Code Here

    private Styler[] splitCompositeMatcher(Source source, Priority priority,
                                           Specificity specificity,
                                           CompositeMatcher matcher,
                                           StylesDelta delta, Map stateIndex) {
        int compositeSize = 2;
        Matcher subject = matcher.getSubject();
        while (subject instanceof CompositeMatcher) {
            compositeSize += 1;
            subject = ((CompositeMatcher) subject).getSubject();
        }
        Styler[] stylers = new Styler[compositeSize];
        SelectionState requiredState = null;
        for (int i = 0; i < (stylers.length - 1); i++) {
            Matcher context = matcher.getContext();
            StateIndexKey key = new StateIndexKey(
                    requiredState, context, matcher.getOperator());
            SelectionState selectionState = (SelectionState) stateIndex.get(key);
            if (selectionState == null) {
                selectionState = createCompositeState(matcher.getOperator());
View Full Code Here

    // Javadoc inherited.
    public void visit(CombinedSelector selector) {

        // Visit the left which is the contextual selector.
        selector.getContext().accept(this);
        Matcher context = constructedMatcher;

        final CombinatorEnum combinator = selector.getCombinator();
        Operator operator = null;
        if (combinator == CombinatorEnum.DESCENDANT) {
            operator = Operator.DESCENDANT;
        } else if (combinator == CombinatorEnum.CHILD) {
            operator = Operator.CHILD;
        } else if (combinator == CombinatorEnum.INDIRECT_ADJACENT) {
            operator = Operator.SIBLING;
        } else if (combinator == CombinatorEnum.DIRECT_ADJACENT) {
            operator = Operator.ADJACENT;
        } else {
            throw new IllegalStateException("Unknown combinator " + combinator);
        }

        // Visit the right selector which is the subject selector.
        selector.getSubject().accept(this);
        Matcher subject = constructedMatcher;

        // Construct the composite matcher.
        constructedMatcher = factory.createCompositeMatcher(
                context, subject, operator, builderContext);
    }
View Full Code Here

TOP

Related Classes of com.volantis.styling.impl.engine.matchers.Matcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.