001/*-----------------------------------------------------------------------+ 002 | com.teamscale.checks 003 | | 004 $Id$ 005 | | 006 | Copyright (c) 2009-2015 CQSE GmbH | 007 +-----------------------------------------------------------------------*/ 008package eu.cqse.check.framework.core.xpath.functions; 009 010import eu.cqse.check.framework.scanner.ETokenType; 011import eu.cqse.check.framework.shallowparser.TokenStreamUtils; 012import eu.cqse.check.framework.shallowparser.framework.ShallowEntity; 013 014/** 015 * A function that is querying for nodes, that contain all given modifiers. At 016 * the moment this function is similar to {@link AllTokensSelectionFunction} but 017 * in the future it can be extended to support different modifier semantics for 018 * different languages instead of just checking if a token with the modifier 019 * name exists. 020 */ 021public class AllModifiersSelectionFunction extends ModifierSelectionFunctionBase { 022 023 /** The function's name. */ 024 public static final String NAME = "modifiers"; 025 026 /** Constructor. */ 027 public AllModifiersSelectionFunction() { 028 super(NAME); 029 } 030 031 /** {@inheritDoc} */ 032 @Override 033 protected boolean checkNode(ShallowEntity node, ETokenType[] arguments) { 034 return TokenStreamUtils.containsAll(node.ownStartTokens(), arguments); 035 } 036}