From 270a3f6e22782278a5254c4c073cad2ad8b6ccf8 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 28 Aug 2014 20:31:35 +0400 Subject: java-decompiler: post-import cleanup (unneeded files dropped) --- timer/com/vladium/utils/timing/HRTimer.java | 86 ---------------------- timer/com/vladium/utils/timing/ITimer.java | 54 -------------- .../com/vladium/utils/timing/ITimerConstants.java | 31 -------- .../com/vladium/utils/timing/JavaSystemTimer.java | 74 ------------------- timer/com/vladium/utils/timing/TimerFactory.java | 74 ------------------- 5 files changed, 319 deletions(-) delete mode 100644 timer/com/vladium/utils/timing/HRTimer.java delete mode 100644 timer/com/vladium/utils/timing/ITimer.java delete mode 100644 timer/com/vladium/utils/timing/ITimerConstants.java delete mode 100644 timer/com/vladium/utils/timing/JavaSystemTimer.java delete mode 100644 timer/com/vladium/utils/timing/TimerFactory.java (limited to 'timer/com/vladium') diff --git a/timer/com/vladium/utils/timing/HRTimer.java b/timer/com/vladium/utils/timing/HRTimer.java deleted file mode 100644 index a3673a1..0000000 --- a/timer/com/vladium/utils/timing/HRTimer.java +++ /dev/null @@ -1,86 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private implementation of {@link ITimer} based around native - * getTime method. It will work on any platform for which a JNI - * implementation of "hrtlib" library is available.

- * - * {@link TimerFactory} acts as the Factory for this class.

