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

org.sikuli.script.compare.VerticalComparator Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
/*
 * Copyright 2010-2014, 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 - 2024 Weber Informatics LLC | Privacy Policy