struct Quartz::Scale
- Quartz::Scale
- Struct
- Value
- Object
Overview
Scale
is an approximation of the degree to which Duration
s must
be altered to have an appreciable effect on the implications of a model or
the results of a simulation.
Included Modules
- Comparable(Number)
- Comparable(Quartz::Scale)
- JSON::Serializable
Defined in:
quartz/json.crquartz/scale.cr
Constant Summary
-
ATTO =
new(-6)
-
BASE =
new(0)
-
EXA =
new(6)
-
FACTOR =
1000_i64
-
The base constant ß is a factor that separates one allowable time unit from the next.
-
FEMTO =
new(-5)
-
GIGA =
new(3)
-
KILO =
new(1)
-
MEGA =
new(2)
-
MICRO =
new(-2)
-
MILLI =
new(-1)
-
NANO =
new(-3)
-
PETA =
new(5)
-
PICO =
new(-4)
-
TERA =
new(4)
-
YOCTO =
new(-8)
-
YOTTA =
new(8)
-
ZEPTO =
new(-7)
-
ZETTA =
new(7)
Constructors
Instance Method Summary
-
#+(other : Int) : Scale
Returns the result of adding
self
and other. -
#-(other : Int) : Scale
Returns the result of subtracting
self
and other. -
#-(other : Scale) : Int32
Returns an integer which represent the distance between two given scales.
-
#- : Scale
Negates self.
-
#/(other : Scale) : Float64
Returns the result of dividing
self
and other. - #<=>(other : Scale) : Int32
-
#<=>(other : Number) : Int32
The comparison operator.
-
#clone
Returns a copy of
self
with all instance variables cloned. -
#level : Int8
The level of accuracy.
- #to_f
- #to_f32
- #to_f64
Instance methods inherited from struct Value
==(other : Quartz::Any)
==
Instance methods inherited from class Object
===(other : Quartz::Any)
===
Constructor Detail
Instance Method Detail
Returns an integer which represent the distance between two given scales.
The comparison operator. Returns 0
if the two objects are equal,
a negative number if this object is considered less than other,
a positive number if this object is considered greater than other,
or nil
if the two objects are not comparable.
Subclasses define this method to provide class-specific ordering.
The comparison operator is usually used to sort values:
# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]
# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]