Android Open Source - SensorDataCollector Experiment Time






From Project

Back to project page SensorDataCollector.

License

The source code is released under:

GNU General Public License

If you think the Android project SensorDataCollector listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (c) 2014, the SenSee authors.  Please see the AUTHORS file
 * for details. //from ww  w .j a  v a 2 s . c o  m
 * 
 * Licensed under the GNU Public License, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *       http://www.gnu.org/copyleft/gpl.html
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */

package sysnetlab.android.sdc.datacollector;

import android.annotation.SuppressLint;
import android.os.Build;
import android.os.SystemClock;

public class ExperimentTime {
    private long mThreadTimeMillis; /*
                                     * Returns milliseconds running in the
                                     * current thread. Added in API level 1.
                                     */
    private long mElapsedRealtime; /*
                                    * Returns milliseconds since boot, including
                                    * time spent in sleep. Added in API level 1.
                                    */
    private long mElapsedRealtimeNanos; /*
                                         * Returns nanoseconds since boot,
                                         * including time spent in sleep. Added
                                         * in API level 17.
                                         */

    @SuppressLint("NewApi")
    public ExperimentTime() {
        mThreadTimeMillis = SystemClock.currentThreadTimeMillis();
        mElapsedRealtime = SystemClock.elapsedRealtime();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            mElapsedRealtimeNanos = SystemClock.elapsedRealtimeNanos();
        } else {
            mElapsedRealtimeNanos = -1l;
        }
    }

    public ExperimentTime(long threadTimeMillis, long elapsedRealtime, long elapsedRealtimeNanos) {
        mThreadTimeMillis = threadTimeMillis;
        mElapsedRealtime = elapsedRealtime;
        mElapsedRealtimeNanos = elapsedRealtimeNanos;
    }

    public ExperimentTime(long threadTimeMillis, long elapsedRealtime) {
        this(threadTimeMillis, elapsedRealtime, -1);
    }

    public long getThreadTimeMillis() {
        return mThreadTimeMillis;
    }

    public void setThreadTimeMillis(long threadTimeMillis) {
        mThreadTimeMillis = threadTimeMillis;
    }

    public long getElapsedRealtime() {
        return mElapsedRealtime;
    }

    public void setElapsedRealtime(long elapsedRealtime) {
        mElapsedRealtime = elapsedRealtime;
    }

    public long getElapsedRealtimeNanos() {
        return mElapsedRealtimeNanos;
    }

    public void setmElapsedRealtimeNanos(long mElapsedRealtimeNanos) {
        this.mElapsedRealtimeNanos = mElapsedRealtimeNanos;
    }

    public String toString() {
        return Long.toString(mThreadTimeMillis) + "\n" + Long.toString(mElapsedRealtime) + "\n"
                + mElapsedRealtimeNanos;
    }

    public boolean equals(Object rhs) {
        if (rhs == this) {
            return true;
        }

        if (!(rhs instanceof ExperimentTime)) {
            return false;
        }

        ExperimentTime t = (ExperimentTime) rhs;

        if (mThreadTimeMillis != t.mThreadTimeMillis) {
            return false;
        }

        if (mElapsedRealtime != t.mElapsedRealtime) {
            return false;
        }

        if (mElapsedRealtimeNanos != t.mElapsedRealtimeNanos) {
            return false;
        }

        return true;
    }
}




Java Source Code List

sysnetlab.android.sdc.datacollector.AndroidSensorEventListener.java
sysnetlab.android.sdc.datacollector.DataCollectionState.java
sysnetlab.android.sdc.datacollector.DateUtils.java
sysnetlab.android.sdc.datacollector.DeviceInformation.java
sysnetlab.android.sdc.datacollector.DropboxHelper.java
sysnetlab.android.sdc.datacollector.ExperimentManagerSingleton.java
sysnetlab.android.sdc.datacollector.ExperimentManager.java
sysnetlab.android.sdc.datacollector.ExperimentTime.java
sysnetlab.android.sdc.datacollector.Experiment.java
sysnetlab.android.sdc.datacollector.Note.java
sysnetlab.android.sdc.datacollector.StateTag.java
sysnetlab.android.sdc.datacollector.Tag.java
sysnetlab.android.sdc.datacollector.TaggingAction.java
sysnetlab.android.sdc.datacollector.TaggingState.java
sysnetlab.android.sdc.datastore.AbstractStore.java
sysnetlab.android.sdc.datastore.SimpleFileStore.java
sysnetlab.android.sdc.datastore.SimpleXmlFileStore.java
sysnetlab.android.sdc.datastore.StoreSingleton.java
sysnetlab.android.sdc.loaders.ExperimentListLoader.java
sysnetlab.android.sdc.sensor.AbstractSensor.java
sysnetlab.android.sdc.sensor.AndroidSensor.java
sysnetlab.android.sdc.sensor.SensorDiscoverer.java
sysnetlab.android.sdc.sensor.SensorProperty.java
sysnetlab.android.sdc.sensor.audio.AudioChannelIn.java
sysnetlab.android.sdc.sensor.audio.AudioEncoding.java
sysnetlab.android.sdc.sensor.audio.AudioRecordParameter.java
sysnetlab.android.sdc.sensor.audio.AudioRecordSettingDBHelper.java
sysnetlab.android.sdc.sensor.audio.AudioRecordSettingDataSource.java
sysnetlab.android.sdc.sensor.audio.AudioSensorHelper.java
sysnetlab.android.sdc.sensor.audio.AudioSensor.java
sysnetlab.android.sdc.sensor.audio.AudioSource.java
sysnetlab.android.sdc.sensor.audio.WaveHeader.java
sysnetlab.android.sdc.sensor.camera.CameraHelper.java
sysnetlab.android.sdc.sensor.camera.CameraSensor.java
sysnetlab.android.sdc.services.RunExperimentService.java
sysnetlab.android.sdc.ui.AudioSensorProbingActivity.java
sysnetlab.android.sdc.ui.CreateExperimentActivity.java
sysnetlab.android.sdc.ui.FragmentActivityBase.java
sysnetlab.android.sdc.ui.GestureEventListener.java
sysnetlab.android.sdc.ui.SensorDataCollectorActivity.java
sysnetlab.android.sdc.ui.TaggingGridView.java
sysnetlab.android.sdc.ui.UserInterfaceUtils.java
sysnetlab.android.sdc.ui.ViewExperimentActivity.java
sysnetlab.android.sdc.ui.adapters.DataStoreListAdapter.java
sysnetlab.android.sdc.ui.adapters.ExperimentListAdapter.java
sysnetlab.android.sdc.ui.adapters.OperationAdapter.java
sysnetlab.android.sdc.ui.adapters.SensorListAdapter.java
sysnetlab.android.sdc.ui.adapters.SensorPropertyListAdapter.java
sysnetlab.android.sdc.ui.adapters.TagListAdapter.java
sysnetlab.android.sdc.ui.adapters.TaggingTagListAdapter.java
sysnetlab.android.sdc.ui.fragments.AudioSensorSetupDialogFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentDataStoreFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentEditNotesFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentEditTagsFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentListFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentRunFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentRunTaggingFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentSensorListFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentSensorSelectionFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentSensorSetupFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentSetupFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentViewFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentViewNotesFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentViewSensorDataFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentViewSensorListFragment.java
sysnetlab.android.sdc.ui.fragments.ExperimentViewTagsFragment.java
sysnetlab.android.sdc.ui.fragments.FragmentUtils.java