001/*-----------------------------------------------------------------------+
002 | org.conqat.engine.index.incubator
003 |                                                                       |
004   $Id$            
005 |                                                                       |
006 | Copyright (c)  2009-2013 CQSE GmbH                                 |
007 +-----------------------------------------------------------------------*/
008package eu.cqse.check.framework.util.tokens;
009
010import java.util.List;
011
012import eu.cqse.check.framework.scanner.IToken;
013import eu.cqse.check.framework.shallowparser.TokenStreamTextUtils;
014
015/**
016 * Represents a {@link List} of {@link IToken}s matched in a group of a
017 * {@link TokenPatternMatch}. Each group in a {@link TokenPatternMatch} can
018 * contain multiple {@link MatchGroupElement}s.
019 * 
020 * 
021 */
022public class MatchGroupElement {
023        /** Tokens represented in this {@link MatchGroupElement}. */
024        private List<IToken> groupElementTokens;
025
026        /** Constructor. */
027        public MatchGroupElement(List<IToken> groupElementTokens) {
028                this.groupElementTokens = groupElementTokens;
029        }
030
031        /** @see #groupElementTokens */
032        public List<IToken> getTokens() {
033                return groupElementTokens;
034        }
035
036        /**
037         * Returns the concatenated tokens of this match group element.
038         */
039        public String concatTokenTexts() {
040                return TokenStreamTextUtils.concatTokenTexts(groupElementTokens);
041        }
042}