18#ifndef _DECAF_UTIL_CONCURRENT_TIMEUNIT_H_
19#define _DECAF_UTIL_CONCURRENT_TIMEUNIT_H_
72 static const long long multipliers[];
95 TimeUnit(
int index,
const std::string& name );
126 long long toNanos(
long long duration )
const {
127 return doConvert( this->index,
NANOSECONDS.index, duration );
139 return doConvert( this->index,
MICROSECONDS.index, duration );
151 return doConvert( this->index,
MILLISECONDS.index, duration );
161 return doConvert( this->index,
SECONDS.index, duration );
171 return doConvert( this->index,
MINUTES.index, duration );
180 long long toHours(
long long duration )
const {
181 return doConvert( this->index,
HOURS.index, duration );
190 long long toDays(
long long duration )
const {
191 return doConvert( this->index,
DAYS.index, duration );
244 void sleep(
long long timeout )
const;
281 long long doConvert(
int srcIndex,
int destIndex,
long long duration )
const;
287 int excessNanos(
long long time,
long long ms )
const;
295 static long long scale(
long long duration,
long long multiplier,
long long overflow );
This interface imposes a total ordering on the objects of each class that implements it.
Definition Comparable.h:33
A Thread is a concurrent unit of execution.
Definition Thread.h:64
The interface for all synchronizable objects (that is, objects that can be locked and unlocked).
Definition Synchronizable.h:37
static const TimeUnit MICROSECONDS
Definition TimeUnit.h:78
long long toNanos(long long duration) const
Equivalent to NANOSECONDS.convert(duration, this).
Definition TimeUnit.h:126
virtual bool operator==(const TimeUnit &value) const
void timedWait(Synchronizable *obj, long long timeout) const
Perform a timed Object.wait using this time unit.
long long convert(long long sourceDuration, const TimeUnit &sourceUnit) const
Convert the given time duration in the given unit to this unit.
long long toDays(long long duration) const
Equivalent to DAYS.convert(duration, this).
Definition TimeUnit.h:190
TimeUnit(int index, const std::string &name)
Hidden Constructor, this class can not be instantiated directly.
void sleep(long long timeout) const
Perform a Thread.sleep using this unit.
static const TimeUnit MILLISECONDS
Definition TimeUnit.h:79
static const TimeUnit NANOSECONDS
The Actual TimeUnit enumerations.
Definition TimeUnit.h:77
static const TimeUnit MINUTES
Definition TimeUnit.h:81
static const TimeUnit *const values[]
The An Array of TimeUnit Instances.
Definition TimeUnit.h:86
virtual bool equals(const TimeUnit &value) const
static const TimeUnit HOURS
Definition TimeUnit.h:82
static const TimeUnit SECONDS
Definition TimeUnit.h:80
long long toMillis(long long duration) const
Equivalent to MILLISECONDS.convert(duration, this).
Definition TimeUnit.h:150
long long toMicros(long long duration) const
Equivalent to MICROSECONDS.convert(duration, this).
Definition TimeUnit.h:138
static const TimeUnit & valueOf(const std::string &name)
Returns the TimeUnit constant of this type with the specified name.
virtual bool operator<(const TimeUnit &value) const
static const TimeUnit DAYS
Definition TimeUnit.h:83
virtual int compareTo(const TimeUnit &value) const
long long toMinutes(long long duration) const
Equivalent to MINUTES.convert(duration, this).
Definition TimeUnit.h:170
virtual std::string toString() const
Converts the TimeUnit type to the Name of the TimeUnit.
long long toSeconds(long long duration) const
Equivalent to SECONDS.convert(duration, this).
Definition TimeUnit.h:160
void timedJoin(decaf::lang::Thread *thread, long long timeout)
Perform a timed Thread.join using this time unit.
virtual ~TimeUnit()
Definition TimeUnit.h:99
long long toHours(long long duration) const
Equivalent to HOURS.convert(duration, this).
Definition TimeUnit.h:180
#define DECAF_API
Definition Config.h:29
Definition ThreadingTypes.h:31
Definition AbstractExecutorService.h:28
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25