Search in sources :

Example 1 with UsesRandomSeed

use of abs.backend.java.scheduling.UsesRandomSeed in project abstools by abstools.

the class ABSRuntime method setRandomSeed.

public synchronized void setRandomSeed(long seed) {
    randomSeed = seed;
    random = new Random(seed);
    logger.config("New Random Seed: " + randomSeed);
    if (globalSchedulingStrategy instanceof UsesRandomSeed) {
        ((UsesRandomSeed) globalSchedulingStrategy).setRandom(random);
    }
    if (taskSchedulingStrategy instanceof UsesRandomSeed) {
        ((UsesRandomSeed) taskSchedulingStrategy).setRandom(random);
    }
}
Also used : Random(java.util.Random) UsesRandomSeed(abs.backend.java.scheduling.UsesRandomSeed)

Example 2 with UsesRandomSeed

use of abs.backend.java.scheduling.UsesRandomSeed in project abstools by abstools.

the class SchedulingStrategy method setCurrentScheduler.

/**
 * Sets the current scheduler. If the old scheduler is the GUIScheduler, it is interrupted
 * and notified about the changed scheduler.
 * @param scheduler
 */
public synchronized void setCurrentScheduler(TotalScheduler scheduler) {
    if (random != null && scheduler instanceof UsesRandomSeed) {
        ((UsesRandomSeed) scheduler).setRandom(random);
    }
    TotalSchedulingStrategy oldscheduler = curScheduler;
    curScheduler = scheduler;
    schedulerUpdated(oldscheduler);
}
Also used : TotalSchedulingStrategy(abs.backend.java.scheduling.TotalSchedulingStrategy) UsesRandomSeed(abs.backend.java.scheduling.UsesRandomSeed)

Aggregations

UsesRandomSeed (abs.backend.java.scheduling.UsesRandomSeed)2 TotalSchedulingStrategy (abs.backend.java.scheduling.TotalSchedulingStrategy)1 Random (java.util.Random)1