Skip to content
This repository
tree: 29073d7b4e
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (46 sloc) 1.239 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
//
// _DDFunctionContainer.m
// DDMathParser
//
// Created by Dave DeLong on 7/14/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "_DDFunctionContainer.h"

@implementation _DDFunctionContainer
@synthesize function;
@synthesize aliases;

+ (NSString *)normalizedAlias:(NSString *)alias {
    return [alias lowercaseString];
}

- (id)initWithFunction:(DDMathFunction)f name:(NSString *)name {
    self = [super init];
    if (self) {
        [self setFunction:f];
        aliases = [[NSMutableSet alloc] init];
        [self addAlias:name];
    }
    return self;
}

#if !DD_HAS_ARC
- (void)dealloc {
    [function release];
    [aliases release];
    [super dealloc];
}
#endif

- (NSMutableSet *)_aliases {
    return (NSMutableSet *)aliases;
}

- (NSString *)_normalizedAlias:(NSString *)alias {
    return [alias lowercaseString];
}

- (void)addAlias:(NSString *)alias {
    [[self _aliases] addObject:[_DDFunctionContainer normalizedAlias:alias]];
}

- (void)removeAlias:(NSString *)alias {
    [[self _aliases] removeObject:[_DDFunctionContainer normalizedAlias:alias]];
}

- (BOOL)containsAlias:(NSString *)alias {
    return [aliases containsObject:[_DDFunctionContainer normalizedAlias:alias]];
}

@end
Something went wrong with that request. Please try again.