A simple structure representing a calendar date in UTC.
Provides idiomatic optional parameter values on top of Option, but which can be passed in as raw values, instead of having to pass in Some(value)
Provides idiomatic optional parameter values on top of Option, but which can be passed in as raw values, instead of having to pass in Some(value)
import io.radanalytics.silex.util.OptionalArg def possiblyFilter(data: Seq[Int], filterMax: OptionalArg[Int] = None) = { // Treat an OptionalArg like an Option, for idiomatic handling of unset vals as None if (filterMax.isEmpty) data else data.filter(_ <= filterMax.get) } val data = Seq(1, -1, 2) // default filterMax is None possiblyFilter(data) // returns data unfiltered // provide argument as (-1), instead of having to specify Some(-1) possiblyFilter(data, filterMax = -1) // returns Seq(-1) // Support full Option methods and implicit conversion to Option import OptionalArg.fullOptionSupport def possiblyFilterUsingMap(data: Seq[Int], filterMax: OptionalArg[Int] = None) = { // use the 'map' method on an OptionalArg: filterMax.map(t => data.filter(_ <= t)).getOrElse(data) }
The underlying value type.
On-line mean and variance estimates for a stream of fractional values.
On-line mean and variance estimates for a stream of fractional values. Uses Chan's formulae.
Type S must have a scala.math.Fractional[S] witness in scope, a NumericLimits[S] witness in scope, and a function converting from Long to S in scope. Scala provides the former and the latter for its fractional numeric types; the SampleSink companion object provides witnesses forNumericLimits[Float] and NumericLimits[Double].
A function object to convert to and from times in some particular string format
A function object to convert to and from times in the AWS billing format.
A function object to convert to and from times in the AWS billing format.
These are UTC, in the form YYYY-MM-DD HH:MM:SS
. By converting to the DateTimeUTC
format, you can manipulate individual components or convert to another format for further
processing.
Factory methods and implicit conversions from raw values and Option to OptionalArg
A simple structure representing a calendar date in UTC.
This class is deliberately extremely simple and delegates out to
joda-time
for its actual functionality; it exists solely to abstract away our choice of date and time library. (In JDK 8, it would probably make sense to use the new standard library date and time classes.)If you need to deal with multiple time zones or different calendars, you're probably best served by using something more sophisticated (although the
from
method in the companion object to convert from a org.joda.time.DateTime will convert to UTC first).