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

com.github.romankh3.image.comparison.model.ExcludedAreas Maven / Gradle / Ivy

There is a newer version: 4.4.0
Show newest version
package com.github.romankh3.image.comparison.model;

import java.util.ArrayList;
import java.util.List;

/**
 * The area that will be excluded, masked, in the image.
 */
public class ExcludedAreas {

    /**
     * The collection of the areas which would be excluded from the comparison.
     */
    private final List excluded;

    /**
     * Create empty instance of the {@link ExcludedAreas}.
     */
    public ExcludedAreas() {
        excluded = new ArrayList<>();
    }

    /**
     * Create instance of the {@link ExcludedAreas} with provided {@link Rectangle} areas.
     *
     * @param excluded provided collection of the {@link Rectangle} objects.
     */
    public ExcludedAreas(List excluded) {
        this.excluded = excluded;
    }

    /**
     * Check if this {@link Point} contains in the {@link ExcludedAreas#excluded}
     * collection of the {@link Rectangle}.
     *
     * @param point the {@link Point} object to be checked.
     *
     * @return {@code true} if this {@link Point} contains in areas from {@link ExcludedAreas#excluded}.
     */
    public boolean contains(Point point) {
        return excluded.stream().anyMatch(rectangle -> rectangle.containsPoint(point));
    }

    public List getExcluded() {
        return excluded;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy