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

org.btrplace.scheduler.choco.StopButton Maven / Gradle / Ivy

Go to download

Implementation of the VM scheduler that use the Constraint Programming solver CHOCO to compute solutions.

The newest version!
/*
 * Copyright  2020 The BtrPlace Authors. All rights reserved.
 * Use of this source code is governed by a LGPL-style
 * license that can be found in the LICENSE.txt file.
 */

package org.btrplace.scheduler.choco;

import org.chocosolver.util.criteria.Criterion;

import java.util.concurrent.atomic.AtomicBoolean;

/**
 * A stop button that can stop the solving process.
 */
public class StopButton implements Criterion {

  /**
   * The stop flag.
   */
  private final AtomicBoolean stopNow = new AtomicBoolean(false);

  @Override
  public boolean isMet() {
    return stopNow.get();
  }

  /**
   * Stop the solver.
   */
  public void stopNow() {
    stopNow.set(true);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy