Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.editor.model;
 
import  org.eclipse.jface.text.IRegion;
import  org.eclipse.jface.text.Region;
import  org.eclipse.jface.text.TextUtilities;

Author(s):
Sven Efftinge - Initial contribution and API
public class Regions {
Returns a predicate which returns true if the passed range and the region passed to the predicate overlap. Returns false if one of the arguments is null. Based on TextUtilities.overlaps(IRegion, IRegion)

Parameters:
offset range offset
length range length
Returns:
the predicate
	public static Predicate<? super IRegion> overlaps(final int offsetfinal int length) {
		return overlaps(new Region(offset,length));
	}

Returns a predicate which returns true if the passed region and the one passed to the predicate overlap. Returns false if one of the arguments is null. Based on TextUtilities.overlaps(IRegion, IRegion)

Parameters:
region to work with
Returns:
the predicate
	public static Predicate<? super IRegion> overlaps(final IRegion region) {
		return new Predicate<IRegion>() {
			public boolean apply(IRegion input) {
				return TextUtilities.overlaps(regioninput);
			}
		};
	}
New to GrepCode? Check out our FAQ X