org.scalatest.time.Units.scala Maven / Gradle / Ivy
Show all versions of scalatest_2.11.0-M3 Show documentation
/*
* Copyright 2001-2012 Artima, Inc.
*
* Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
*
* 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 org.scalatest.time
/**
* Defines a family of singleton objects representing units of time.
*
*
* The singleton objects that extend this abstract class may be passed
* to the constructor of Span
to specify
* units of time. For example:
*
*
*
* Span(1, Second)
*
*/
sealed abstract class Units {
private[scalatest] val singularResourceName: String
private[scalatest] val pluralResourceName: String
}
/**
* Indicates units for a single nanosecond.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify nanosecond units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Nanosecond)
*
*/
case object Nanosecond extends Units {
private[scalatest] val singularResourceName: String = "singularNanosecondUnits"
private[scalatest] val pluralResourceName: String = "pluralNanosecondUnits"
}
/**
* Indicates nanosecond units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify nanosecond units of time. For example:
*
*
*
* Span(10, Nanoseconds)
*
*/
case object Nanoseconds extends Units {
private[scalatest] val singularResourceName: String = "singularNanosecondUnits"
private[scalatest] val pluralResourceName: String = "pluralNanosecondUnits"
}
/**
* Indicates units for a single microsecond.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify microsecond units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Microsecond)
*
*/
case object Microsecond extends Units {
private[scalatest] val singularResourceName: String = "singularMicrosecondUnits"
private[scalatest] val pluralResourceName: String = "pluralMicrosecondUnits"
}
/**
* Indicates microsecond units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify microsecond units of time. For example:
*
*
*
* Span(10, Microseconds)
*
*/
case object Microseconds extends Units {
private[scalatest] val singularResourceName: String = "singularMicrosecondUnits"
private[scalatest] val pluralResourceName: String = "pluralMicrosecondUnits"
}
/**
* Indicates units for a single millisecond.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify millisecond units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Millisecond)
*
*/
case object Millisecond extends Units {
private[scalatest] val singularResourceName: String = "singularMillisecondUnits"
private[scalatest] val pluralResourceName: String = "pluralMillisecondUnits"
}
/**
* Indicates millisecond units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify millisecond units of time. For example:
*
*
*
* Span(10, Milliseconds)
*
*/
case object Milliseconds extends Units {
private[scalatest] val singularResourceName: String = "singularMillisecondUnits"
private[scalatest] val pluralResourceName: String = "pluralMillisecondUnits"
}
/**
* Indicates millisecond units (shorthand form).
*
*
* This singleton object may be passed to the constructor of Span
to
* specify millisecond units of time. For example:
*
*
*
* Span(10, Millis)
*
*
*
* Note: Millis
is merely a shorthand for Milliseconds
.
* When passed to Span
, Millis
means exactly the same thing as
* Milliseconds
.
*
*/
case object Millis extends Units {
private[scalatest] val singularResourceName: String = "singularMillisecondUnits"
private[scalatest] val pluralResourceName: String = "pluralMillisecondUnits"
}
/**
* Indicates units for a single second.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify second units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Second)
*
*/
case object Second extends Units {
private[scalatest] val singularResourceName: String = "singularSecondUnits"
private[scalatest] val pluralResourceName: String = "pluralSecondUnits"
}
/**
* Indicates second units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify second units of time. For example:
*
*
*
* Span(10, Seconds)
*
*/
case object Seconds extends Units {
private[scalatest] val singularResourceName: String = "singularSecondUnits"
private[scalatest] val pluralResourceName: String = "pluralSecondUnits"
}
/**
* Indicates units for a single minute.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify minute units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Minute)
*
*/
case object Minute extends Units {
private[scalatest] val singularResourceName: String = "singularMinuteUnits"
private[scalatest] val pluralResourceName: String = "pluralMinuteUnits"
}
/**
* Indicates minute units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify minute units of time. For example:
*
*
*
* Span(10, Minutes)
*
*/
case object Minutes extends Units {
private[scalatest] val singularResourceName: String = "singularMinuteUnits"
private[scalatest] val pluralResourceName: String = "pluralMinuteUnits"
}
/**
* Indicates units for a single hour.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify hour units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Hour)
*
*/
case object Hour extends Units {
private[scalatest] val singularResourceName: String = "singularHourUnits"
private[scalatest] val pluralResourceName: String = "pluralHourUnits"
}
/**
* Indicates hour units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify hour units of time. For example:
*
*
*
* Span(10, Hours)
*
*/
case object Hours extends Units {
private[scalatest] val singularResourceName: String = "singularHourUnits"
private[scalatest] val pluralResourceName: String = "pluralHourUnits"
}
/**
* Indicates units for a single day.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify day units of time, so long as the value passed to Span
is 1. For example:
*
*
*
* Span(1, Day)
*
*/
case object Day extends Units {
private[scalatest] val singularResourceName: String = "singularDayUnits"
private[scalatest] val pluralResourceName: String = "pluralDayUnits"
}
/**
* Indicates day units.
*
*
* This singleton object may be passed to the constructor of Span
to
* specify day units of time. For example:
*
*
*
* Span(10, Days)
*
*/
case object Days extends Units {
private[scalatest] val singularResourceName: String = "singularDayUnits"
private[scalatest] val pluralResourceName: String = "pluralDayUnits"
}