All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.compare.rangedifferencer.IRangeComparator Maven / Gradle / Ivy

There is a newer version: 11.5.0
Show newest version
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation 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
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.compare.rangedifferencer;

/**
 * For breaking an object to compare into a sequence of comparable entities.
 * 

* It is used by RangeDifferencer to find longest sequences of * matching and non-matching ranges. *

* For example, to compare two text documents and find longest common sequences * of matching and non-matching lines, the implementation must break the * document into lines. getRangeCount would return the number of * lines in the document, and rangesEqual would compare a * specified line given with one in another IRangeComparator. *

*

* Clients should implement this interface; there is no standard implementation. *

*/ public interface IRangeComparator { /** * Returns the number of comparable entities. * * @return the number of comparable entities */ int getRangeCount(); /** * Returns whether the comparable entity given by the first index matches an * entity specified by the other IRangeComparator and index. * * @param thisIndex * the index of the comparable entity within this * IRangeComparator * @param other * the IRangeComparator to compare this with * @param otherIndex * the index of the comparable entity within the other * IRangeComparator * @return true if the comparable entities are equal */ boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex); /** * Returns whether a comparison should be skipped because it would be too * costly (or lengthy). * * @param length * a number on which to base the decision whether to return * true or false * @param maxLength * another number on which to base the decision whether to * return true or false * @param other * the other IRangeComparator to compare with * @return true to avoid a too lengthy range comparison */ boolean skipRangeComparison(int length, int maxLength, IRangeComparator other); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy