Class Stopwatch1

java.lang.Object
components.stopwatch.Stopwatch1
All Implemented Interfaces:
Standard<Stopwatch>, Stopwatch

public class Stopwatch1 extends Object implements Stopwatch
Stopwatch represented with two integers and a boolean, with implementations of all methods.
  • Constructor Summary

    Constructors
    Constructor
    Description
    No-argument constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Resets this to an initial value.
    final int
    Returns this.time in milliseconds.
    final boolean
     
    final int
     
    final boolean
    Returns this.running.
    final Stopwatch
    Returns a new object with the same dynamic type as this, having an initial value.
    final void
    Starts this.
    final void
    Stops this.
    final String
     
    final void
    Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Stopwatch1

      public Stopwatch1()
      No-argument constructor.
  • Method Details

    • newInstance

      public final Stopwatch newInstance()
      Description copied from interface: Standard
      Returns a new object with the same dynamic type as this, having an initial value. If the type T has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initialize this .
      Specified by:
      newInstance in interface Standard<Stopwatch>
      Returns:
      new object "like" this with an initial value
    • clear

      public final void clear()
      Description copied from interface: Standard
      Resets this to an initial value. If the type T has a no-argument constructor, then this satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then this satisfies the contract of the constructor call that was used to initialize #this.
      Specified by:
      clear in interface Standard<Stopwatch>
    • transferFrom

      public final void transferFrom(Stopwatch source)
      Description copied from interface: Standard
      Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this. If the type T has a no-argument constructor, then source satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then source satisfies the contract of the constructor call that was used to initialize #source.
      Specified by:
      transferFrom in interface Standard<Stopwatch>
      Parameters:
      source - object whose value is to be transferred
    • start

      public final void start()
      Description copied from interface: Stopwatch
      Starts this.
      Specified by:
      start in interface Stopwatch
    • stop

      public final void stop()
      Description copied from interface: Stopwatch
      Stops this.
      Specified by:
      stop in interface Stopwatch
    • elapsed

      public final int elapsed()
      Description copied from interface: Stopwatch
      Returns this.time in milliseconds.
      Specified by:
      elapsed in interface Stopwatch
      Returns:
      this.time
    • isRunning

      public final boolean isRunning()
      Description copied from interface: Stopwatch
      Returns this.running.
      Specified by:
      isRunning in interface Stopwatch
      Returns:
      this.running
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object