PageRenderTime 27ms CodeModel.GetById 23ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Tests/Person.m

http://github.com/bhatti/OCActiveObjects
Objective C | 69 lines | 46 code | 16 blank | 7 comment | 7 complexity | ce37e6549c8d6f16ba4380118aa7ca83 MD5 | raw file
Possible License(s): GPL-3.0
 1//
 2//  Person.m
 3//  PlexLotto
 4//
 5//  Created by shahzad bhatti on 6/6/09.
 6//  Copyright 2009 __MyCompanyName__. All rights reserved.
 7//
 8
 9#import "Person.h"
10
11
12@implementation Person
13@synthesize name;
14@synthesize age;
15@synthesize rank;
16@synthesize votes;
17@synthesize sex;
18@synthesize income;
19@synthesize active;
20@synthesize flags;
21@synthesize rating;
22@synthesize birthdate;
23
24
25- (BOOL)isEqual:(id)other {
26    if (other == self)
27        return YES;
28    if (!other || ![other isKindOfClass:[self class]])
29        return NO;
30    return [self isEqualToPerson:other];
31}
32
33- (BOOL)isEqualToPerson:(Person *)aPerson {
34	if (self == aPerson)
35        return YES;
36    if (![(id)[self name] isEqual:[aPerson name]])
37        return NO;
38    return YES;
39}
40
41- (NSUInteger)hash {
42	NSUInteger hash = 0;
43	hash += [[self name] hash];
44	return hash;
45}
46
47
48
49- (NSString *)description {
50	return [NSString stringWithFormat:@"id %@, name %@, age %d, rank %d, votes %d, sex %c, income %f, active %d, flags %d, rating %@, birthdate %@", 
51			self.objectId, self.name, self.age, self.rank, self.votes, self.sex, self.income, self.active, self.flags, self.rating, self.birthdate];
52}
53
54
55- (void) dealloc {
56	[birthdate release];
57	[super dealloc];
58}
59
60
61+ (NSString	*) getTableName {
62	return @"persons";
63}
64
65+ (NSString	*) getDatabaseName {
66	return @"personsdb";
67}
68
69@end