You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/12/02 12:29:38 UTC
[5/8] jena git commit: Tidy up
Tidy up
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ac6fbe9d
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ac6fbe9d
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ac6fbe9d
Branch: refs/heads/master
Commit: ac6fbe9d6235219c2ec53051c95c2312cbf5f954
Parents: 05fae18
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Dec 2 10:41:00 2014 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Dec 2 10:41:00 2014 +0000
----------------------------------------------------------------------
.../java/com/hp/hpl/jena/sparql/util/Timer.java | 48 ++++++++------------
1 file changed, 18 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/ac6fbe9d/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Timer.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Timer.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Timer.java
index 4874e33..83c4415 100644
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Timer.java
+++ b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Timer.java
@@ -16,22 +16,19 @@
* limitations under the License.
*/
-package com.hp.hpl.jena.sparql.util;
+package com.hp.hpl.jena.sparql.util ;
import com.hp.hpl.jena.sparql.ARQException ;
+public class Timer {
-public class Timer
-{
+ protected long timeFinish = -1 ;
+ protected boolean inTimer = false ;
+ protected long timeStart = 0 ;
- protected long timeFinish = -1 ;
- protected boolean inTimer = false ;
- protected long timeStart = 0 ;
+ public Timer() {}
- public Timer() { }
-
- public void startTimer()
- {
+ public void startTimer() {
if ( inTimer )
throw new ARQException("Already in timer") ;
@@ -41,43 +38,34 @@ public class Timer
}
/** Return time in millisecods */
- public long endTimer()
- {
- if ( ! inTimer )
+ public long endTimer() {
+ if ( !inTimer )
throw new ARQException("Not in timer") ;
timeFinish = System.currentTimeMillis() ;
inTimer = false ;
return getTimeInterval() ;
}
- public long readTimer()
- {
- if ( ! inTimer )
+ public long readTimer() {
+ if ( !inTimer )
throw new ARQException("Not in timer") ;
- return System.currentTimeMillis()-timeStart ;
+ return System.currentTimeMillis() - timeStart ;
}
- public long getTimeInterval()
- {
+ public long getTimeInterval() {
if ( inTimer )
throw new ARQException("Still timing") ;
if ( timeFinish == -1 )
throw new ARQException("No valid interval") ;
- return timeFinish-timeStart ;
+ return timeFinish - timeStart ;
}
- static public String timeStr(long timeInterval)
- {
-// DecimalFormat f = new DecimalFormat("#0.###") ;
-// String s = f.format(timeInterval/1000.0) ;
-// return s ;
- //Java5
- return String.format("%.3f", timeInterval/1000.0) ;
+ static public String timeStr(long timeInterval) {
+ return String.format("%.3f", timeInterval / 1000.0) ;
}
- protected String timeStr(long timePoint, long startTimePoint)
- {
- return timeStr(timePoint-startTimePoint) ;
+ protected String timeStr(long timePoint, long startTimePoint) {
+ return timeStr(timePoint - startTimePoint) ;
}
}