001/*-----------------------------------------------------------------------+ 002 | eu.cqse.conqat.engine.sourcecode 003 | | 004 $Id$ 005 | | 006 | Copyright (c) 2009-2012 CQSE GmbH | 007 +-----------------------------------------------------------------------*/ 008package eu.cqse.check.framework.scanner; 009 010import org.conqat.lib.commons.equals.IEquator; 011 012/** 013 * A class for testing tokens for equality with respect to type and content. 014 */ 015public class TokenEquator implements IEquator<IToken> { 016 017 /** Reusable instance. */ 018 public static final TokenEquator INSTANCE = new TokenEquator(); 019 020 /** {@inheritDoc} */ 021 @Override 022 public boolean equals(IToken token1, IToken token2) { 023 return token1.getType() == token2.getType() && token1.getText().equals(token2.getText()); 024 } 025}