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

io.jbotsim.core.Clock Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
/*
 * Copyright 2008 - 2019, Arnaud Casteigts and the JBotSim contributors 
 *
 *
 * This file is part of JBotSim.
 *
 * JBotSim is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JBotSim 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with JBotSim.  If not, see .
 *
 */
package io.jbotsim.core;

/**
 * 

The abstract class {@link Clock} is used by the {@link ClockManager} to provide JBotSim with a clock mechanism.

* *

A {@link DefaultClock} is provided, but each platform/implementation is able to use its own clock by subclassiong * the {@link Clock} class.

*/ public abstract class Clock { protected ClockManager manager; public Clock(ClockManager manager) { this.manager = manager; } /** *

Returns the time unit of the clock, in milliseconds. The time unit is the duration of a round.

* @return the time unit of the clock, in milliseconds. */ public abstract int getTimeUnit(); /** * Sets the time unit of the clock to the specified value in millisecond. * * @param timeUnit The desired time unit */ public abstract void setTimeUnit(int timeUnit); /** * Indicates whether the clock is currently running or paused. * * @return true if running, false if paused. */ public abstract boolean isRunning(); /** * Starts the clock. */ public abstract void start(); /** * Pauses the clock. */ public abstract void pause(); /** * Resumes the clock if it was paused. */ public abstract void resume(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy