Boolean |
equals(other: Any?)
Indicates whether some other object is "equal to" this one.
The equals method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x, x.equals(x) should return true.
- It is symmetric: for any non-null reference values
x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
- It is transitive: for any non-null reference values
x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
- It is consistent: for any non-null reference values
x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
- For any non-null reference value
x, x.equals(null) should return false.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
|
MeasureUnit! |
forIdentifier(identifier: String!)
Constructs a MeasureUnit from a CLDR Core Unit Identifier, as defined in UTS 35. This method supports core unit identifiers and mixed unit identifiers. It validates and canonicalizes the given identifier. Note: A dimensionless MeasureUnit is represented as null. Example usage:
MeasureUnit example = MeasureUnit.forIdentifier("meter-per-second);
|
MutableSet<MeasureUnit!>! |
getAvailable()
Get all of the available units. Returned set is unmodifiable.
|
MutableSet<MeasureUnit!>! |
getAvailable(type: String!)
For the given type, return the available units.
|
MutableSet<String!>! |
getAvailableTypes()
Get all of the available units' types. Returned set is unmodifiable.
|
MeasureUnit.Complexity! |
getComplexity()
Compute the complexity of the unit. See Complexity for more information.
|
Int |
getDimensionality()
Returns the dimensionality (power) of this MeasureUnit. For example, if the unit is square, then 2 is returned.
NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an exception will be thrown. For more information, Complexity.
|
String! |
getIdentifier()
Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
|
MeasureUnit.MeasurePrefix! |
getPrefix()
Returns the current SI or binary prefix of this SINGLE unit. For example, if the unit has the prefix "kilo", then MeasurePrefix.KILO is returned.
NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will occur. For more information, Complexity.
|
String! |
getSubtype()
Get the subType, such as “foot”. May return null.
|
String! |
getType()
Get the type, such as "length". May return null.
|
Int |
hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.
The general contract of hashCode is:
- Whenever it is invoked on the same object more than once during an execution of a Java application, the
hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the
equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
- It is not required that if two objects are unequal according to the
equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
|
MeasureUnit! |
product(other: MeasureUnit!)
Computes the product of this unit with another unit. This is a way to build units from constituent parts.
The numerator and denominator are preserved through this operation.
For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the unit "kilowatt-hour-per-day" is returned.
NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a MIXED unit, an error will occur. For more information, Complexity.
|
MeasureUnit! |
reciprocal()
Computes the reciprocal of this MeasureUnit, with the numerator and denominator flipped.
For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will occur. For more information, Complexity.
NOTE: An exception will be thrown for units that have a constant denominator.
|
MutableList<MeasureUnit!>! |
splitToSingleUnits()
Returns the list of SINGLE units contained within a sequence of COMPOUND units.
Examples: - Given "meter-kilogram-per-second", three units will be returned: "meter", "kilogram", and "per-second". - Given "hour+minute+second", three units will be returned: "hour", "minute", and "second".
If this is a SINGLE unit, a list of length 1 will be returned.
NOTE: For units with a constant denominator, the returned single units will not include the constant denominator. To obtain the constant denominator, retrieve it from the original unit.
|
String |
toString()
Returns a string representation of the object.
|
MeasureUnit! |
withDimensionality(dimensionality: Int)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality (power). For example, if dimensionality is 2, the unit will be squared.
NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an exception is thrown. For more information, Complexity.
|
MeasureUnit! |
withPrefix(prefix: MeasureUnit.MeasurePrefix!)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix. For example, MeasurePrefix.KILO for "kilo", or MeasurePrefix.KIBI for "kibi". May return this if this unit already has that prefix.
There is sufficient locale data to format all standard prefixes.
NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will occur. For more information, Complexity.
|