Android Open Source - trafficcop Time Unit






From Project

Back to project page trafficcop.

License

The source code is released under:

Apache License

If you think the Android project trafficcop 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

package com.willowtreeapps.trafficcop;
//  ww  w. ja v a2  s .  c om
/**
 * A time unit with the base of seconds.
 */
public enum TimeUnit {
    SECOND(1), SECONDS(1),
    MINUTE(60), MINUTES(60),
    HOUR(60 * 60), HOURS(60 * 60),
    DAY(60 * 60 * 24), DAYS(60 * 60 * 24),
    WEEK(60 * 60 * 24 * 7), WEEKS(60 * 60 * 24 * 7);

    private int scale;

    TimeUnit(int scale) {
        this.scale = scale;
    }

    /**
     * Converts the value from this unit to seconds
     *
     * @param value the time in this unit
     * @return the time in seconds
     */
    public int of(int value) {
        return value * scale;
    }
}




Java Source Code List

com.willowtreeapps.trafficcop.DataUsageAlertListener.java
com.willowtreeapps.trafficcop.DataUsageStatsProvider.java
com.willowtreeapps.trafficcop.DataUsage.java
com.willowtreeapps.trafficcop.LogDataUsageAlertListener.java
com.willowtreeapps.trafficcop.SizeUnit.java
com.willowtreeapps.trafficcop.Threshold.java
com.willowtreeapps.trafficcop.TimeUnit.java
com.willowtreeapps.trafficcop.TrafficCop.java