- * - * MT-safety: an instance of this class is safe to be used within the same - * thread only. - * - * @author (C) Vlad Roubtsov, 2002 - */ -final class HRTimer implements ITimer, ITimerConstants -{ - // public: ................................................................ - - public void start () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_READY) - throw new IllegalStateException (this + ": start() must be called from READY state, current state is " + STATE_NAMES [m_state]); - } - - if (DO_STATE_CHECKS) m_state = STATE_STARTED; - m_data = getTime (); - } - - public void stop () - { - // latch stop time in a local var before doing anything else: - final double data = getTime (); - - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STARTED) - throw new IllegalStateException (this + ": stop() must be called from STARTED state, current state is " + STATE_NAMES [m_state]); - } - - m_data = data - m_data; - if (DO_STATE_CHECKS) m_state = STATE_STOPPED; - } - - public double getDuration () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STOPPED) - throw new IllegalStateException (this + ": getDuration() must be called from STOPPED state, current state is " + STATE_NAMES [m_state]); - } - - return m_data; - } - - public void reset () - { - if (DO_STATE_CHECKS) m_state = STATE_READY; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - /* - * This is supposed to return a fractional count of milliseconds elapsed - * since some indeterminate moment in the past. The exact starting point - * is not relevant because this timer class reports time differences only. - * - * JNI code in HRTIMER_LIB library is supposed to implement this. */ - private static native double getTime (); - - - private int m_state; // used to keep track of timer state - private double m_data; // timing data - - private static final String HRTIMER_LIB = "hrtlib"; - - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/ITimer.java b/timer/com/vladium/utils/timing/ITimer.java deleted file mode 100644 index 98029b1..0000000 --- a/timer/com/vladium/utils/timing/ITimer.java +++ /dev/null @@ -1,54 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A simple interface for measuring time intervals. An instance of this goes - * through the following lifecycle states: - *

- *
ready - *
timer is ready to start a new measurement - *
started - *
timer has recorded the starting time interval point - *
stopped - *
timer has recorded the ending time interval point - *
- * See individual methods for details.

- * - * If this library has been compiled with {@link ITimerConstants#DO_STATE_CHECKS} - * set to 'true' the implementation will enforce this lifecycle model and throw - * IllegalStateException when it is violated. - * - * @author (C) Vlad Roubtsov, 2002 - */ -public interface ITimer -{ - // public: ................................................................ - - /** - * Starts a new time interval and advances this timer instance to 'started' - * state. This method can be called from 'ready' state only. */ - void start (); - - /** - * Terminates the current time interval and advances this timer instance to - * 'stopped' state. Interval duration will be available via - * {@link #getDuration()} method. This method can be called from 'started' - * state only. */ - void stop (); - - /** - * Returns the duration of the time interval that elapsed between the last - * calls to {@link #start()} and {@link #stop()}. This method can be called - * any number of times from 'stopped' state and will return the same value - * each time.

- * * @return interval duration in milliseconds */ - double getDuration (); - - /** - * This method can be called from any state and will reset this timer - * instance back to 'ready' state. */ - void reset (); - -} // end of interface -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/ITimerConstants.java b/timer/com/vladium/utils/timing/ITimerConstants.java deleted file mode 100644 index 29435ae..0000000 --- a/timer/com/vladium/utils/timing/ITimerConstants.java +++ /dev/null @@ -1,31 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private collection of constants used by {@link ITimer} implementations - * in HRTimer and JavaSystemTimer classes. - * - * @author (C) Vlad Roubtsov, 2002 - */ -interface ITimerConstants -{ - // public: ................................................................ - - /** - * Conditional compilation flag to enable/disable state checking in timer - * implementations. Just about the only reason you might want to disable - * this is to reduce the timer overhead, but in practice the gain is very - * small. */ - static final boolean DO_STATE_CHECKS = true; - - /** - * Timer state enumeration. */ - static final int STATE_READY = 0, STATE_STARTED = 1, STATE_STOPPED = 2; - - /** - * User-friendly timer state names indexed by their state values. */ - static final String [] STATE_NAMES = {"READY", "STARTED", "STOPPED"}; - -} // end of interface -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/JavaSystemTimer.java b/timer/com/vladium/utils/timing/JavaSystemTimer.java deleted file mode 100644 index e3f3b48..0000000 --- a/timer/com/vladium/utils/timing/JavaSystemTimer.java +++ /dev/null @@ -1,74 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * A package-private implementation of {@link ITimer} based around Java system - * timer [System.currentTimeMillis() method]. It is used when - * HRTimer implementation is unavailable.

- * - * {@link TimerFactory} acts as the Factory for this class.

- * - * MT-safety: an instance of this class is safe to be used within the same - * thread only. - * - * @author (C) Vlad Roubtsov, 2002 - */ -final class JavaSystemTimer implements ITimer, ITimerConstants -{ - // public: ................................................................ - - public void start () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_READY) - throw new IllegalStateException (this + ": start() must be called from READY state, current state is " + STATE_NAMES [m_state]); - } - - if (DO_STATE_CHECKS) m_state = STATE_STARTED; - m_data = System.currentTimeMillis (); - } - - public void stop () - { - // latch stop time in a local var before doing anything else: - final long data = System.currentTimeMillis (); - - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STARTED) - throw new IllegalStateException (this + ": stop() must be called from STARTED state, current state is " + STATE_NAMES [m_state]); - } - - m_data = data - m_data; - if (DO_STATE_CHECKS) m_state = STATE_STOPPED; - } - - public double getDuration () - { - if (DO_STATE_CHECKS) - { - if (m_state != STATE_STOPPED) - throw new IllegalStateException (this + ": getDuration() must be called from STOPPED state, current state is " + STATE_NAMES [m_state]); - } - - return m_data; - } - - public void reset () - { - if (DO_STATE_CHECKS) m_state = STATE_READY; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - private int m_state; // used to keep track of timer state - private long m_data; // timing data - -} // end of class -// ---------------------------------------------------------------------------- diff --git a/timer/com/vladium/utils/timing/TimerFactory.java b/timer/com/vladium/utils/timing/TimerFactory.java deleted file mode 100644 index ae127c5..0000000 --- a/timer/com/vladium/utils/timing/TimerFactory.java +++ /dev/null @@ -1,74 +0,0 @@ - -package com.vladium.utils.timing; - -// ---------------------------------------------------------------------------- -/** - * This non-instantiable non-extendible class acts as a Factory for {@link ITimer} - * implementations. - * - * @author (C) Vlad Roubtsov, 2002 - */ -public abstract class TimerFactory -{ - // public: ................................................................ - - private static final String HRTIMER_LIB = "hrtlib"; - - /** - * Creates a new instance of {@link ITimer} which is returned in 'ready' - * state. If the JNI-based/high-resolution implementation is not available - * this will return an instance of JavaSystemTimer, so this - * method is guaranteed not to fail. - * - * @return ITimer a new timer instance in 'ready' state [never null] */ - - public static void initialize(String path) { - - UnsatisfiedLinkError exception = null; - - try { - System.loadLibrary (HRTIMER_LIB); - } catch (UnsatisfiedLinkError e) { - if(path != null) { - try { - System.load(path); - } catch (UnsatisfiedLinkError ex) { - exception = ex; - } - } else { - exception = e; - } - } - - if(exception != null) { - System.out.println ("native lib '" + HRTIMER_LIB - + "' not found in 'java.library.path': " - + System.getProperty ("java.library.path") - +path==null?"":(" or in "+path)); - - throw exception; // re-throw - } - } - - public static ITimer newTimer () - { -// try -// { - return new HRTimer (); -// } -// catch (Throwable t) -// { -// return new JavaSystemTimer (); -// } - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - private TimerFactory () {} // prevent subclassing - -} // end of class -// ---------------------------------------------------------------------------- -- cgit v1.2.3