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

org.xbib.interlibrary.common.predicate.SelfPredicate Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package org.xbib.interlibrary.common.predicate;

import org.xbib.interlibrary.api.Requester;

import java.util.function.BiPredicate;

/**
 *
 */
public class SelfPredicate implements BiPredicate {

    private final String group;

    private final String isil;

    public SelfPredicate(String isil) {
        this(null, isil);
    }

    public SelfPredicate(String group, String isil) {
        this.group = group;
        this.isil = isil;
    }

    @Override
    public boolean test(Requester requester, String isil) {
        return (requester.getGroup() == null || group == null || requester.getGroup().equals(group)) &&
                (requester.getISIL().equals(isil) ||
                isil.startsWith(requester.getISIL() + "-") ||
                requester.getISIL().startsWith(isil + "-") ||
                this.isil.equals(isil));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy