diff --git a/Headers/Foundation/Foundation.h b/Headers/Foundation/Foundation.h index 9bb48ab71..d27814223 100644 --- a/Headers/Foundation/Foundation.h +++ b/Headers/Foundation/Foundation.h @@ -55,12 +55,14 @@ #import #import #import +#import #import #import #import #import #import #import +#import #import #import #import @@ -86,6 +88,7 @@ #import #import #import +#import #import #import #import @@ -138,6 +141,7 @@ #import #import #import +#import #import #import #import diff --git a/Headers/Foundation/MISSING b/Headers/Foundation/MISSING index a64d088bf..98a92d009 100644 --- a/Headers/Foundation/MISSING +++ b/Headers/Foundation/MISSING @@ -20,9 +20,6 @@ NSAppleEventDescriptor.h NSAppleEventManager.h NSBackgroundActivityScheduler.h NSDateComponentsFormatter.h -NSDateIntervalFormatter.h -NSDateInterval.h -NSEnergyFormatter.h NSExtensionContext.h NSExtensionItem.h NSExtensionRequestHandling.h @@ -30,44 +27,10 @@ NSHFSFileTypes.h NSISO8601DateFormatter.h NSItemProvider.h NSItemProviderReadingWriting.h -NSLengthFormatter.h NSLinguisticTagger.h -NSMassFormatter.h -NSMeasurementFormatter.h -NSMeasurement.h NSMetadataAttributes.h NSObjectScripting.h NSOrthography.h -NSUnit.h -NSUserActivity.h -NSXPCConnection.h -------------------------------------------------------------- -Foundation: -== -FoundationLegacySwiftCompatibility.h -NSAppleEventDescriptor.h -NSAppleEventManager.h -NSBackgroundActivityScheduler.h -NSDateComponentsFormatter.h -NSDateIntervalFormatter.h -NSDateInterval.h -NSEnergyFormatter.h -NSExtensionContext.h -NSExtensionItem.h -NSExtensionRequestHandling.h -NSHFSFileTypes.h -NSISO8601DateFormatter.h -NSItemProvider.h -NSItemProviderReadingWriting.h -NSLengthFormatter.h -NSLinguisticTagger.h -NSMassFormatter.h -NSMeasurementFormatter.h -NSMeasurement.h -NSMetadataAttributes.h -NSObjectScripting.h -NSOrthography.h -NSUnit.h NSUserActivity.h NSXPCConnection.h diff --git a/Headers/Foundation/NSDateInterval.h b/Headers/Foundation/NSDateInterval.h new file mode 100644 index 000000000..f97c94972 --- /dev/null +++ b/Headers/Foundation/NSDateInterval.h @@ -0,0 +1,86 @@ + +/* Definition of class NSDateInterval + Copyright (C) 2019 Free Software Foundation, Inc. + + By: Gregory Casamento + Date: Wed Oct 9 16:24:13 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSDateInterval_h_GNUSTEP_BASE_INCLUDE +#define _NSDateInterval_h_GNUSTEP_BASE_INCLUDE + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST) + +@interface NSDateInterval : NSObject +{ + NSTimeInterval _duration; + NSDate *_startDate; + NSDate *_endDate; +} + +// Init +- (instancetype) init; + +- (instancetype) initWithStartDate: (NSDate *)startDate + duration: (NSTimeInterval)duration; + +- (instancetype) initWithStartDate: (NSDate *)startDate + endDate: (NSDate *)endDate; + +// Access +- (NSDate *) startDate; +- (void) setStartDate: (NSDate *)startDate; + +- (NSDate *) endDate; +- (void) setEndDate: (NSDate *)endDate; + +- (NSTimeInterval)duration; +- (void) setDuration: (NSTimeInterval)duration; + +// Compare +- (NSComparisonResult) compare: (NSDateInterval *)dateInterval; + +- (BOOL) isEqualToDateInterval: (NSDateInterval *)dateInterval; + +// Determine +- (BOOL) intersectsDateInterval: (NSDateInterval *)dateInterval; + +- (NSDateInterval *) intersectionWithDateInterval: (NSDateInterval *)dateInterval; + +// Contain +- (BOOL) containsDate: (NSDate *)date; + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSDateInterval_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Headers/Foundation/NSDateIntervalFormatter.h b/Headers/Foundation/NSDateIntervalFormatter.h new file mode 100644 index 000000000..c04fc1b62 --- /dev/null +++ b/Headers/Foundation/NSDateIntervalFormatter.h @@ -0,0 +1,48 @@ + +/* Definition of class NSDateIntervalFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:23:55 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE +#define _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) + +@interface NSDateIntervalFormatter : NSFormatter + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Headers/Foundation/NSEnergyFormatter.h b/Headers/Foundation/NSEnergyFormatter.h new file mode 100644 index 000000000..e0bc27fc2 --- /dev/null +++ b/Headers/Foundation/NSEnergyFormatter.h @@ -0,0 +1,48 @@ + +/* Definition of class NSEnergyFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Tue Oct 8 13:30:10 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSEnergyFormatter_h_GNUSTEP_BASE_INCLUDE +#define _NSEnergyFormatter_h_GNUSTEP_BASE_INCLUDE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) + +@interface NSEnergyFormatter : NSFormatter + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSEnergyFormatter_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Headers/Foundation/NSLengthFormatter.h b/Headers/Foundation/NSLengthFormatter.h new file mode 100644 index 000000000..417eb659d --- /dev/null +++ b/Headers/Foundation/NSLengthFormatter.h @@ -0,0 +1,48 @@ + +/* Definition of class NSLengthFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Tue Oct 8 13:30:33 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE +#define _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) + +@interface NSLengthFormatter : NSFormatter + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Headers/Foundation/NSMeasurement.h b/Headers/Foundation/NSMeasurement.h index d95c14239..7f9abdc45 100644 --- a/Headers/Foundation/NSMeasurement.h +++ b/Headers/Foundation/NSMeasurement.h @@ -2,7 +2,7 @@ /* Definition of class NSMeasurement Copyright (C) 2019 Free Software Foundation, Inc. - By: heron + By: Gregory John Casamento Date: Mon Sep 30 15:58:21 EDT 2019 This file is part of the GNUstep Library. @@ -27,6 +27,7 @@ #define _NSMeasurement_h_GNUSTEP_BASE_INCLUDE #include +#include #if defined(__cplusplus) extern "C" { @@ -34,7 +35,33 @@ extern "C" { #if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) -@interface NSMeasurement : NSObject +@class NSUnit; + +@interface NSMeasurement : NSObject +{ + NSUnit *_unit; + double _doubleValue; +} + +// Creating Measurements +- (instancetype)initWithDoubleValue: (double)doubleValue + unit: (NSUnit *)unit; + + +// Accessing unit and value +- (NSUnit *) unit; + +- (double) doubleValue; + +// Conversion +- (BOOL) canBeConvertedToUnit: (NSUnit *)unit; + +- (NSMeasurement *)measurementByConvertingToUnit:(NSUnit *)unit; + +// Operating +- (NSMeasurement *)measurementByAddingMeasurement:(NSMeasurement *)measurement; + +- (NSMeasurement *)measurementBySubtractingMeasurement:(NSMeasurement *)measurement; @end diff --git a/Headers/Foundation/NSMeasurementFormatter.h b/Headers/Foundation/NSMeasurementFormatter.h index d9ae8edd6..1e293e043 100644 --- a/Headers/Foundation/NSMeasurementFormatter.h +++ b/Headers/Foundation/NSMeasurementFormatter.h @@ -26,15 +26,47 @@ #ifndef _NSMeasurementFormatter_h_GNUSTEP_BASE_INCLUDE #define _NSMeasurementFormatter_h_GNUSTEP_BASE_INCLUDE -#include - #if defined(__cplusplus) extern "C" { #endif + +#include +#include -#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) + @class NSLocale, NSMeasurement, NSNumberFormatter, NSUnit; + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST) -@interface NSMeasurementFormatter : NSObject +enum { + NSMeasurementFormatterUnitOptionsProvidedUnit = (1UL << 0), + NSMeasurementFormatterUnitOptionsNaturalScale = (1UL << 1), + NSMeasurementFormatterUnitOptionsTemperatureWithoutUnit = (1UL << 2), +}; +typedef NSUInteger NSMeasurementFormatterUnitOptions; + +@interface NSMeasurementFormatter : NSFormatter +{ + NSMeasurementFormatterUnitOptions _unitOptions; + NSFormattingUnitStyle _unitStyle; + NSLocale *_locale; + NSNumberFormatter *_numberFormatter; +} + +- (NSMeasurementFormatterUnitOptions) unitOptions; +- (void) setUnitOptions: (NSMeasurementFormatterUnitOptions) unitOptions; + +- (NSFormattingUnitStyle) unitStyle; +- (void) setUnitStyle: (NSFormattingUnitStyle)style; + +- (NSLocale *) locale; +- (void) setLocale: (NSLocale *)locale; + +- (NSNumberFormatter *) numberFormatter; +- (void) setNumberFormatter: (NSNumberFormatter *)numberFormatter; + +- (NSString *)stringFromMeasurement: (NSMeasurement *)measurement; + +- (NSString *)stringFromUnit: (NSUnit *)unit; @end diff --git a/Headers/Foundation/NSUnit.h b/Headers/Foundation/NSUnit.h index 94b6e518b..b7627c2aa 100644 --- a/Headers/Foundation/NSUnit.h +++ b/Headers/Foundation/NSUnit.h @@ -68,7 +68,7 @@ extern "C" { // Dimension using units.... @interface NSDimension : NSUnit { - NSUInteger _reserved; + double _value; NSUnitConverter *_converter; } @@ -84,8 +84,8 @@ extern "C" { Base unit - metersPerSecondSquared */ -- (NSUnitAcceleration *) metersPerSecondSquared; -- (NSUnitAcceleration *) gravity; ++ (NSUnitAcceleration *) metersPerSecondSquared; ++ (NSUnitAcceleration *) gravity; @end @@ -94,12 +94,12 @@ extern "C" { Base unit - degrees */ -- (NSUnitAngle *) degrees; -- (NSUnitAngle *) arcMinutes; -- (NSUnitAngle *) arcSeconds; -- (NSUnitAngle *) radians; -- (NSUnitAngle *) gradians; -- (NSUnitAngle *) revolutions; ++ (NSUnitAngle *) degrees; ++ (NSUnitAngle *) arcMinutes; ++ (NSUnitAngle *) arcSeconds; ++ (NSUnitAngle *) radians; ++ (NSUnitAngle *) gradians; ++ (NSUnitAngle *) revolutions; @end @@ -108,20 +108,20 @@ extern "C" { Base unit - squareMeters */ -- (NSUnitArea *) squareMegameters; -- (NSUnitArea *) squareKilometers; -- (NSUnitArea *) squareMeters; -- (NSUnitArea *) squareCentimeters; -- (NSUnitArea *) squareMillimeters; -- (NSUnitArea *) squareMicrometers; -- (NSUnitArea *) squareNanometers; -- (NSUnitArea *) squareInches; -- (NSUnitArea *) squareFeet; -- (NSUnitArea *) squareYards; -- (NSUnitArea *) squareMiles; -- (NSUnitArea *) acres; -- (NSUnitArea *) ares; -- (NSUnitArea *) hectares; ++ (NSUnitArea *) squareMegameters; ++ (NSUnitArea *) squareKilometers; ++ (NSUnitArea *) squareMeters; ++ (NSUnitArea *) squareCentimeters; ++ (NSUnitArea *) squareMillimeters; ++ (NSUnitArea *) squareMicrometers; ++ (NSUnitArea *) squareNanometers; ++ (NSUnitArea *) squareInches; ++ (NSUnitArea *) squareFeet; ++ (NSUnitArea *) squareYards; ++ (NSUnitArea *) squareMiles; ++ (NSUnitArea *) acres; ++ (NSUnitArea *) ares; ++ (NSUnitArea *) hectares; @end @@ -130,8 +130,8 @@ extern "C" { Base unit - gramsPerLiter */ -- (NSUnitConcentrationMass *) gramsPerLiter; -- (NSUnitConcentrationMass *) milligramsPerDeciliter; ++ (NSUnitConcentrationMass *) gramsPerLiter; ++ (NSUnitConcentrationMass *) milligramsPerDeciliter; + (NSUnitConcentrationMass *) millimolesPerLiterWithGramsPerMole:(double)gramsPerMole; @@ -141,7 +141,7 @@ extern "C" { /* Base unit - partsPerMillion */ -- (NSUnitDispersion *) partsPerMillion; ++ (NSUnitDispersion *) partsPerMillion; @end @@ -150,9 +150,9 @@ extern "C" { Base unit - seconds */ -- (NSUnitDuration *) seconds; -- (NSUnitDuration *) minutes; -- (NSUnitDuration *) hours; ++ (NSUnitDuration *) seconds; ++ (NSUnitDuration *) minutes; ++ (NSUnitDuration *) hours; @end @@ -161,12 +161,12 @@ extern "C" { Base unit - coulombs */ -- (NSUnitElectricCharge *) coulombs; -- (NSUnitElectricCharge *) megaampereHours; -- (NSUnitElectricCharge *) kiloampereHours; -- (NSUnitElectricCharge *) ampereHours; -- (NSUnitElectricCharge *) milliampereHours; -- (NSUnitElectricCharge *) microampereHours; ++ (NSUnitElectricCharge *) coulombs; ++ (NSUnitElectricCharge *) megaampereHours; ++ (NSUnitElectricCharge *) kiloampereHours; ++ (NSUnitElectricCharge *) ampereHours; ++ (NSUnitElectricCharge *) milliampereHours; ++ (NSUnitElectricCharge *) microampereHours; @end @@ -175,11 +175,11 @@ extern "C" { Base unit - amperes */ -- (NSUnitElectricCurrent *) megaamperes; -- (NSUnitElectricCurrent *) kiloamperes; -- (NSUnitElectricCurrent *) amperes; -- (NSUnitElectricCurrent *) milliamperes; -- (NSUnitElectricCurrent *) microamperes; ++ (NSUnitElectricCurrent *) megaamperes; ++ (NSUnitElectricCurrent *) kiloamperes; ++ (NSUnitElectricCurrent *) amperes; ++ (NSUnitElectricCurrent *) milliamperes; ++ (NSUnitElectricCurrent *) microamperes; @end @@ -188,11 +188,11 @@ extern "C" { Base unit - volts */ -- (NSUnitElectricPotentialDifference *) megavolts; -- (NSUnitElectricPotentialDifference *) kilovolts; -- (NSUnitElectricPotentialDifference *) volts; -- (NSUnitElectricPotentialDifference *) millivolts; -- (NSUnitElectricPotentialDifference *) microvolts; ++ (NSUnitElectricPotentialDifference *) megavolts; ++ (NSUnitElectricPotentialDifference *) kilovolts; ++ (NSUnitElectricPotentialDifference *) volts; ++ (NSUnitElectricPotentialDifference *) millivolts; ++ (NSUnitElectricPotentialDifference *) microvolts; @end @@ -201,11 +201,11 @@ extern "C" { Base unit - ohms */ -- (NSUnitElectricResistance *) megaohms; -- (NSUnitElectricResistance *) kiloohms; -- (NSUnitElectricResistance *) ohms; -- (NSUnitElectricResistance *) milliohms; -- (NSUnitElectricResistance *) microohms; ++ (NSUnitElectricResistance *) megaohms; ++ (NSUnitElectricResistance *) kiloohms; ++ (NSUnitElectricResistance *) ohms; ++ (NSUnitElectricResistance *) milliohms; ++ (NSUnitElectricResistance *) microohms; @end @@ -214,11 +214,11 @@ extern "C" { Base unit - joules */ -- (NSUnitEnergy *) kilojoules; -- (NSUnitEnergy *) joules; -- (NSUnitEnergy *) kilocalories; -- (NSUnitEnergy *) calories; -- (NSUnitEnergy *) kilowattHours; ++ (NSUnitEnergy *) kilojoules; ++ (NSUnitEnergy *) joules; ++ (NSUnitEnergy *) kilocalories; ++ (NSUnitEnergy *) calories; ++ (NSUnitEnergy *) kilowattHours; @end @@ -227,14 +227,14 @@ extern "C" { Base unit - hertz */ -- (NSUnitFrequency *) terahertz; -- (NSUnitFrequency *) gigahertz; -- (NSUnitFrequency *) megahertz; -- (NSUnitFrequency *) kilohertz; -- (NSUnitFrequency *) hertz; -- (NSUnitFrequency *) millihertz; -- (NSUnitFrequency *) microhertz; -- (NSUnitFrequency *) nanohertz; ++ (NSUnitFrequency *) terahertz; ++ (NSUnitFrequency *) gigahertz; ++ (NSUnitFrequency *) megahertz; ++ (NSUnitFrequency *) kilohertz; ++ (NSUnitFrequency *) hertz; ++ (NSUnitFrequency *) millihertz; ++ (NSUnitFrequency *) microhertz; ++ (NSUnitFrequency *) nanohertz; @end @@ -243,9 +243,9 @@ extern "C" { Base unit - litersPer100Kilometers */ -- (NSUnitFuelEfficiency *) litersPer100Kilometers; -- (NSUnitFuelEfficiency *) milesPerImperialGallon; -- (NSUnitFuelEfficiency *) milesPerGallon; ++ (NSUnitFuelEfficiency *) litersPer100Kilometers; ++ (NSUnitFuelEfficiency *) milesPerImperialGallon; ++ (NSUnitFuelEfficiency *) milesPerGallon; @end @@ -254,28 +254,28 @@ extern "C" { Base unit - meters */ -- (NSUnitLength *) megameters; -- (NSUnitLength *) kilometers; -- (NSUnitLength *) hectometers; -- (NSUnitLength *) decameters; -- (NSUnitLength *) meters; -- (NSUnitLength *) decimeters; -- (NSUnitLength *) centimeters; -- (NSUnitLength *) millimeters; -- (NSUnitLength *) micrometers; -- (NSUnitLength *) nanometers; -- (NSUnitLength *) picometers; -- (NSUnitLength *) inches; -- (NSUnitLength *) feet; -- (NSUnitLength *) yards; -- (NSUnitLength *) miles; -- (NSUnitLength *) scandinavianMiles; -- (NSUnitLength *) lightyears; -- (NSUnitLength *) nauticalMiles; -- (NSUnitLength *) fathoms; -- (NSUnitLength *) furlongs; -- (NSUnitLength *) astronomicalUnits; -- (NSUnitLength *) parsecs; ++ (NSUnitLength *) megameters; ++ (NSUnitLength *) kilometers; ++ (NSUnitLength *) hectometers; ++ (NSUnitLength *) decameters; ++ (NSUnitLength *) meters; ++ (NSUnitLength *) decimeters; ++ (NSUnitLength *) centimeters; ++ (NSUnitLength *) millimeters; ++ (NSUnitLength *) micrometers; ++ (NSUnitLength *) nanometers; ++ (NSUnitLength *) picometers; ++ (NSUnitLength *) inches; ++ (NSUnitLength *) feet; ++ (NSUnitLength *) yards; ++ (NSUnitLength *) miles; ++ (NSUnitLength *) scandinavianMiles; ++ (NSUnitLength *) lightyears; ++ (NSUnitLength *) nauticalMiles; ++ (NSUnitLength *) fathoms; ++ (NSUnitLength *) furlongs; ++ (NSUnitLength *) astronomicalUnits; ++ (NSUnitLength *) parsecs; @end @@ -284,7 +284,7 @@ extern "C" { Base unit - lux */ -- (NSUnitIlluminance *) lux; ++ (NSUnitIlluminance *) lux; @end @@ -293,22 +293,22 @@ extern "C" { Base unit - kilograms */ -- (NSUnitMass *) kilograms; -- (NSUnitMass *) grams; -- (NSUnitMass *) decigrams; -- (NSUnitMass *) centigrams; -- (NSUnitMass *) milligrams; -- (NSUnitMass *) micrograms; -- (NSUnitMass *) nanograms; -- (NSUnitMass *) picograms; -- (NSUnitMass *) ounces; -- (NSUnitMass *) poundsMass; -- (NSUnitMass *) stones; -- (NSUnitMass *) metricTons; -- (NSUnitMass *) shortTons; -- (NSUnitMass *) carats; -- (NSUnitMass *) ouncesTroy; -- (NSUnitMass *) slugs; ++ (NSUnitMass *) kilograms; ++ (NSUnitMass *) grams; ++ (NSUnitMass *) decigrams; ++ (NSUnitMass *) centigrams; ++ (NSUnitMass *) milligrams; ++ (NSUnitMass *) micrograms; ++ (NSUnitMass *) nanograms; ++ (NSUnitMass *) picograms; ++ (NSUnitMass *) ounces; ++ (NSUnitMass *) poundsMass; ++ (NSUnitMass *) stones; ++ (NSUnitMass *) metricTons; ++ (NSUnitMass *) shortTons; ++ (NSUnitMass *) carats; ++ (NSUnitMass *) ouncesTroy; ++ (NSUnitMass *) slugs; @end @@ -317,17 +317,17 @@ extern "C" { Base unit - watts */ -- (NSUnitPower *) terawatts; -- (NSUnitPower *) gigawatts; -- (NSUnitPower *) megawatts; -- (NSUnitPower *) kilowatts; -- (NSUnitPower *) watts; -- (NSUnitPower *) milliwatts; -- (NSUnitPower *) microwatts; -- (NSUnitPower *) nanowatts; -- (NSUnitPower *) picowatts; -- (NSUnitPower *) femtowatts; -- (NSUnitPower *) horsepower; ++ (NSUnitPower *) terawatts; ++ (NSUnitPower *) gigawatts; ++ (NSUnitPower *) megawatts; ++ (NSUnitPower *) kilowatts; ++ (NSUnitPower *) watts; ++ (NSUnitPower *) milliwatts; ++ (NSUnitPower *) microwatts; ++ (NSUnitPower *) nanowatts; ++ (NSUnitPower *) picowatts; ++ (NSUnitPower *) femtowatts; ++ (NSUnitPower *) horsepower; @end @@ -336,16 +336,16 @@ extern "C" { Base unit - newtonsPerMetersSquared (equivalent to 1 pascal) */ -- (NSUnitPressure *) newtonsPerMetersSquared; -- (NSUnitPressure *) gigapascals; -- (NSUnitPressure *) megapascals; -- (NSUnitPressure *) kilopascals; -- (NSUnitPressure *) hectopascals; -- (NSUnitPressure *) inchesOfMercury; -- (NSUnitPressure *) bars; -- (NSUnitPressure *) millibars; -- (NSUnitPressure *) millimetersOfMercury; -- (NSUnitPressure *) poundsForcePerSquareInch; ++ (NSUnitPressure *) newtonsPerMetersSquared; ++ (NSUnitPressure *) gigapascals; ++ (NSUnitPressure *) megapascals; ++ (NSUnitPressure *) kilopascals; ++ (NSUnitPressure *) hectopascals; ++ (NSUnitPressure *) inchesOfMercury; ++ (NSUnitPressure *) bars; ++ (NSUnitPressure *) millibars; ++ (NSUnitPressure *) millimetersOfMercury; ++ (NSUnitPressure *) poundsForcePerSquareInch; @end @@ -354,10 +354,10 @@ extern "C" { Base unit - metersPerSecond */ -- (NSUnitSpeed *) metersPerSecond; -- (NSUnitSpeed *) kilometersPerHour; -- (NSUnitSpeed *) milesPerHour; -- (NSUnitSpeed *) knots; ++ (NSUnitSpeed *) metersPerSecond; ++ (NSUnitSpeed *) kilometersPerHour; ++ (NSUnitSpeed *) milesPerHour; ++ (NSUnitSpeed *) knots; @end @@ -365,9 +365,9 @@ extern "C" { /* Base unit - kelvin */ -- (NSUnitTemperature *) kelvin; -- (NSUnitTemperature *) celsius; -- (NSUnitTemperature *) fahrenheit; ++ (NSUnitTemperature *) kelvin; ++ (NSUnitTemperature *) celsius; ++ (NSUnitTemperature *) fahrenheit; @end @@ -377,37 +377,37 @@ extern "C" { Base unit - liters */ -- (NSUnitVolume *) megaliters; -- (NSUnitVolume *) kiloliters; -- (NSUnitVolume *) liters; -- (NSUnitVolume *) deciliters; -- (NSUnitVolume *) centiliters; -- (NSUnitVolume *) milliliters; -- (NSUnitVolume *) cubicKilometers; -- (NSUnitVolume *) cubicMeters; -- (NSUnitVolume *) cubicDecimeters; -- (NSUnitVolume *) cubicCentimeters; -- (NSUnitVolume *) cubicMillimeters; -- (NSUnitVolume *) cubicInches; -- (NSUnitVolume *) cubicFeet; -- (NSUnitVolume *) cubicYards; -- (NSUnitVolume *) cubicMiles; -- (NSUnitVolume *) acreFeet; -- (NSUnitVolume *) bushels; -- (NSUnitVolume *) teaspoons; -- (NSUnitVolume *) tablespoons; -- (NSUnitVolume *) fluidOunces; -- (NSUnitVolume *) cups; -- (NSUnitVolume *) pints; -- (NSUnitVolume *) quarts; -- (NSUnitVolume *) gallons; -- (NSUnitVolume *) imperialTeaspoons; -- (NSUnitVolume *) imperialTablespoons; -- (NSUnitVolume *) imperialFluidOunces; -- (NSUnitVolume *) imperialPints; -- (NSUnitVolume *) imperialQuarts; -- (NSUnitVolume *) imperialGallons; -- (NSUnitVolume *) metricCups; ++ (NSUnitVolume *) megaliters; ++ (NSUnitVolume *) kiloliters; ++ (NSUnitVolume *) liters; ++ (NSUnitVolume *) deciliters; ++ (NSUnitVolume *) centiliters; ++ (NSUnitVolume *) milliliters; ++ (NSUnitVolume *) cubicKilometers; ++ (NSUnitVolume *) cubicMeters; ++ (NSUnitVolume *) cubicDecimeters; ++ (NSUnitVolume *) cubicCentimeters; ++ (NSUnitVolume *) cubicMillimeters; ++ (NSUnitVolume *) cubicInches; ++ (NSUnitVolume *) cubicFeet; ++ (NSUnitVolume *) cubicYards; ++ (NSUnitVolume *) cubicMiles; ++ (NSUnitVolume *) acreFeet; ++ (NSUnitVolume *) bushels; ++ (NSUnitVolume *) teaspoons; ++ (NSUnitVolume *) tablespoons; ++ (NSUnitVolume *) fluidOunces; ++ (NSUnitVolume *) cups; ++ (NSUnitVolume *) pints; ++ (NSUnitVolume *) quarts; ++ (NSUnitVolume *) gallons; ++ (NSUnitVolume *) imperialTeaspoons; ++ (NSUnitVolume *) imperialTablespoons; ++ (NSUnitVolume *) imperialFluidOunces; ++ (NSUnitVolume *) imperialPints; ++ (NSUnitVolume *) imperialQuarts; ++ (NSUnitVolume *) imperialGallons; ++ (NSUnitVolume *) metricCups; @end diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 27cd54257..541d30f64 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -213,6 +213,7 @@ NSConnection.m \ NSData.m \ NSDate.m \ NSDateFormatter.m \ +NSDateInterval.m \ NSDebug.m \ NSDecimal.m \ NSDecimalNumber.m \ @@ -220,6 +221,7 @@ NSDictionary.m \ NSDistantObject.m \ NSDistributedLock.m \ NSDistributedNotificationCenter.m \ +NSEnergyFormatter.m \ NSEnumerator.m \ NSError.m \ NSException.m \ @@ -244,6 +246,7 @@ NSKeyedArchiver.m \ NSKeyedUnarchiver.m \ NSKeyValueCoding.m \ NSKeyValueObserving.m \ +NSLengthFormatter.m \ NSLocale.m \ NSLock.m \ NSLog.m \ @@ -405,6 +408,7 @@ NSCompoundPredicate.h \ NSConnection.h \ NSData.h \ NSDateFormatter.h \ +NSDateInterval.h \ NSDate.h \ NSDebug.h \ NSDecimal.h \ @@ -413,6 +417,7 @@ NSDictionary.h \ NSDistantObject.h \ NSDistributedLock.h \ NSDistributedNotificationCenter.h \ +NSEnergyFormatter.h \ NSEnumerator.h \ NSError.h \ NSErrorRecoveryAttempting.h \ @@ -439,6 +444,7 @@ NSJSONSerialization.h \ NSKeyedArchiver.h \ NSKeyValueCoding.h \ NSKeyValueObserving.h \ +NSLengthFormtter.h \ NSLocale.h \ NSLock.h \ NSMapTable.h \ diff --git a/Source/NSDateInterval.m b/Source/NSDateInterval.m new file mode 100644 index 000000000..b17489a96 --- /dev/null +++ b/Source/NSDateInterval.m @@ -0,0 +1,217 @@ + +/* Implementation of class NSDateInterval + Copyright (C) 2019 Free Software Foundation, Inc. + + By: Gregory Casamento + Date: Wed Oct 9 16:24:13 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include +#include +#include + +@implementation NSDateInterval + +// Init +- (instancetype)init +{ + self = [super init]; + if(self != nil) + { + _startDate = nil; + _duration = 0.0; + } + return self; +} + +- (instancetype)initWithStartDate:(NSDate *)startDate + duration:(NSTimeInterval)duration +{ + self = [super init]; + if(self != nil) + { + ASSIGNCOPY(_startDate, startDate); + ASSIGNCOPY(_endDate, [startDate dateByAddingTimeInterval: duration]); + _duration = duration; + } + return self; +} + +- (instancetype)initWithStartDate:(NSDate *)startDate + endDate:(NSDate *)endDate +{ + self = [super init]; + if(self != nil) + { + ASSIGNCOPY(_startDate, startDate); + ASSIGNCOPY(_endDate, endDate); + _duration = [endDate timeIntervalSinceDate: startDate]; + } + return self; +} + +- (instancetype) initWithCoder: (NSCoder *)coder +{ + return nil; +} + +- (void) encodeWithCoder: (NSCoder *)coder +{ +} + +- (id) copyWithZone: (NSZone *)zone +{ + return [[[self class] allocWithZone: zone] + initWithStartDate: _startDate + duration: _duration]; +} + +- (void) dealloc +{ + RELEASE(_startDate); + [super dealloc]; +} + +// Access +- (NSDate *) startDate +{ + return _startDate; +} + +- (void) setStartDate: (NSDate *)startDate +{ + ASSIGNCOPY(_startDate, startDate); +} + +- (NSDate *) endDate +{ + return _endDate; +} + +- (void) setEndDate: (NSDate *)endDate +{ + ASSIGNCOPY(_endDate, endDate); + _duration = [endDate timeIntervalSinceDate: _startDate]; +} + +- (NSTimeInterval) duration +{ + return _duration; +} + +- (void) setDuration: (NSTimeInterval)duration +{ + NSDate *newEndDate = [_startDate dateByAddingTimeInterval: duration]; + _duration = duration; + [self setEndDate: newEndDate]; +} + +// Compare +- (NSComparisonResult) compare: (NSDateInterval *)dateInterval +{ + // NSOrderedAscending + if([_startDate isEqualToDate: [dateInterval startDate]] && + _duration < [dateInterval duration]) + return NSOrderedAscending; + + if([_startDate compare: [dateInterval startDate]] == NSOrderedAscending) + return NSOrderedAscending; + + // NSOrderedSame + if([self isEqualToDateInterval: dateInterval]) + return NSOrderedSame; + + // NSOrderedDescending + if([_startDate isEqualToDate: [dateInterval startDate]] && + _duration > [dateInterval duration]) + return NSOrderedDescending; + + if([_startDate compare: [dateInterval startDate]] == NSOrderedDescending) + return NSOrderedDescending; + + return 0; +} + +- (BOOL) isEqualToDateInterval: (NSDateInterval *)dateInterval +{ + return ([_startDate isEqualToDate: [dateInterval startDate]] && + _duration == [dateInterval duration]); +} + +// Determine +- (BOOL) intersectsDateInterval: (NSDateInterval *)dateInterval +{ + return [self intersectionWithDateInterval: dateInterval] != nil; +} + +- (NSDateInterval *) intersectionWithDateInterval: (NSDateInterval *)dateInterval +{ + NSDateInterval *result = nil; + NSArray *array = [NSArray arrayWithObjects: self, dateInterval, nil]; + NSArray *sortedArray = [array sortedArrayUsingSelector: @selector(compare:)]; + NSDateInterval *first = [sortedArray firstObject]; + NSDateInterval *last = [sortedArray lastObject]; + NSDate *intersectStartDate = nil; + NSDate *intersectEndDate = nil; + + // Max of start date.... + if([[first startDate] compare: [last startDate]] == NSOrderedAscending || + [[first startDate] isEqualToDate: [last startDate]]) + { + intersectStartDate = [last startDate]; + } + if([[first startDate] compare: [last startDate]] == NSOrderedDescending) + { + intersectStartDate = [first startDate]; + } + + // Min of end date... + if([[first endDate] compare: [last endDate]] == NSOrderedDescending || + [[first endDate] isEqualToDate: [last endDate]]) + { + intersectEndDate = [last endDate]; + } + if([[first endDate] compare: [last endDate]] == NSOrderedAscending) + { + intersectEndDate = [first endDate]; + } + + if([intersectStartDate compare: intersectEndDate] == NSOrderedAscending) + { + result = [[NSDateInterval alloc] initWithStartDate: intersectStartDate + endDate: intersectEndDate]; + AUTORELEASE(result); + } + + return result; +} + +// Contain +- (BOOL) containsDate: (NSDate *)date +{ + return ([_startDate compare: date] == NSOrderedSame || + [_endDate compare: date] == NSOrderedSame || + ([_startDate compare: date] == NSOrderedAscending && + [_endDate compare: date] == NSOrderedDescending)); + +} + +@end + diff --git a/Source/NSDateIntervalFormatter.m b/Source/NSDateIntervalFormatter.m new file mode 100644 index 000000000..0ca18904f --- /dev/null +++ b/Source/NSDateIntervalFormatter.m @@ -0,0 +1,31 @@ + +/* Implementation of class NSDateIntervalFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:23:55 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include + +@implementation NSDateIntervalFormatter + +@end + diff --git a/Source/NSEnergyFormatter.m b/Source/NSEnergyFormatter.m new file mode 100644 index 000000000..45b254d66 --- /dev/null +++ b/Source/NSEnergyFormatter.m @@ -0,0 +1,31 @@ + +/* Implementation of class NSEnergyFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Tue Oct 8 13:30:10 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include + +@implementation NSEnergyFormatter + +@end + diff --git a/Source/NSLengthFormatter.m b/Source/NSLengthFormatter.m new file mode 100644 index 000000000..abd70ae10 --- /dev/null +++ b/Source/NSLengthFormatter.m @@ -0,0 +1,31 @@ + +/* Implementation of class NSLengthFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Tue Oct 8 13:30:33 EDT 2019 + + This file is part of the GNUstep Library. + + 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. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include + +@implementation NSLengthFormatter + +@end + diff --git a/Source/NSMeasurement.m b/Source/NSMeasurement.m index 91917bb94..57b26e904 100644 --- a/Source/NSMeasurement.m +++ b/Source/NSMeasurement.m @@ -2,7 +2,7 @@ /* Implementation of class NSMeasurement Copyright (C) 2019 Free Software Foundation, Inc. - By: heron + By: Gregory John Casamento Date: Mon Sep 30 15:58:21 EDT 2019 This file is part of the GNUstep Library. @@ -24,8 +24,134 @@ */ #include +#include +#include +#include +#include @implementation NSMeasurement +// Creating Measurements +- (instancetype)initWithDoubleValue: (double)doubleValue + unit: (NSUnit *)unit +{ + self = [super init]; + if(self != nil) + { + ASSIGNCOPY(_unit, unit); + _doubleValue = doubleValue; + } + return self; +} +- (void) dealloc +{ + RELEASE(_unit); + [super dealloc]; +} + +// Accessing unit and value +- (NSUnit *) unit +{ + return _unit; +} + +- (double) doubleValue +{ + return _doubleValue; +} + +// Conversion +- (BOOL) canBeConvertedToUnit: (NSUnit *)unit +{ + return ([unit isKindOfClass: [_unit class]] && + [unit respondsToSelector: @selector(converter)]); +} + +- (NSMeasurement *)measurementByConvertingToUnit:(NSUnit *)unit +{ + NSMeasurement *result = nil; + double val = 0.0; + if([self canBeConvertedToUnit: unit]) + { + // Do conversion... + NSUnitConverter *c = [(NSDimension *)unit converter]; + val = [c baseUnitValueFromValue: _doubleValue]; + result = [[NSMeasurement alloc] initWithDoubleValue: val unit: unit]; + AUTORELEASE(result); + } + else + { + [NSException raise: NSInvalidArgumentException + format: @"Cannot convert from %@ to %@", _unit, unit]; + } + return result; +} + +// Operating +- (NSMeasurement *)measurementByAddingMeasurement:(NSMeasurement *)measurement +{ + NSMeasurement *newMeasurement = [measurement measurementByConvertingToUnit: _unit]; + NSMeasurement *result = nil; + double v = 0.0; + + v = _doubleValue + [newMeasurement doubleValue]; + result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit]; + AUTORELEASE(result); + + return result; +} + +- (NSMeasurement *)measurementBySubtractingMeasurement:(NSMeasurement *)measurement +{ + NSMeasurement *newMeasurement = [measurement measurementByConvertingToUnit: _unit]; + NSMeasurement *result = nil; + double v = 0.0; + + v = _doubleValue - [newMeasurement doubleValue]; + result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit]; + AUTORELEASE(result); + + return result; +} + +// NSCopying +- (id) copyWithZone: (NSZone *)zone +{ + return [[[self class] allocWithZone: zone] initWithDoubleValue: _doubleValue + unit: _unit]; +} + +// NSCoding +- (void) encodeWithCoder: (NSCoder *)coder +{ + if([coder allowsKeyedCoding]) + { + [coder encodeObject: _unit forKey: @"unit"]; + [coder encodeDouble: _doubleValue forKey: @"doubleValue"]; + } + else + { + [coder encodeObject: _unit]; + [coder encodeValueOfObjCType: @encode(double) at: &_doubleValue]; + } +} + +- (id) initWithCoder: (NSCoder *)coder +{ + if((self = [super init]) != nil) + { + if([coder allowsKeyedCoding]) + { + _unit = [coder decodeObjectForKey: @"unit"]; + _doubleValue = [coder decodeDoubleForKey: @"doubleValue"]; + } + else + { + _unit = [coder decodeObject]; + [coder decodeValueOfObjCType: @encode(double) at: &_doubleValue]; + } + } + return self; +} @end diff --git a/Source/NSMeasurementFormatter.m b/Source/NSMeasurementFormatter.m index 81cde7709..6a575a801 100644 --- a/Source/NSMeasurementFormatter.m +++ b/Source/NSMeasurementFormatter.m @@ -24,8 +24,63 @@ */ #include +#include +#include +#include +#include @implementation NSMeasurementFormatter +- (NSMeasurementFormatterUnitOptions) unitOptions +{ + return _unitOptions; +} + +- (void) setUnitOptions: (NSMeasurementFormatterUnitOptions) unitOptions +{ + _unitOptions = unitOptions; +} + +- (NSFormattingUnitStyle) unitStyle +{ + return _unitStyle; +} + +- (void) setUnitStyle: (NSFormattingUnitStyle)style +{ + _unitStyle = style; +} + +- (NSLocale *) locale +{ + return _locale; +} + +- (void) setLocale: (NSLocale *)locale +{ + ASSIGNCOPY(_locale, locale); +} + +- (NSNumberFormatter *) numberFormatter +{ + return _numberFormatter; +} + +- (void) setNumberFormatter: (NSNumberFormatter *)numberFormatter +{ + ASSIGNCOPY(_numberFormatter, numberFormatter); +} + +- (NSString *)stringFromMeasurement: (NSMeasurement *)measurement +{ + return nil; +} + +- (NSString *)stringFromUnit: (NSUnit *)unit +{ + return nil; +} + + @end diff --git a/Source/NSUnit.m b/Source/NSUnit.m index 38885dfcf..000f6ea77 100644 --- a/Source/NSUnit.m +++ b/Source/NSUnit.m @@ -1,7 +1,7 @@ /* Implementation of class NSUnit Copyright (C) 2019 Free Software Foundation, Inc. - By: heron + By: Gregory John Casamento Date: Mon Sep 30 15:58:21 EDT 2019 This file is part of the GNUstep Library. @@ -26,11 +26,21 @@ #include #include +// Private methods... +@interface NSDimension (Private) +- (instancetype) initWithSymbol: (NSString *)symbol + coefficient: (double)coefficient + constant: (double)constant; +@end + // Abstract conversion... @implementation NSUnitConverter - (instancetype) init { self = [super init]; + if (self != nil) + { + } return self; } @@ -108,6 +118,16 @@ { return _constant; } + +- (double)baseUnitValueFromValue:(double)value +{ + return ((_coefficient * value) + _constant); +} + +- (double)valueFromBaseUnitValue:(double)baseUnitValue +{ + return ((baseUnitValue / _coefficient) - _constant); +} @end // Abstract unit... @@ -192,6 +212,18 @@ return self; } +- (instancetype) initWithSymbol: (NSString *)symbol + coefficient: (double)coefficient + constant: (double)constant +{ + NSUnitConverterLinear *converter = [[NSUnitConverterLinear alloc] initWithCoefficient: coefficient + constant: constant]; + NSDimension *result = [[[self class] alloc] initWithSymbol: symbol + converter: converter]; + return result; +} + + + (instancetype) baseUnit { return nil; @@ -200,334 +232,1539 @@ // Predefined.... -@implementation NSUnitAcceleration -/* - Base unit - metersPerSecondSquared - */ +@implementation NSUnitAcceleration -- (NSUnitAcceleration *) metersPerSecondSquared { return nil; } -- (NSUnitAcceleration *) gravity { return nil; } ++ (instancetype) baseUnit +{ + return [self metersPerSecondSquared]; +} + +// Base unit - metersPerSecondSquared ++ (NSUnitAcceleration *) metersPerSecondSquared +{ + NSUnitAcceleration *result = [[NSUnitAcceleration alloc] initWithSymbol: @"m/s^2" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitAcceleration *) gravity +{ + NSUnitAcceleration *result = [[NSUnitAcceleration alloc] initWithSymbol: @"g" + coefficient: 9.81 + constant: 0]; + return result; +} @end @implementation NSUnitAngle -/* - Base unit - degrees - */ -- (NSUnitAngle *) degrees { return nil; } -- (NSUnitAngle *) arcMinutes { return nil; } -- (NSUnitAngle *) arcSeconds { return nil; } -- (NSUnitAngle *) radians { return nil; } -- (NSUnitAngle *) gradians { return nil; } -- (NSUnitAngle *) revolutions { return nil; } ++ (instancetype) baseUnit +{ + return [self degrees]; +} + +// Base unit - degrees ++ (NSUnitAngle *) degrees +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"deg" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitAngle *) arcMinutes +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"'" + coefficient: 0.016667 + constant: 0.0]; + return result; +} + ++ (NSUnitAngle *) arcSeconds +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"\"" + coefficient: 0.00027778 + constant: 9.81]; + return result; +} + ++ (NSUnitAngle *) radians +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"rad" + coefficient: 57.2958 + constant: 0.0]; + return result; +} + ++ (NSUnitAngle *) gradians +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"grad" + coefficient: 0.9 + constant: 0.0]; + return result; +} + ++ (NSUnitAngle *) revolutions +{ + NSUnitAngle *result = [[NSUnitAngle alloc] initWithSymbol: @"rev" + coefficient: 360.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitArea -/* - Base unit - squareMeters - */ -- (NSUnitArea *) squareMegameters { return nil; } -- (NSUnitArea *) squareKilometers { return nil; } -- (NSUnitArea *) squareMeters { return nil; } -- (NSUnitArea *) squareCentimeters { return nil; } -- (NSUnitArea *) squareMillimeters { return nil; } -- (NSUnitArea *) squareMicrometers { return nil; } -- (NSUnitArea *) squareNanometers { return nil; } -- (NSUnitArea *) squareInches { return nil; } -- (NSUnitArea *) squareFeet { return nil; } -- (NSUnitArea *) squareYards { return nil; } -- (NSUnitArea *) squareMiles { return nil; } -- (NSUnitArea *) acres { return nil; } -- (NSUnitArea *) ares { return nil; } -- (NSUnitArea *) hectares { return nil; } ++ (instancetype) baseUnit +{ + return [self squareMeters]; +} + +// Base unit - squareMeters ++ (NSUnitArea *) squareMegameters +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"Mm^2" + coefficient: 1e12 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareKilometers +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"km^2" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareMeters +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"m^2" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareCentimeters +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"cm^2" + coefficient: 0.0001 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareMillimeters +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"mm^2" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareMicrometers +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"um^2" + coefficient: 1e-12 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareNanometers +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"nm^2" + coefficient: 1e-18 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareInches +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"in^2" + coefficient: 0.00064516 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareFeet +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"ft^2" + coefficient: 0.092903 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareYards +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"yd^2" + coefficient: 0.836127 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) squareMiles +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"mi^2" + coefficient: 2.59e+6 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) acres +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"acres" + coefficient: 4046.86 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) ares +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"ares" + coefficient: 100.0 + constant: 0.0]; + return result; +} + ++ (NSUnitArea *) hectares +{ + NSUnitArea *result = [[NSUnitArea alloc] initWithSymbol: @"hectares" + coefficient: 10000.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitConcentrationMass -/* - Base unit - gramsPerLiter - */ -- (NSUnitConcentrationMass *) gramsPerLiter { return nil; } -- (NSUnitConcentrationMass *) milligramsPerDeciliter { return nil; } ++ (instancetype) baseUnit +{ + return [self gramsPerLiter]; +} -+ (NSUnitConcentrationMass *) millimolesPerLiterWithGramsPerMole:(double)gramsPerMole { return nil; } +// Base unit - gramsPerLiter ++ (NSUnitConcentrationMass *) gramsPerLiter +{ + NSUnitConcentrationMass *result = [[NSUnitConcentrationMass alloc] initWithSymbol: @"g/L" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitConcentrationMass *) milligramsPerDeciliter +{ + NSUnitConcentrationMass *result = [[NSUnitConcentrationMass alloc] initWithSymbol: @"mg/dL" + coefficient: 0.01 + constant: 0.0]; + return result; +} + ++ (NSUnitConcentrationMass *) millimolesPerLiterWithGramsPerMole:(double)gramsPerMole +{ + NSUnitConcentrationMass *result = [[NSUnitConcentrationMass alloc] initWithSymbol: @"mmol/L" + coefficient: 18.0 * gramsPerMole + constant: 0.0]; + return result; +} @end @implementation NSUnitDispersion -/* - Base unit - partsPerMillion - */ -- (NSUnitDispersion *) partsPerMillion { return nil; } + ++ (instancetype) baseUnit +{ + return [self partsPerMillion]; +} + +// Base unit - partsPerMillion ++ (NSUnitDispersion *) partsPerMillion +{ + NSUnitDispersion *result = [[NSUnitDispersion alloc] initWithSymbol: @"ppm" + coefficient: 1.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitDuration -/* - Base unit - seconds - */ -- (NSUnitDuration *) seconds { return nil; } -- (NSUnitDuration *) minutes { return nil; } -- (NSUnitDuration *) hours { return nil; } ++ (instancetype) baseUnit +{ + return [self seconds]; +} + +// Base unit - seconds ++ (NSUnitDuration *) seconds +{ + NSUnitDuration *result = [[NSUnitDuration alloc] initWithSymbol: @"sec" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitDuration *) minutes +{ + NSUnitDuration *result = [[NSUnitDuration alloc] initWithSymbol: @"min" + coefficient: 60.0 + constant: 0.0]; + return result; +} + ++ (NSUnitDuration *) hours +{ + NSUnitDuration *result = [[NSUnitDuration alloc] initWithSymbol: @"hr" + coefficient: 3600.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitElectricCharge -/* - Base unit - coulombs - */ -- (NSUnitElectricCharge *) coulombs { return nil; } -- (NSUnitElectricCharge *) megaampereHours { return nil; } -- (NSUnitElectricCharge *) kiloampereHours { return nil; } -- (NSUnitElectricCharge *) ampereHours { return nil; } -- (NSUnitElectricCharge *) milliampereHours { return nil; } -- (NSUnitElectricCharge *) microampereHours { return nil; } ++ (instancetype) baseUnit +{ + return [self coulombs]; +} + +// Base unit - coulombs ++ (NSUnitElectricCharge *) coulombs +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"C" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCharge *) megaampereHours +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"MAh" + coefficient: 3.6e9 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCharge *) kiloampereHours +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"kAh" + coefficient: 3600000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCharge *) ampereHours +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"mAh" + coefficient: 3600.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCharge *) milliampereHours +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"hr" + coefficient: 3.6 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCharge *) microampereHours +{ + NSUnitElectricCharge *result = [[NSUnitElectricCharge alloc] initWithSymbol: @"uAh" + coefficient: 0.0036 + constant: 0.0]; + return result; +} @end @implementation NSUnitElectricCurrent -/* - Base unit - amperes - */ -- (NSUnitElectricCurrent *) megaamperes { return nil; } -- (NSUnitElectricCurrent *) kiloamperes { return nil; } -- (NSUnitElectricCurrent *) amperes { return nil; } -- (NSUnitElectricCurrent *) milliamperes { return nil; } -- (NSUnitElectricCurrent *) microamperes { return nil; } ++ (instancetype) baseUnit +{ + return [self amperes]; +} + +// Base unit - amperes ++ (NSUnitElectricCurrent *) megaamperes +{ + NSUnitElectricCurrent *result = [[NSUnitElectricCurrent alloc] initWithSymbol: @"MA" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCurrent *) kiloamperes +{ + NSUnitElectricCurrent *result = [[NSUnitElectricCurrent alloc] initWithSymbol: @"kA" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCurrent *) amperes +{ + NSUnitElectricCurrent *result = [[NSUnitElectricCurrent alloc] initWithSymbol: @"A" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCurrent *) milliamperes +{ + NSUnitElectricCurrent *result = [[NSUnitElectricCurrent alloc] initWithSymbol: @"mA" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitElectricCurrent *) microamperes +{ + NSUnitElectricCurrent *result = [[NSUnitElectricCurrent alloc] initWithSymbol: @"uA" + coefficient: 0.000001 + constant: 0.0]; + return result; +} @end @implementation NSUnitElectricPotentialDifference -/* - Base unit - volts - */ -- (NSUnitElectricPotentialDifference *) megavolts { return nil; } -- (NSUnitElectricPotentialDifference *) kilovolts { return nil; } -- (NSUnitElectricPotentialDifference *) volts { return nil; } -- (NSUnitElectricPotentialDifference *) millivolts { return nil; } -- (NSUnitElectricPotentialDifference *) microvolts { return nil; } ++ (instancetype) baseUnit +{ + return [self volts]; +} + +// Base unit - volts ++ (NSUnitElectricPotentialDifference *) megavolts +{ + NSUnitElectricPotentialDifference *result = + [[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"MV" + coefficient: 0.0 + constant: 1000000.0]; + return result; +} + ++ (NSUnitElectricPotentialDifference *) kilovolts +{ + NSUnitElectricPotentialDifference *result = + [[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"kV" + coefficient: 0.0 + constant: 1000.0]; + return result; +} + ++ (NSUnitElectricPotentialDifference *) volts +{ + NSUnitElectricPotentialDifference *result = + [[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"V" + coefficient: 0.0 + constant: 1.0]; + return result; +} + ++ (NSUnitElectricPotentialDifference *) millivolts +{ + NSUnitElectricPotentialDifference *result = + [[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"mV" + coefficient: 0.0 + constant: 0.001]; + return result; +} + ++ (NSUnitElectricPotentialDifference *) microvolts +{ + NSUnitElectricPotentialDifference *result = + [[NSUnitElectricPotentialDifference alloc] initWithSymbol: @"uV" + coefficient: 0.0 + constant: 0.000001]; + return result; +} @end @implementation NSUnitElectricResistance -/* - Base unit - ohms - */ -- (NSUnitElectricResistance *) megaohms { return nil; } -- (NSUnitElectricResistance *) kiloohms { return nil; } -- (NSUnitElectricResistance *) ohms { return nil; } -- (NSUnitElectricResistance *) milliohms { return nil; } -- (NSUnitElectricResistance *) microohms { return nil; } ++ (instancetype) baseUnit +{ + return [self ohms]; +} + +// Base unit - ohms ++ (NSUnitElectricResistance *) megaohms +{ + NSUnitElectricResistance *result = + [[NSUnitElectricResistance alloc] initWithSymbol: @"MOhm" + coefficient: 0.0 + constant: 100000.0]; + return result; +} + ++ (NSUnitElectricResistance *) kiloohms +{ + NSUnitElectricResistance *result = + [[NSUnitElectricResistance alloc] initWithSymbol: @"kOhm" + coefficient: 0.0 + constant: 1000.000001]; + return result; +} + ++ (NSUnitElectricResistance *) ohms +{ + NSUnitElectricResistance *result = + [[NSUnitElectricResistance alloc] initWithSymbol: @"Ohm" + coefficient: 0.0 + constant: 0.000001]; + return result; +} + ++ (NSUnitElectricResistance *) milliohms +{ + NSUnitElectricResistance *result = + [[NSUnitElectricResistance alloc] initWithSymbol: @"mOhm" + coefficient: 0.0 + constant: 0.000001]; + return result; +} + ++ (NSUnitElectricResistance *) microohms +{ + NSUnitElectricResistance *result = + [[NSUnitElectricResistance alloc] initWithSymbol: @"uOhm" + coefficient: 0.0 + constant: 0.000001]; + return result; +} + @end @implementation NSUnitEnergy -/* - Base unit - joules - */ -- (NSUnitEnergy *) kilojoules { return nil; } -- (NSUnitEnergy *) joules { return nil; } -- (NSUnitEnergy *) kilocalories { return nil; } -- (NSUnitEnergy *) calories { return nil; } -- (NSUnitEnergy *) kilowattHours { return nil; } ++ (instancetype) baseUnit +{ + return [self joules]; +} + +// Base unit - joules ++ (NSUnitEnergy *) kilojoules +{ + NSUnitEnergy *result = [[NSUnitEnergy alloc] initWithSymbol: @"kJ" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitEnergy *) joules +{ + NSUnitEnergy *result = [[NSUnitEnergy alloc] initWithSymbol: @"J" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitEnergy *) kilocalories +{ + NSUnitEnergy *result = [[NSUnitEnergy alloc] initWithSymbol: @"kCal" + coefficient: 4184.0 + constant: 0.0]; + return result; +} + ++ (NSUnitEnergy *) calories +{ + NSUnitEnergy *result = [[NSUnitEnergy alloc] initWithSymbol: @"cal" + coefficient: 4.184 + constant: 0.0]; + return result; +} + ++ (NSUnitEnergy *) kilowattHours +{ + NSUnitEnergy *result = [[NSUnitEnergy alloc] initWithSymbol: @"kWh" + coefficient: 3600000.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitFrequency -/* - Base unit - hertz - */ -- (NSUnitFrequency *) terahertz { return nil; } -- (NSUnitFrequency *) gigahertz { return nil; } -- (NSUnitFrequency *) megahertz { return nil; } -- (NSUnitFrequency *) kilohertz { return nil; } -- (NSUnitFrequency *) hertz { return nil; } -- (NSUnitFrequency *) millihertz { return nil; } -- (NSUnitFrequency *) microhertz { return nil; } -- (NSUnitFrequency *) nanohertz { return nil; } ++ (instancetype) baseUnit +{ + return [self hertz]; +} + +// Base unit - hertz + ++ (NSUnitFrequency *) terahertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"thz" + coefficient: 1e12 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) gigahertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"ghz" + coefficient: 1e9 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) megahertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"GHz" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) kilohertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"KHz" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) hertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"Hz" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) millihertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"mHz" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) microhertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"uHz" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitFrequency *) nanohertz +{ + NSUnitFrequency *result = [[NSUnitFrequency alloc] initWithSymbol: @"nHz" + coefficient: 1e-9 + constant: 0.0]; + return result; +} @end @implementation NSUnitFuelEfficiency -/* - Base unit - litersPer100Kilometers - */ -- (NSUnitFuelEfficiency *) litersPer100Kilometers { return nil; } -- (NSUnitFuelEfficiency *) milesPerImperialGallon { return nil; } -- (NSUnitFuelEfficiency *) milesPerGallon { return nil; } ++ (instancetype) baseUnit +{ + return [self litersPer100Kilometers]; +} + +// Base unit - litersPer100Kilometers + ++ (NSUnitFuelEfficiency *) litersPer100Kilometers +{ + NSUnitFuelEfficiency *result = [[NSUnitFuelEfficiency alloc] initWithSymbol: @"L/100km" + coefficient: 0.0 + constant: 0.0]; + return result; +} + ++ (NSUnitFuelEfficiency *) milesPerImperialGallon +{ + NSUnitFuelEfficiency *result = [[NSUnitFuelEfficiency alloc] initWithSymbol: @"mpg" + coefficient: 0.0 + constant: 0.0]; + return result; +} + ++ (NSUnitFuelEfficiency *) milesPerGallon +{ + NSUnitFuelEfficiency *result = [[NSUnitFuelEfficiency alloc] initWithSymbol: @"mpg" + coefficient: 0.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitLength -/* - Base unit - meters - */ -- (NSUnitLength *) megameters { return nil; } -- (NSUnitLength *) kilometers { return nil; } -- (NSUnitLength *) hectometers { return nil; } -- (NSUnitLength *) decameters { return nil; } -- (NSUnitLength *) meters { return nil; } -- (NSUnitLength *) decimeters { return nil; } -- (NSUnitLength *) centimeters { return nil; } -- (NSUnitLength *) millimeters { return nil; } -- (NSUnitLength *) micrometers { return nil; } -- (NSUnitLength *) nanometers { return nil; } -- (NSUnitLength *) picometers { return nil; } -- (NSUnitLength *) inches { return nil; } -- (NSUnitLength *) feet { return nil; } -- (NSUnitLength *) yards { return nil; } -- (NSUnitLength *) miles { return nil; } -- (NSUnitLength *) scandinavianMiles { return nil; } -- (NSUnitLength *) lightyears { return nil; } -- (NSUnitLength *) nauticalMiles { return nil; } -- (NSUnitLength *) fathoms { return nil; } -- (NSUnitLength *) furlongs { return nil; } -- (NSUnitLength *) astronomicalUnits { return nil; } -- (NSUnitLength *) parsecs { return nil; } ++ (instancetype) baseUnit +{ + return [self meters]; +} + +// Base unit - meters + ++ (NSUnitLength *) megameters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"Mm" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) kilometers +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"kM" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) hectometers +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"hm" + coefficient: 100.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) decameters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"dam" + coefficient: 10 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) meters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"meters" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) decimeters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"dm" + coefficient: 0.1 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) centimeters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"cm" + coefficient: 0.01 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) millimeters +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"mm" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) micrometers +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"um" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) nanometers +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"nm" + coefficient: 1e-9 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) picometers +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"pm" + coefficient: 1e-12 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) inches +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"in" + coefficient: 0.254 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) feet +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"ft" + coefficient: 0.3048 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) yards +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"yd" + coefficient: 0.9144 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) miles +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"mi" + coefficient: 1609.34 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) scandinavianMiles +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"smi" + coefficient: 10000 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) lightyears +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"ly" + coefficient: 9.461e+15 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) nauticalMiles +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"NM" + coefficient: 1852.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) fathoms +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"ftm" + coefficient: 1.8288 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) furlongs +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"fur" + coefficient: 0.0 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) astronomicalUnits +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"ua" + coefficient: 1.496e+11 + constant: 0.0]; + return result; +} + ++ (NSUnitLength *) parsecs +{ + NSUnitLength *result = [[NSUnitLength alloc] initWithSymbol: @"pc" + coefficient: 3.086e+16 + constant: 0.0]; + return result; +} @end @implementation NSUnitIlluminance -/* - Base unit - lux - */ -- (NSUnitIlluminance *) lux { return nil; } ++ (instancetype) baseUnit +{ + return [self lux]; +} + +// Base unit - lux ++ (NSUnitIlluminance *) lux +{ + NSUnitIlluminance *result = [[NSUnitIlluminance alloc] initWithSymbol: @"lux" + coefficient: 1.0 + constant: 0.0]; + return result; +} @end @implementation NSUnitMass -/* - Base unit - kilograms - */ -- (NSUnitMass *) kilograms { return nil; } -- (NSUnitMass *) grams { return nil; } -- (NSUnitMass *) decigrams { return nil; } -- (NSUnitMass *) centigrams { return nil; } -- (NSUnitMass *) milligrams { return nil; } -- (NSUnitMass *) micrograms { return nil; } -- (NSUnitMass *) nanograms { return nil; } -- (NSUnitMass *) picograms { return nil; } -- (NSUnitMass *) ounces { return nil; } -- (NSUnitMass *) poundsMass { return nil; } -- (NSUnitMass *) stones { return nil; } -- (NSUnitMass *) metricTons { return nil; } -- (NSUnitMass *) shortTons { return nil; } -- (NSUnitMass *) carats { return nil; } -- (NSUnitMass *) ouncesTroy { return nil; } -- (NSUnitMass *) slugs { return nil; } ++ (instancetype) baseUnit +{ + return [self kilograms]; +} + +// Base unit - kilograms + ++ (NSUnitMass *) kilograms +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"kg" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) grams +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"g" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) decigrams +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"dg" + coefficient: 0.0001 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) centigrams +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"cg" + coefficient: 0.00001 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) milligrams +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"mg" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) micrograms +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"ug" + coefficient: 1e9 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) nanograms +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"ng" + coefficient: 1e-12 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) picograms +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"pg" + coefficient: 1e-15 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) ounces +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"oz" + coefficient: 0.0283495 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) poundsMass +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"lb" + coefficient: 0.453592 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) stones +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"st" + coefficient: 0.157473 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) metricTons +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"t" + coefficient: 1000 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) shortTons +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"ton" + coefficient: 907.185 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) carats +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"ct" + coefficient: 0.0002 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) ouncesTroy +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"oz t" + coefficient: 0.03110348 + constant: 0.0]; + return result; +} + ++ (NSUnitMass *) slugs +{ + NSUnitMass *result = [[NSUnitMass alloc] initWithSymbol: @"slug" + coefficient: 14.5939 + constant: 0.0]; + return result; +} @end @implementation NSUnitPower -/* - Base unit - watts - */ -- (NSUnitPower *) terawatts { return nil; } -- (NSUnitPower *) gigawatts { return nil; } -- (NSUnitPower *) megawatts { return nil; } -- (NSUnitPower *) kilowatts { return nil; } -- (NSUnitPower *) watts { return nil; } -- (NSUnitPower *) milliwatts { return nil; } -- (NSUnitPower *) microwatts { return nil; } -- (NSUnitPower *) nanowatts { return nil; } -- (NSUnitPower *) picowatts { return nil; } -- (NSUnitPower *) femtowatts { return nil; } -- (NSUnitPower *) horsepower { return nil; } ++ (instancetype) baseUnit +{ + return [self watts]; +} + +// Base unit - watts + ++ (NSUnitPower *) terawatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"TW" + coefficient: 1e12 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) gigawatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"GW" + coefficient: 1e9 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) megawatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"MW" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) kilowatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"kW" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) watts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"W" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) milliwatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"mW" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) microwatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"uW" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) nanowatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"nW" + coefficient: 1e-9 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) picowatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"pW" + coefficient: 1e-12 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) femtowatts +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"fW" + coefficient: 1e-15 + constant: 0.0]; + return result; +} + ++ (NSUnitPower *) horsepower +{ + NSUnitPower *result = [[NSUnitPower alloc] initWithSymbol: @"hp" + coefficient: 745.7 + constant: 0.0]; + return result; +} @end -@implementation NSUnitPressure -/* - Base unit - newtonsPerMetersSquared (equivalent to 1 pascal) - */ +@implementation NSUnitPressure + ++ (instancetype) baseUnit +{ + return [self newtonsPerMetersSquared]; +} + +// Base unit - newtonsPerMetersSquared (equivalent to 1 pascal) + ++ (NSUnitPressure *) newtonsPerMetersSquared +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"N/m^2" + coefficient: 0.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) gigapascals +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"GPa" + coefficient: 1e9 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) megapascals +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"MPa" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) kilopascals +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"kPa" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) hectopascals +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"hPa" + coefficient: 100.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) inchesOfMercury +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"inHg" + coefficient: 3386.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) bars +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"bars" + coefficient: 100000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) millibars +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"mbars" + coefficient: 100.0 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) millimetersOfMercury +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"mmHg" + coefficient: 133.322 + constant: 0.0]; + return result; +} + ++ (NSUnitPressure *) poundsForcePerSquareInch +{ + NSUnitPressure *result = [[NSUnitPressure alloc] initWithSymbol: @"psi" + coefficient: 6894.76 + constant: 0.0]; + return result; +} -- (NSUnitPressure *) newtonsPerMetersSquared { return nil; } -- (NSUnitPressure *) gigapascals { return nil; } -- (NSUnitPressure *) megapascals { return nil; } -- (NSUnitPressure *) kilopascals { return nil; } -- (NSUnitPressure *) hectopascals { return nil; } -- (NSUnitPressure *) inchesOfMercury { return nil; } -- (NSUnitPressure *) bars { return nil; } -- (NSUnitPressure *) millibars { return nil; } -- (NSUnitPressure *) millimetersOfMercury { return nil; } -- (NSUnitPressure *) poundsForcePerSquareInch { return nil; } @end @implementation NSUnitSpeed -/* - Base unit - metersPerSecond - */ ++ (instancetype) baseUnit +{ + return [self metersPerSecond]; +} -- (NSUnitSpeed *) metersPerSecond { return nil; } -- (NSUnitSpeed *) kilometersPerHour { return nil; } -- (NSUnitSpeed *) milesPerHour { return nil; } -- (NSUnitSpeed *) knots { return nil; } +// Base unit - metersPerSecond ++ (NSUnitSpeed *) metersPerSecond +{ + NSUnitSpeed *result = [[NSUnitSpeed alloc] initWithSymbol: @"m/s" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitSpeed *) kilometersPerHour +{ + NSUnitSpeed *result = [[NSUnitSpeed alloc] initWithSymbol: @"km/h" + coefficient: 0.277778 + constant: 0.0]; + return result; +} + ++ (NSUnitSpeed *) milesPerHour +{ + NSUnitSpeed *result = [[NSUnitSpeed alloc] initWithSymbol: @"mph" + coefficient: 0.44704 + constant: 0.0]; + return result; +} + ++ (NSUnitSpeed *) knots +{ + NSUnitSpeed *result = [[NSUnitSpeed alloc] initWithSymbol: @"kn" + coefficient: 0.51444 + constant: 0.0]; + return result; +} @end -@implementation NSUnitTemperature -/* - Base unit - kelvin - */ -- (NSUnitTemperature *) kelvin { return nil; } -- (NSUnitTemperature *) celsius { return nil; } -- (NSUnitTemperature *) fahrenheit { return nil; } +@implementation NSUnitTemperature ++ (instancetype) baseUnit +{ + return [self kelvin]; +} +// Base unit - kelvin ++ (NSUnitTemperature *) kelvin +{ + NSUnitTemperature *result = [[NSUnitTemperature alloc] initWithSymbol: @"K" + coefficient: 1.0 + constant: 0.0]; + return result; +} ++ (NSUnitTemperature *) celsius +{ + NSUnitTemperature *result = [[NSUnitTemperature alloc] initWithSymbol: @"C" + coefficient: 1.0 + constant: 273.15]; + return result; +} + ++ (NSUnitTemperature *) fahrenheit +{ + NSUnitTemperature *result = [[NSUnitTemperature alloc] initWithSymbol: @"F" + coefficient: 0.55555555555556 + constant: 255.37222222222427]; + return result; +} @end @implementation NSUnitVolume -/* - Base unit - liters - */ ++ (instancetype) baseUnit +{ + return [self liters]; +} + +// Base unit - liters ++ (NSUnitVolume *) megaliters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"ML" + coefficient: 1000000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) kiloliters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"kL" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) liters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"L" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) deciliters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"dL" + coefficient: 0.1 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) centiliters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"cL" + coefficient: 0.01 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) milliliters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"mL" + coefficient: 0.001 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicKilometers +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"km^3" + coefficient: 1e12 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicMeters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"m^3" + coefficient: 1000.0 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicDecimeters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"dm^3" + coefficient: 1.0 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicCentimeters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"cm^3" + coefficient: 0.0001 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicMillimeters +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"mm^3" + coefficient: 0.000001 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicInches +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"in^3" + coefficient: 0.0163871 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicFeet +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"ft^3" + coefficient: 28.3168 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicYards +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"yd^3" + coefficient: 764.555 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cubicMiles +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"mi^3" + coefficient: 4.168e+12 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) acreFeet +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"af" + coefficient: 1.233e+6 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) bushels +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"bsh" + coefficient: 32.2391 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) teaspoons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"tsp" + coefficient: 0.00492892 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) tablespoons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"tbsp" + coefficient: 0.0147868 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) fluidOunces +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"fl oz" + coefficient: 0.295735 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) cups +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"cups" + coefficient: 0.24 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) pints +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"pt" + coefficient: 0.473176 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) quarts +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"qt" + coefficient: 0.946353 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) gallons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"gal" + coefficient: 3.78541 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialTeaspoons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"tsp" + coefficient: 0.00591939 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialTablespoons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"tbsp" + coefficient: 0.0177582 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialFluidOunces +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"fl oz" + coefficient: 0.0284131 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialPints +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"pt" + coefficient: 0.568261 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialQuarts +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"qt" + coefficient: 1.13652 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) imperialGallons +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"gal" + coefficient: 4.54609 + constant: 0.0]; + return result; +} + ++ (NSUnitVolume *) metricCups +{ + NSUnitVolume *result = [[NSUnitVolume alloc] initWithSymbol: @"metric cup" + coefficient: 0.25 + constant: 0.0]; + return result; +} -- (NSUnitVolume *) megaliters { return nil; } -- (NSUnitVolume *) kiloliters { return nil; } -- (NSUnitVolume *) liters { return nil; } -- (NSUnitVolume *) deciliters { return nil; } -- (NSUnitVolume *) centiliters { return nil; } -- (NSUnitVolume *) milliliters { return nil; } -- (NSUnitVolume *) cubicKilometers { return nil; } -- (NSUnitVolume *) cubicMeters { return nil; } -- (NSUnitVolume *) cubicDecimeters { return nil; } -- (NSUnitVolume *) cubicCentimeters { return nil; } -- (NSUnitVolume *) cubicMillimeters { return nil; } -- (NSUnitVolume *) cubicInches { return nil; } -- (NSUnitVolume *) cubicFeet { return nil; } -- (NSUnitVolume *) cubicYards { return nil; } -- (NSUnitVolume *) cubicMiles { return nil; } -- (NSUnitVolume *) acreFeet { return nil; } -- (NSUnitVolume *) bushels { return nil; } -- (NSUnitVolume *) teaspoons { return nil; } -- (NSUnitVolume *) tablespoons { return nil; } -- (NSUnitVolume *) fluidOunces { return nil; } -- (NSUnitVolume *) cups { return nil; } -- (NSUnitVolume *) pints { return nil; } -- (NSUnitVolume *) quarts { return nil; } -- (NSUnitVolume *) gallons { return nil; } -- (NSUnitVolume *) imperialTeaspoons { return nil; } -- (NSUnitVolume *) imperialTablespoons { return nil; } -- (NSUnitVolume *) imperialFluidOunces { return nil; } -- (NSUnitVolume *) imperialPints { return nil; } -- (NSUnitVolume *) imperialQuarts { return nil; } -- (NSUnitVolume *) imperialGallons { return nil; } -- (NSUnitVolume *) metricCups { return nil; } @end