// Path: adguard_cb/src/main/java/com/adguard/android/contentblocker/commons/function/BooleanSupplier.java
// @FunctionalInterface
// public interface BooleanSupplier {
// 
//     /**
//      * Gets a result
//      *
//      * @return the function result as boolean
//      */
//     boolean get();
// }


import androidx.annotation.NonNull;
import androidx.work.BackoffPolicy;
import androidx.work.Constraints;
import androidx.work.NetworkType;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkRequest;
import com.adguard.android.contentblocker.commons.function.BooleanSupplier;
import java.util.concurrent.TimeUnit;
/*
 * This file is part of AdGuard Content Blocker (https://github.com/AdguardTeam/ContentBlocker).
 * Copyright © 2019 AdGuard Content Blocker. All rights reserved.
 * <p/>
 * AdGuard Content Blocker is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 * <p/>
 * AdGuard Content Blocker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * <p/>
 * You should have received a copy of the GNU General Public License along with
 * AdGuard Content Blocker.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.adguard.android.contentblocker.service.job;




/**
 * <pre>
 * Abstract job implementation for later use in other classes.
 *
 * <b>FOR DEVELOPERS</b>
 * This is implementation for periodic jobs.
 * If you want to implement one time job, you have to implement another AbstractOneTimeJob class and rename this class.</pre>
 */
abstract class AbstractJob implements Job {

    /**
     * For our backoff policy we're using 10 minutes as the start value
     * Which is then increased according to the linear policy.
     */
    private static final long DEFAULT_BACKOFF_PERIOD = TimeUnit.MINUTES.toSeconds(10);

    private Id id;
    private BooleanSupplier jobRunner;
    private BooleanSupplier canScheduleRunner;
    private long periodicInterval;
// Path: adguard_cb/src/main/java/com/adguard/android/contentblocker/commons/function/BooleanSupplier.java
// @FunctionalInterface
// public interface BooleanSupplier {
// 
//     /**
//      * Gets a result
//      *
//      * @return the function result as boolean
//      */
//     boolean get();
// }


// Path: adguard_cb/src/main/java/com/adguard/android/contentblocker/service/job/AbstractJob.java
import androidx.annotation.NonNull;
import androidx.work.BackoffPolicy;
import androidx.work.Constraints;
import androidx.work.NetworkType;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkRequest;
import com.adguard.android.contentblocker.commons.function.BooleanSupplier;
import java.util.concurrent.TimeUnit;

/*
 * This file is part of AdGuard Content Blocker (https://github.com/AdguardTeam/ContentBlocker).
 * Copyright © 2019 AdGuard Content Blocker. All rights reserved.
 * <p/>
 * AdGuard Content Blocker is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 * <p/>
 * AdGuard Content Blocker is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * <p/>
 * You should have received a copy of the GNU General Public License along with
 * AdGuard Content Blocker.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.adguard.android.contentblocker.service.job;




/**
 * <pre>
 * Abstract job implementation for later use in other classes.
 *
 * <b>FOR DEVELOPERS</b>
 * This is implementation for periodic jobs.
 * If you want to implement one time job, you have to implement another AbstractOneTimeJob class and rename this class.</pre>
 */
abstract class AbstractJob implements Job {

    /**
     * For our backoff policy we're using 10 minutes as the start value
     * Which is then increased according to the linear policy.
     */
    private static final long DEFAULT_BACKOFF_PERIOD = TimeUnit.MINUTES.toSeconds(10);

    private Id id;
    private BooleanSupplier jobRunner;
    private BooleanSupplier canScheduleRunner;
    private long periodicInterval;
    private long flexInterval;