//
//  UITableArrayStructure.m
//  iPhly
//
//  Created by Ari Krupnik on 7/9/11.
//  Copyright 2011 lib.aero. All rights reserved.
//

#import "UITableArrayStructure.h"


@implementation UITableSection
@synthesize headerTitle;
@synthesize cells;
- (void)dealloc {
    [headerTitle release];
    [cells release];
    [super dealloc];
}
@end



@implementation ArrayTableDataSource
@synthesize sections;
- (void)dealloc {
    [sections release];
    [super dealloc];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableSection* s = [sections objectAtIndex:[indexPath section]];
    return [[s cells] objectAtIndex:[indexPath row]];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [[[sections objectAtIndex:section] cells] count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [sections count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    UITableSection* s = [sections objectAtIndex:section];
    return [s headerTitle];
}
@end