btf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / CTFClock.java
index a68e595908a633dcb9d256973fee5cea5b2b6aee..7b90cc14210f80e142559e2955af6aa34cc66667 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal and others
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
 package org.eclipse.linuxtools.ctf.core.event;
 
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Clock description used in CTF traces
  */
 public class CTFClock {
 
+    private static final long ONE_BILLION_L = 1000000000L;
+    private static final double ONE_BILLION_D = 1000000000.0;
+
     private static final String NAME = "name"; //$NON-NLS-1$
     private static final String FREQ = "freq"; //$NON-NLS-1$
     private static final String OFFSET = "offset"; //$NON-NLS-1$
 
-    private long clockOffset = 0;
-    private double clockScale = 1.0;
-    private double clockAntiScale = 1.0;
+    private long fClockOffset = 0;
+    private double fClockScale = 1.0;
+    private double fClockAntiScale = 1.0;
 
     /**
      * Field properties.
      */
-    final private HashMap<String, Object> properties = new HashMap<String, Object>();
+    private final Map<String, Object> fProperties = new HashMap<>();
     /**
      * Field name.
      */
-    private String name;
-    private boolean isScaled = false;
+    private String fName;
+    private boolean fIsScaled = false;
 
     /**
      * Default constructor
@@ -52,9 +56,9 @@ public class CTFClock {
      *            Object
      */
     public void addAttribute(String key, Object value) {
-        this.properties.put(key, value);
+        fProperties.put(key, value);
         if (key.equals(NAME)) {
-            this.name = (String) value;
+            fName = (String) value;
         }
         if (key.equals(FREQ)) {
             /*
@@ -64,13 +68,13 @@ public class CTFClock {
              * have a system with a frequency of > 1 600 000 000 GHz with
              * 200 ppm precision
              */
-            isScaled = !((Long) getProperty(FREQ)).equals(1000000000L);
-            clockScale = 1000000000.0 / ((Long) getProperty(FREQ)).doubleValue();
-            clockAntiScale = 1.0 / clockScale;
+            fIsScaled = !((Long) getProperty(FREQ)).equals(ONE_BILLION_L);
+            fClockScale = ONE_BILLION_D / ((Long) getProperty(FREQ)).doubleValue();
+            fClockAntiScale = 1.0 / fClockScale;
 
         }
         if (key.equals(OFFSET)) {
-            clockOffset = (Long) getProperty(OFFSET);
+            fClockOffset = (Long) getProperty(OFFSET);
         }
     }
 
@@ -80,7 +84,7 @@ public class CTFClock {
      * @return String
      */
     public String getName() {
-        return name;
+        return fName;
     }
 
     /**
@@ -91,35 +95,39 @@ public class CTFClock {
      * @return Object
      */
     public Object getProperty(String key) {
-        return properties.get(key);
+        return fProperties.get(key);
     }
 
     /**
      * @return the clockOffset
+     * @since 2.0
      */
     public long getClockOffset() {
-        return clockOffset;
+        return fClockOffset;
     }
 
     /**
      * @return the clockScale
+     * @since 2.0
      */
     public double getClockScale() {
-        return clockScale;
+        return fClockScale;
     }
 
     /**
      * @return the clockAntiScale
+     * @since 2.0
      */
     public double getClockAntiScale() {
-        return clockAntiScale;
+        return fClockAntiScale;
     }
 
     /**
      * @return is the clock in ns or cycles?
+     * @since 2.0
      */
     public boolean isClockScaled() {
-        return isScaled;
+        return fIsScaled;
     }
 
 }
This page took 0.02673 seconds and 5 git commands to generate.