org.sikuli.script.compare.VerticalComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sikulixapi Show documentation
Show all versions of sikulixapi Show documentation
... for visual testing and automation
/*
* Copyright 2010-2016, Sikuli.org, sikulix.com
* Released under the MIT License.
*
* added Kelthuzad 2013
*/
package org.sikuli.script.compare;
import java.util.Comparator;
import org.sikuli.script.Region;
/**
* Compares the Regions by y-position.
*/
public class VerticalComparator implements Comparator {
/**
* Compares the Y-Position of two {@link Region} objects.
* @param region1 The first {@link Region} object
* @param region2 The second {@link Region} object
* @return
*
* - -1 if the y-position of region1 is smaller
* - 0 if the y-positions are equal
* - 1 if the y-position of region2 is smaller
*
*/
@Override
public int compare(Region region1, Region region2) {
if (region1 == region2) {
return 0;
}
if (region1.getY() == region2.getY()) {
return 0;
}
return region1.getY() < region2.getY() ? -1 : 1;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy