OSID Logo
OSID Specifications
locale package
Version 3.0.0
Release Candidate Preview
Interfaceosid.locale.UnitConversionSession
Implementsosid.OsidSession
Description

This session defines methods to convert units across measurement systems.

MethodcanConvertUnits
Description

Tests if this user can perform unit conversions. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.

Returnboolean false if conversion methods are not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodconvertUnit
Description

Convert a unit of measurement.

ParametersdecimalsourceUnitthe measure to convert
osid.type.TypesourceUnitTypethe type of measure specified
osid.type.TypetargetUnitTypethe type of converted measure
Returndecimalresulting measure
ErrorsNULL_ARGUMENT null argument provided
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED LocaleManager.supportsUnitTypesForConversion(measureType, conversionType) is false
CompliancemandatoryThis method must be implemented.
MethodconvertUnits
Description

Convert units of measurement.

Parametersdecimal[]sourceUnitsthe measures to convert
osid.type.TypesourceUnitTypethe type of measure specified
osid.type.TypetargetUnitTypethe type of converted measure
Returndecimal[]resulting measures
ErrorsNULL_ARGUMENT null argument provided
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED LocaleManager.supportsUnitTypesForConversion(measureType, conversionType) is false
CompliancemandatoryThis method must be implemented.