Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2012 Daniel Bechler
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.danielbechler.diff.visitor;
import java.util.*;

Author(s):
Daniel Bechler
@SuppressWarnings("UnusedDeclaration")
public abstract class CategoryFilteringVisitor extends AbstractFilteringVisitor
	private final Collection<Stringinclude = new TreeSet<String>();
	private final Collection<Stringexclude = new TreeSet<String>();
	private boolean includeAllNonExcluded;
	protected boolean accept(final Node node)
	{
		if (isExcluded(node))
		{
			return false;
		}
		{
			return true;
		}
		return false;
	}
	protected void onDismiss(final Node nodefinal Visit visit)
	{
		super.onDismiss(nodevisit);
		visit.dontGoDeeper();
	}
	@SuppressWarnings({"TypeMayBeWeakened"})
	private boolean isExcluded(final Node node)
	{
		return Collections.containsAny(node.getCategories(), );
	}
	@SuppressWarnings({"TypeMayBeWeakened"})
	private boolean isIncluded(final Node node)
	{
		return Collections.containsAny(node.getCategories(), );
	}
	public final CategoryFilteringVisitor include(final String category)
	{
		.add(category);
		.remove(category);
		return this;
	}
	@SuppressWarnings({"UnusedDeclaration"})
	public final CategoryFilteringVisitor includeOnly(final String category)
	{
		include(category);
		return this;
	}
	public final CategoryFilteringVisitor includeAllNonExcluded(final boolean value)
	{
		return this;
	}
	@SuppressWarnings({"UnusedDeclaration"})
	public final CategoryFilteringVisitor exclude(final String category)
	{
		.add(category);
		.remove(category);
		return this;
	}
New to GrepCode? Check out our FAQ X