Sha256: 1bc14066a6a75c29a9b811d1c5b50f0068c8ab484f68d4dd75bfdb1caff73d85

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

#import "EXPFloatTuple.h"

@implementation EXPFloatTuple

@synthesize values = _values, size = _size;

- (id)initWithFloatValues:(float *)values size:(size_t)size {
    if ((self = [super init])) {
        self.values = malloc(sizeof(float) * size);
        memcpy(self.values, values, sizeof(float) * size);
        self.size = size;
    }
    return self;
}

- (void)dealloc {
    free(self.values);
    [super dealloc];
}

- (BOOL)isEqual:(id)object {
    if (![object isKindOfClass:[EXPFloatTuple class]]) return NO;
    EXPFloatTuple *other = (EXPFloatTuple *)object;
    if (self.size == other.size) {
        for (int i = 0; i < self.size; ++i) {
            if (self.values[i] != other.values[i]) return NO;
        }
        return YES;
    }
    return NO;
}

- (NSString *)description {
    if (self.size == 2) {
        return [NSString stringWithFormat:@"Float tuple: {%f, %f}", self.values[0], self.values[1]];
    } else if (self.size == 4) {
        return [NSString stringWithFormat:@"Float tuple: {%f, %f, %f, %f}", self.values[0], self.values[1], self.values[2], self.values[3]];
    }
    return [NSString stringWithFormat:@"Float tuple of unexpected size %zd, sadly", self.size];
}

@end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
second_curtain-0.6.0 Demo/Pods/Expecta/src/EXPFloatTuple.m
second_curtain-0.5.0 Demo/Pods/Expecta/src/EXPFloatTuple.m
second_curtain-0.4.0 Demo/Pods/Expecta/src/EXPFloatTuple.m
second_curtain-0.3.0 Demo/Pods/Expecta/src/EXPFloatTuple.m
cocoapods-deintegrate-0.2.1 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/EXPFloatTuple.m
cocoapods-deintegrate-0.2.0 spec/fixtures/Project/StaticLibraries/Pods/Expecta/src/EXPFloatTuple.m
second_curtain-0.2.4 Demo/Pods/Expecta/src/EXPFloatTuple.m
second_curtain-0.2.3 Demo/Pods/Expecta/src/EXPFloatTuple.m