react-native-bt-device/ios/RNBTDevice/Device/DGMG/Algorithm/I4Algorithm.m

62 lines
1.2 KiB
Mathematica
Raw Normal View History

//
// Algorithm.m
// react-native-bt-device
//
// Created by Ran Zhao on 9/2/24.
//
#import "I4Algorithm.h"
@implementation I4Algorithm
static I4Algorithm *I4_0 = nil;
static I4Algorithm *I4_20 = nil;
static I4Algorithm *I4_40 = nil;
static I4Algorithm *I4_60 = nil;
static I4Algorithm *I4_80 = nil;
+ (void)initialize {
if (self == [I4Algorithm class]) {
I4_0 = [[I4Algorithm alloc] initWithCode:@"00" value:0];
I4_20 = [[I4Algorithm alloc] initWithCode:@"01" value:20];
I4_40 = [[I4Algorithm alloc] initWithCode:@"02" value:40];
I4_60 = [[I4Algorithm alloc] initWithCode:@"03" value:60];
I4_80 = [[I4Algorithm alloc] initWithCode:@"04" value:80];
}
}
+ (instancetype)I4_0 {
return I4_0;
}
+ (instancetype)I4_20 {
return I4_20;
}
+ (instancetype)I4_40 {
return I4_40;
}
+ (instancetype)I4_60 {
return I4_60;
}
+ (instancetype)I4_80 {
return I4_80;
}
- (instancetype)initWithCode:(NSString *)code value:(int)value {
self = [super init];
if (self) {
self.code = code;
self.value = value;
}
return self;
}
- (double)getI4Value:(double)i3value {
return i3value - self.value;
}
@end