Class ContinuousClock

  • All Implemented Interfaces:
    IClock, IContinuousClock
    Direct Known Subclasses:
    SystemClock

    public class ContinuousClock
    extends AbstractClock
    implements IContinuousClock
    A continuous clock represents a real time clock that is based on the hardware clock. Can be made faster or slower and also has an adjustable start time.
    • Field Detail

      • dilation

        protected double dilation
        The dilation.
      • laststart

        protected long laststart
        The last starting real time measurement point.
      • elapsed

        protected long elapsed
        The elapsed time.
      • executor

        protected Executor executor
        The active timer watcher.
      • threadpool

        protected IThreadPool threadpool
        The threadpool.
    • Constructor Detail

      • ContinuousClock

        public ContinuousClock​(java.lang.String name,
                               long starttime,
                               double dilation,
                               IThreadPool threadpool)
        Create a new clock. Delta (tick size) is default (see AbstractClock).
        Parameters:
        name - The clock name.
        starttime - The start time.
        dilation - The dilation.
      • ContinuousClock

        public ContinuousClock​(java.lang.String name,
                               long starttime,
                               double dilation,
                               long delta,
                               IThreadPool threadpool)
        Create a new clock.
        Parameters:
        name - The clock name.
        starttime - The start time.
        dilation - The dilation.
        delta - The tick size (in millis).
      • ContinuousClock

        public ContinuousClock​(IClock oldclock,
                               IThreadPool threadpool)
        Create a new clock.
        Parameters:
        oldclock - The old clock.
    • Method Detail

      • copyFromClock

        public void copyFromClock​(IClock oldclock)
        Transfer state from another clock to this clock.
        Overrides:
        copyFromClock in class AbstractClock
      • getDilation

        public double getDilation()
        Get the clocks dilation.
        Specified by:
        getDilation in interface IContinuousClock
        Returns:
        The clocks dilation.
      • setDilation

        public void setDilation​(double dilation)
        Set the clocks dilation.
        Specified by:
        setDilation in interface IContinuousClock
        Parameters:
        dilation - The clocks dilation.
      • getType

        public java.lang.String getType()
        Get the clock type.
        Specified by:
        getType in interface IClock
        Returns:
        The clock type.
      • computeNextTimepoint

        protected void computeNextTimepoint()
        Compute the next timepoint.
      • createExecutor

        protected Executor createExecutor()
        Create new executor.