2023-12-23 01:44:50 +00:00
|
|
|
/** Implementation of class NSUnit
|
2019-09-30 19:59:50 +00:00
|
|
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
2019-10-27 22:32:03 +00:00
|
|
|
|
2019-10-08 05:31:24 +00:00
|
|
|
By: Gregory John Casamento <greg.casamento@gmail.com>
|
2019-09-30 19:59:50 +00:00
|
|
|
Date: Mon Sep 30 15:58:21 EDT 2019
|
|
|
|
|
|
|
|
This file is part of the GNUstep Library.
|
2019-10-27 22:32:03 +00:00
|
|
|
|
2019-09-30 19:59:50 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
2019-10-27 22:32:03 +00:00
|
|
|
|
2019-09-30 19:59:50 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2019-12-09 23:36:00 +00:00
|
|
|
Lesser General Public License for more details.
|
2019-10-27 22:32:03 +00:00
|
|
|
|
2019-09-30 19:59:50 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free
|
2024-11-07 13:37:59 +00:00
|
|
|
Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
|
2019-09-30 19:59:50 +00:00
|
|
|
*/
|
|
|
|
|
2019-10-29 17:09:37 +00:00
|
|
|
#import "Foundation/NSArchiver.h"
|
|
|
|
#import "Foundation/NSKeyedArchiver.h"
|
|
|
|
#import "Foundation/NSUnit.h"
|
2019-09-30 19:59:50 +00:00
|
|
|
|
2019-10-07 02:33:23 +00:00
|
|
|
// Private methods...
|
|
|
|
@interface NSDimension (Private)
|
|
|
|
- (instancetype) initWithSymbol: (NSString *)symbol
|
|
|
|
coefficient: (double)coefficient
|
|
|
|
constant: (double)constant;
|
|
|
|
@end
|
|
|
|
|
2019-10-02 09:47:03 +00:00
|
|
|
// Abstract conversion...
|
2019-10-02 04:57:17 +00:00
|
|
|
@implementation NSUnitConverter
|
2019-10-27 22:32:03 +00:00
|
|
|
- (double) baseUnitValueFromValue: (double)value
|
2019-10-02 04:57:17 +00:00
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
- (double) valueFromBaseUnitValue: (double)baseUnitValue
|
2019-10-02 04:57:17 +00:00
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
@end
|
2019-09-30 19:59:50 +00:00
|
|
|
|
2019-10-02 09:47:03 +00:00
|
|
|
// Linear conversion...
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitConverterLinear
|
2019-10-02 06:05:18 +00:00
|
|
|
- (instancetype) initWithCoefficient: (double)coefficient
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return [self initWithCoefficient: coefficient constant: 0.0];
|
2019-10-02 06:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype) initWithCoefficient: (double)coefficient
|
|
|
|
constant: (double)constant
|
|
|
|
{
|
|
|
|
self = [super init];
|
2019-10-27 22:32:03 +00:00
|
|
|
if (self != nil)
|
2019-10-02 06:05:18 +00:00
|
|
|
{
|
|
|
|
_coefficient = coefficient;
|
|
|
|
_constant = constant;
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder *)coder
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
if ([coder allowsKeyedCoding])
|
2019-10-02 09:08:37 +00:00
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
_coefficient = [coder decodeDoubleForKey: @"NS.coefficient"];
|
|
|
|
_constant = [coder decodeDoubleForKey: @"NS.constant"];
|
2019-10-02 09:08:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[coder decodeValueOfObjCType: @encode(double) at: &_coefficient];
|
|
|
|
[coder decodeValueOfObjCType: @encode(double) at: &_constant];
|
|
|
|
}
|
|
|
|
return self;
|
2019-10-02 06:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) encodeWithCoder: (NSCoder *)coder
|
|
|
|
{
|
2019-10-02 09:08:37 +00:00
|
|
|
if([coder allowsKeyedCoding])
|
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
[coder encodeDouble: _coefficient forKey: @"NS.coefficient"];
|
|
|
|
[coder encodeDouble: _constant forKey: @"NS.constant"];
|
2019-10-02 09:08:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-02 09:12:07 +00:00
|
|
|
[coder encodeValueOfObjCType: @encode(double) at: &_coefficient];
|
|
|
|
[coder encodeValueOfObjCType: @encode(double) at: &_constant];
|
2019-10-02 09:08:37 +00:00
|
|
|
}
|
2019-10-02 06:05:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (double) coefficient
|
|
|
|
{
|
|
|
|
return _coefficient;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (double) constant
|
|
|
|
{
|
|
|
|
return _constant;
|
|
|
|
}
|
2019-10-08 09:05:39 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
- (double) baseUnitValueFromValue: (double)value
|
2019-10-08 09:05:39 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return (_coefficient * value) + _constant;
|
2019-10-08 09:05:39 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
- (double) valueFromBaseUnitValue: (double)baseUnitValue
|
2019-10-08 09:05:39 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return (baseUnitValue - _constant) / _coefficient;
|
2019-10-08 09:05:39 +00:00
|
|
|
}
|
2019-10-02 06:05:18 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-02 09:47:03 +00:00
|
|
|
// Abstract unit...
|
2019-10-02 04:57:17 +00:00
|
|
|
@implementation NSUnit
|
2019-10-27 22:32:03 +00:00
|
|
|
- (instancetype) init
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return [self initWithSymbol: @""];
|
2019-10-02 04:24:46 +00:00
|
|
|
}
|
2019-10-27 22:32:03 +00:00
|
|
|
|
|
|
|
- (instancetype) initWithSymbol: (NSString *)symbol
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
|
|
|
self = [super init];
|
2019-10-27 22:32:03 +00:00
|
|
|
if (self != nil)
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
|
|
|
ASSIGNCOPY(_symbol, symbol);
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder *)coder
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
if ([coder allowsKeyedCoding])
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
_symbol = [coder decodeObjectForKey: @"NS.symbol"];
|
2019-10-02 04:24:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_symbol = [coder decodeObject];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) encodeWithCoder: (NSCoder *)coder
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
if ([coder allowsKeyedCoding])
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
[coder encodeObject: _symbol forKey: @"NS.symbol"];
|
2019-10-02 04:24:46 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[coder encodeObject: _symbol];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype) copyWithZone: (NSZone *)zone
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return [[NSUnit allocWithZone: zone] initWithSymbol: [self symbol]];
|
2019-10-02 04:24:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
- (NSString *) symbol
|
2019-10-02 04:24:46 +00:00
|
|
|
{
|
|
|
|
return _symbol;
|
|
|
|
}
|
2019-09-30 19:59:50 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-02 09:08:37 +00:00
|
|
|
|
|
|
|
// Dimension using units....
|
|
|
|
@implementation NSDimension
|
|
|
|
- (NSUnitConverter *) converter
|
|
|
|
{
|
|
|
|
return _converter;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype) initWithSymbol: (NSString *)symbol converter: (NSUnitConverter *) converter
|
|
|
|
{
|
2019-10-04 08:05:34 +00:00
|
|
|
self = [super initWithSymbol: symbol];
|
2019-10-27 22:32:03 +00:00
|
|
|
if (self != nil)
|
2019-10-04 08:05:34 +00:00
|
|
|
{
|
|
|
|
ASSIGN(_converter, converter);
|
|
|
|
}
|
|
|
|
return self;
|
2019-10-02 09:08:37 +00:00
|
|
|
}
|
|
|
|
|
2019-10-07 02:33:23 +00:00
|
|
|
- (instancetype) initWithSymbol: (NSString *)symbol
|
|
|
|
coefficient: (double)coefficient
|
|
|
|
constant: (double)constant
|
|
|
|
{
|
|
|
|
NSUnitConverterLinear *converter = [[NSUnitConverterLinear alloc] initWithCoefficient: coefficient
|
|
|
|
constant: constant];
|
2019-10-24 18:38:50 +00:00
|
|
|
self = [self initWithSymbol: symbol
|
|
|
|
converter: converter];
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
RELEASE(converter);
|
2019-10-24 18:38:50 +00:00
|
|
|
return self;
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
2019-10-02 09:08:37 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return nil;
|
|
|
|
}
|
2019-10-27 22:32:03 +00:00
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder *)coder
|
|
|
|
{
|
|
|
|
self = [super initWithCoder: coder];
|
|
|
|
if ([coder allowsKeyedCoding])
|
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
_converter = [coder decodeObjectForKey: @"NS.converter"];
|
2019-10-27 22:32:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_symbol = [coder decodeObject];
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) encodeWithCoder: (NSCoder *)coder
|
|
|
|
{
|
|
|
|
[super encodeWithCoder: coder];
|
|
|
|
if ([coder allowsKeyedCoding])
|
|
|
|
{
|
2019-10-29 17:09:37 +00:00
|
|
|
[coder encodeObject: _converter forKey: @"NS.converter"];
|
2019-10-27 22:32:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[coder encodeObject: _symbol];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-02 09:08:37 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
// Predefined....
|
2019-10-06 04:37:30 +00:00
|
|
|
@implementation NSUnitAcceleration
|
2019-10-06 03:09:12 +00:00
|
|
|
|
2019-10-06 15:48:21 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self metersPerSecondSquared];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - metersPerSecondSquared
|
2019-10-06 15:48:21 +00:00
|
|
|
+ (NSUnitAcceleration *) metersPerSecondSquared
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAcceleration alloc] initWithSymbol: @"m/s^2"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-06 15:48:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitAcceleration *) gravity
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAcceleration alloc] initWithSymbol: @"g"
|
|
|
|
coefficient: 9.81
|
|
|
|
constant: 0]);
|
2019-10-06 15:48:21 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitAngle
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self degrees];
|
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
// Base unit - degrees
|
2019-10-07 02:33:23 +00:00
|
|
|
+ (NSUnitAngle *) degrees
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"deg"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitAngle *) arcMinutes
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"'"
|
|
|
|
coefficient: 0.016667
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitAngle *) arcSeconds
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"\""
|
|
|
|
coefficient: 0.00027778
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitAngle *) radians
|
2019-10-07 02:33:23 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"rad"
|
|
|
|
coefficient: 57.2958
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitAngle *) gradians
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"grad"
|
|
|
|
coefficient: 0.9
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitAngle *) revolutions
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitAngle alloc] initWithSymbol: @"rev"
|
|
|
|
coefficient: 360.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:33:23 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitArea
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self squareMeters];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - squareMeters
|
2019-10-07 02:58:47 +00:00
|
|
|
+ (NSUnitArea *) squareMegameters
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"Mm^2"
|
|
|
|
coefficient: 1e12
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareKilometers
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"km^2"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareMeters
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"m^2"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareCentimeters
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"cm^2"
|
|
|
|
coefficient: 0.0001
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareMillimeters
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"mm^2"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareMicrometers
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"um^2"
|
|
|
|
coefficient: 1e-12
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareNanometers
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"nm^2"
|
|
|
|
coefficient: 1e-18
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareInches
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"in^2"
|
|
|
|
coefficient: 0.00064516
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareFeet
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"ft^2"
|
|
|
|
coefficient: 0.092903
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareYards
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"yd^2"
|
|
|
|
coefficient: 0.836127
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) squareMiles
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"mi^2"
|
|
|
|
coefficient: 2.59e+6
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) acres
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"acres"
|
|
|
|
coefficient: 4046.86
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) ares
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"ares"
|
|
|
|
coefficient: 100.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitArea *) hectares
|
2019-10-07 02:58:47 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitArea alloc] initWithSymbol: @"hectares"
|
|
|
|
coefficient: 10000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 02:58:47 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitConcentrationMass
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self gramsPerLiter];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - gramsPerLiter
|
2019-10-07 03:22:17 +00:00
|
|
|
+ (NSUnitConcentrationMass *) gramsPerLiter
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitConcentrationMass alloc] initWithSymbol: @"g/L"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 03:22:17 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitConcentrationMass *) milligramsPerDeciliter
|
2019-10-07 03:22:17 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitConcentrationMass alloc] initWithSymbol: @"mg/dL"
|
|
|
|
coefficient: 0.01
|
|
|
|
constant: 0.0]);
|
2019-10-07 03:22:17 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitConcentrationMass *) millimolesPerLiterWithGramsPerMole:(double)gramsPerMole
|
2019-10-07 03:22:17 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitConcentrationMass alloc] initWithSymbol: @"mmol/L"
|
|
|
|
coefficient: 18.0 * gramsPerMole
|
|
|
|
constant: 0.0]);
|
2019-10-07 03:22:17 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitDispersion
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self partsPerMillion];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - partsPerMillion
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitDispersion *) partsPerMillion
|
2019-10-07 03:59:27 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitDispersion alloc] initWithSymbol: @"ppm"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitDuration
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self seconds];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - seconds
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitDuration *) seconds
|
2019-10-07 04:03:12 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitDuration alloc] initWithSymbol: @"sec"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:03:12 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitDuration *) minutes
|
2019-10-07 04:03:12 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitDuration alloc] initWithSymbol: @"min"
|
|
|
|
coefficient: 60.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:03:12 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitDuration *) hours
|
2019-10-07 04:03:12 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitDuration alloc] initWithSymbol: @"hr"
|
|
|
|
coefficient: 3600.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:03:12 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitElectricCharge
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self coulombs];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - coulombs
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) coulombs
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"C"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) megaampereHours
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"MAh"
|
|
|
|
coefficient: 3.6e9
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) kiloampereHours
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"kAh"
|
|
|
|
coefficient: 3600000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) ampereHours
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"mAh"
|
|
|
|
coefficient: 3600.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) milliampereHours
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"hr"
|
|
|
|
coefficient: 3.6
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCharge *) microampereHours
|
2019-10-07 04:15:41 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCharge alloc] initWithSymbol: @"uAh"
|
|
|
|
coefficient: 0.0036
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:15:41 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitElectricCurrent
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self amperes];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - amperes
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCurrent *) megaamperes
|
2019-10-07 04:52:13 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCurrent alloc] initWithSymbol: @"MA"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:52:13 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCurrent *) kiloamperes
|
2019-10-07 04:52:13 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCurrent alloc] initWithSymbol: @"kA"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:52:13 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricCurrent *) amperes
|
2019-10-07 04:52:13 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCurrent alloc] initWithSymbol: @"A"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:52:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitElectricCurrent *) milliamperes
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCurrent alloc] initWithSymbol: @"mA"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:52:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitElectricCurrent *) microamperes
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricCurrent alloc] initWithSymbol: @"uA"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:52:13 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitElectricPotentialDifference
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self volts];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - volts
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricPotentialDifference *) megavolts
|
2019-10-07 05:04:55 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"MV"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:04:55 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricPotentialDifference *) kilovolts
|
2019-10-07 05:04:55 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"kV"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:04:55 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricPotentialDifference *) volts
|
2019-10-07 05:04:55 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"V"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:04:55 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricPotentialDifference *) millivolts
|
2019-10-07 05:04:55 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"mV"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:04:55 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricPotentialDifference *) microvolts
|
2019-10-07 05:04:55 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"uV"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:04:55 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitElectricResistance
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self ohms];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - ohms
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricResistance *) megaohms
|
2019-10-07 05:54:16 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricResistance alloc] initWithSymbol: @"MOhm"
|
|
|
|
coefficient: 100000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:54:16 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricResistance *) kiloohms
|
2019-10-07 05:54:16 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricResistance alloc] initWithSymbol: @"kOhm"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:54:16 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricResistance *) ohms
|
2019-10-07 05:54:16 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricResistance alloc] initWithSymbol: @"Ohm"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:54:16 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricResistance *) milliohms
|
2019-10-07 05:54:16 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricResistance alloc] initWithSymbol: @"mOhm"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:54:16 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitElectricResistance *) microohms
|
2019-10-07 05:54:16 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitElectricResistance alloc] initWithSymbol: @"uOhm"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:54:16 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitEnergy
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self joules];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - joules
|
2019-10-07 07:16:01 +00:00
|
|
|
+ (NSUnitEnergy *) kilojoules
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitEnergy alloc] initWithSymbol: @"kJ"
|
2019-10-07 07:16:01 +00:00
|
|
|
coefficient: 1000.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-07 07:16:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitEnergy *) joules
|
2019-10-07 07:16:01 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitEnergy alloc] initWithSymbol: @"J"
|
2019-10-07 07:16:01 +00:00
|
|
|
coefficient: 1.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-07 07:16:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitEnergy *) kilocalories
|
2019-10-07 07:16:01 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitEnergy alloc] initWithSymbol: @"kCal"
|
2019-10-07 07:16:01 +00:00
|
|
|
coefficient: 4184.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-07 07:16:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitEnergy *) calories
|
2019-10-07 07:16:01 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitEnergy alloc] initWithSymbol: @"cal"
|
2019-10-07 07:16:01 +00:00
|
|
|
coefficient: 4.184
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-07 07:16:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitEnergy *) kilowattHours
|
2019-10-07 07:16:01 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitEnergy alloc] initWithSymbol: @"kWh"
|
2019-10-07 07:16:01 +00:00
|
|
|
coefficient: 3600000.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-07 07:16:01 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitFrequency
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self hertz];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - hertz
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) terahertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"thz"
|
|
|
|
coefficient: 1e12
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) gigahertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"ghz"
|
|
|
|
coefficient: 1e9
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) megahertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"GHz"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) kilohertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"KHz"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) hertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"Hz"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) millihertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2021-01-18 11:52:37 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"mHz"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) microhertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"uHz"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitFrequency *) nanohertz
|
2019-10-07 07:47:46 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFrequency alloc] initWithSymbol: @"nHz"
|
|
|
|
coefficient: 1e-9
|
|
|
|
constant: 0.0]);
|
2019-10-07 07:47:46 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitFuelEfficiency
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self litersPer100Kilometers];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - litersPer100Kilometers
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-08 05:03:25 +00:00
|
|
|
+ (NSUnitFuelEfficiency *) litersPer100Kilometers
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitFuelEfficiency alloc] initWithSymbol: @"L/100km"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 05:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitFuelEfficiency *) milesPerImperialGallon
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
// FIXME
|
|
|
|
return AUTORELEASE([[NSUnitFuelEfficiency alloc] initWithSymbol: @"mpg"
|
|
|
|
coefficient: 0.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 05:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitFuelEfficiency *) milesPerGallon
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
// FIXME
|
|
|
|
return AUTORELEASE([[NSUnitFuelEfficiency alloc] initWithSymbol: @"mpg"
|
|
|
|
coefficient: 0.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 05:03:25 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitLength
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self meters];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - meters
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) megameters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"Mm"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) kilometers
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"kM"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) hectometers
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"hm"
|
|
|
|
coefficient: 100.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) decameters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"dam"
|
|
|
|
coefficient: 10
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) meters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"meters"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) decimeters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"dm"
|
|
|
|
coefficient: 0.1
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) centimeters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"cm"
|
|
|
|
coefficient: 0.01
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) millimeters
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"mm"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) micrometers
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"um"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) nanometers
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"nm"
|
|
|
|
coefficient: 1e-9
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) picometers
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"pm"
|
|
|
|
coefficient: 1e-12
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) inches
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"in"
|
|
|
|
coefficient: 0.254
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) feet
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"ft"
|
|
|
|
coefficient: 0.3048
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) yards
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"yd"
|
|
|
|
coefficient: 0.9144
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) miles
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"mi"
|
|
|
|
coefficient: 1609.34
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) scandinavianMiles
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"smi"
|
|
|
|
coefficient: 10000
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) lightyears
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"ly"
|
|
|
|
coefficient: 9.461e+15
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) nauticalMiles
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"NM"
|
|
|
|
coefficient: 1852.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) fathoms
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"ftm"
|
|
|
|
coefficient: 1.8288
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) furlongs
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"fur"
|
|
|
|
coefficient: 201.168
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitLength *) astronomicalUnits
|
2019-10-08 06:28:50 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"ua"
|
|
|
|
coefficient: 1.496e+11
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitLength *) parsecs
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitLength alloc] initWithSymbol: @"pc"
|
|
|
|
coefficient: 3.086e+16
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:28:50 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitIlluminance
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self lux];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - lux
|
2019-10-07 04:23:55 +00:00
|
|
|
+ (NSUnitIlluminance *) lux
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitIlluminance alloc] initWithSymbol: @"lux"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 04:23:55 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitMass
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self kilograms];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - kilograms
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) kilograms
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"kg"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) grams
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"g"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) decigrams
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"dg"
|
|
|
|
coefficient: 0.0001
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) centigrams
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"cg"
|
|
|
|
coefficient: 0.00001
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) milligrams
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"mg"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) micrograms
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"ug"
|
|
|
|
coefficient: 1e-9
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) nanograms
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"ng"
|
|
|
|
coefficient: 1e-12
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) picograms
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"pg"
|
|
|
|
coefficient: 1e-15
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) ounces
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"oz"
|
|
|
|
coefficient: 0.0283495
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-24 21:06:06 +00:00
|
|
|
+ (NSUnitMass *) pounds
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"lb"
|
|
|
|
coefficient: 0.453592
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) stones
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"st"
|
|
|
|
coefficient: 6.35029
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) metricTons
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"t"
|
|
|
|
coefficient: 1000
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitMass *) shortTons
|
2019-10-07 06:49:28 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"ton"
|
|
|
|
coefficient: 907.185
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) carats
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"ct"
|
|
|
|
coefficient: 0.0002
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) ouncesTroy
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"oz t"
|
|
|
|
coefficient: 0.03110348
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitMass *) slugs
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitMass alloc] initWithSymbol: @"slug"
|
|
|
|
coefficient: 14.5939
|
|
|
|
constant: 0.0]);
|
2019-10-07 06:49:28 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitPower
|
2019-10-06 04:37:30 +00:00
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self watts];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - watts
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) terawatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"TW"
|
|
|
|
coefficient: 1e12
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) gigawatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"GW"
|
|
|
|
coefficient: 1e9
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) megawatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"MW"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) kilowatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"kW"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) watts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"W"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) milliwatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"mW"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) microwatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"uW"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) nanowatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"nW"
|
|
|
|
coefficient: 1e-9
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) picowatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"pW"
|
|
|
|
coefficient: 1e-12
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) femtowatts
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"fW"
|
|
|
|
coefficient: 1e-15
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPower *) horsepower
|
2019-10-07 13:57:59 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPower alloc] initWithSymbol: @"hp"
|
|
|
|
coefficient: 745.7
|
|
|
|
constant: 0.0]);
|
2019-10-07 13:57:59 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
@implementation NSUnitPressure
|
|
|
|
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self newtonsPerMetersSquared];
|
|
|
|
}
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - newtonsPerMetersSquared (equivalent to 1 pascal)
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) newtonsPerMetersSquared
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"N/m^2"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) gigapascals
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"GPa"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 1e9
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) megapascals
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"MPa"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 1000000.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) kilopascals
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"kPa"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 1000.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) hectopascals
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"hPa"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 100.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) inchesOfMercury
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"inHg"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 3386.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) bars
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"bars"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 100000.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) millibars
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"mbars"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 100.0
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) millimetersOfMercury
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"mmHg"
|
|
|
|
coefficient: 133.322
|
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitPressure *) poundsForcePerSquareInch
|
2019-10-08 05:31:24 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitPressure alloc] initWithSymbol: @"psi"
|
2019-10-08 05:31:24 +00:00
|
|
|
coefficient: 6894.76
|
2019-10-27 22:32:03 +00:00
|
|
|
constant: 0.0]);
|
2019-10-08 05:31:24 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
@implementation NSUnitSpeed
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self metersPerSecond];
|
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - metersPerSecond
|
2019-10-08 04:44:38 +00:00
|
|
|
+ (NSUnitSpeed *) metersPerSecond
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitSpeed alloc] initWithSymbol: @"m/s"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 04:44:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitSpeed *) kilometersPerHour
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitSpeed alloc] initWithSymbol: @"km/h"
|
|
|
|
coefficient: 0.277778
|
|
|
|
constant: 0.0]);
|
2019-10-08 04:44:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitSpeed *) milesPerHour
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitSpeed alloc] initWithSymbol: @"mph"
|
|
|
|
coefficient: 0.44704
|
|
|
|
constant: 0.0]);
|
2019-10-08 04:44:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitSpeed *) knots
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitSpeed alloc] initWithSymbol: @"kn"
|
|
|
|
coefficient: 0.51444
|
|
|
|
constant: 0.0]);
|
2019-10-08 04:44:38 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
@implementation NSUnitTemperature
|
2019-10-08 06:28:50 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self kelvin];
|
|
|
|
}
|
2019-10-06 04:37:30 +00:00
|
|
|
|
|
|
|
// Base unit - kelvin
|
2019-10-07 05:11:29 +00:00
|
|
|
+ (NSUnitTemperature *) kelvin
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitTemperature alloc] initWithSymbol: @"K"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-07 05:11:29 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-07 05:11:29 +00:00
|
|
|
+ (NSUnitTemperature *) celsius
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitTemperature alloc] initWithSymbol: @"C"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 273.15]);
|
2019-10-07 05:11:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSUnitTemperature *) fahrenheit
|
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitTemperature alloc] initWithSymbol: @"F"
|
|
|
|
coefficient: 0.55555555555556
|
|
|
|
constant: 255.37222222222427]);
|
2019-10-07 05:11:29 +00:00
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSUnitVolume
|
2019-10-08 06:07:20 +00:00
|
|
|
+ (instancetype) baseUnit
|
|
|
|
{
|
|
|
|
return [self liters];
|
|
|
|
}
|
2019-10-04 02:29:00 +00:00
|
|
|
|
2019-10-06 04:37:30 +00:00
|
|
|
// Base unit - liters
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) megaliters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"ML"
|
|
|
|
coefficient: 1000000.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) kiloliters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"kL"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) liters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"L"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) deciliters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"dL"
|
|
|
|
coefficient: 0.1
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) centiliters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"cL"
|
|
|
|
coefficient: 0.01
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) milliliters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"mL"
|
|
|
|
coefficient: 0.001
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicKilometers
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"km^3"
|
|
|
|
coefficient: 1e12
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicMeters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"m^3"
|
|
|
|
coefficient: 1000.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicDecimeters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"dm^3"
|
|
|
|
coefficient: 1.0
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicCentimeters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"cm^3"
|
|
|
|
coefficient: 0.0001
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicMillimeters
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"mm^3"
|
|
|
|
coefficient: 0.000001
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicInches
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2021-01-18 11:52:37 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"in^3"
|
|
|
|
coefficient: 0.0163871
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicFeet
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"ft^3"
|
|
|
|
coefficient: 28.3168
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicYards
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"yd^3"
|
|
|
|
coefficient: 764.555
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cubicMiles
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"mi^3"
|
|
|
|
coefficient: 4.168e+12
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) acreFeet
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"af"
|
|
|
|
coefficient: 1.233e+6
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) bushels
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"bsh"
|
|
|
|
coefficient: 32.2391
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) teaspoons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"tsp"
|
|
|
|
coefficient: 0.00492892
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) tablespoons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"tbsp"
|
|
|
|
coefficient: 0.0147868
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) fluidOunces
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"fl oz"
|
|
|
|
coefficient: 0.295735
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) cups
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"cups"
|
|
|
|
coefficient: 0.24
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) pints
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"pt"
|
|
|
|
coefficient: 0.473176
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) quarts
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"qt"
|
|
|
|
coefficient: 0.946353
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) gallons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"gal"
|
|
|
|
coefficient: 3.78541
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialTeaspoons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"tsp"
|
|
|
|
coefficient: 0.00591939
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialTablespoons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"tbsp"
|
|
|
|
coefficient: 0.0177582
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialFluidOunces
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"fl oz"
|
|
|
|
coefficient: 0.0284131
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialPints
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"pt"
|
|
|
|
coefficient: 0.568261
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialQuarts
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"qt"
|
|
|
|
coefficient: 1.13652
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) imperialGallons
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"gal"
|
|
|
|
coefficient: 4.54609
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 22:32:03 +00:00
|
|
|
+ (NSUnitVolume *) metricCups
|
2019-10-08 06:07:20 +00:00
|
|
|
{
|
2019-10-27 22:32:03 +00:00
|
|
|
return AUTORELEASE([[NSUnitVolume alloc] initWithSymbol: @"metric cup"
|
|
|
|
coefficient: 0.25
|
|
|
|
constant: 0.0]);
|
2019-10-08 06:07:20 +00:00
|
|
|
}
|
|
|
|
|
2019-10-04 02:29:00 +00:00
|
|
|
@end
|