001package eu.cqse.check.framework.core.xpath.functions;
002
003import eu.cqse.check.framework.scanner.ETokenType;
004import eu.cqse.check.framework.shallowparser.TokenStreamUtils;
005import eu.cqse.check.framework.shallowparser.framework.ShallowEntity;
006
007/**
008 * A functions that is querying for nodes, that contain the given sequence of
009 * ETokenType(s).
010 */
011public class TokenSequenceFunction extends TokenSelectionFunctionBase {
012
013        /** The functions name */
014        public static final String NAME = "token-sequence";
015
016        /** Constructor. */
017        public TokenSequenceFunction() {
018                super(NAME);
019        }
020
021        /** {@inheritDoc} */
022        @Override
023        protected boolean checkNode(ShallowEntity node, ETokenType[] arguments) {
024                return TokenStreamUtils.containsSequence(node.ownStartTokens(), arguments);
025        }
026}