//
//  TesteeResultsController.m
//  TestInterface
//
//  Created by Luke Pullella on 25/07/06.
//  Copyright 2006 Luke Pullella. All rights reserved.
//

#import "TesteeResultsController.h"


@implementation TesteeResultsController

- (void)loadTestee:(NSDictionary *)aTestee
{
	if(testee != nil)
	{
		[testee release];
	}

	testee = [aTestee retain];
}

/* Results table handler */

- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
	if(testee == nil)
	{
		return 0;
	}
	
	return [testee length];
}

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
	if([[[aTableColumn headerCell] stringValue] caseInsensitiveCompare:@"date"] == NSOrderedSame)
	{
		return [[testee objectAtIndex:rowIndex] objectForKey:@"date"];
	}
	if([[[aTableColumn headerCell] stringValue] caseInsensitiveCompare:@"time"] == NSOrderedSame)
	{
		return [[testee objectAtIndex:rowIndex] objectForKey:@"timeToGuess"];
	}
	if([[[aTableColumn headerCell] stringValue] caseInsensitiveCompare:@"actual shape"] == NSOrderedSame)
	{
		return [[testee objectAtIndex:rowIndex] objectForKey:@"actualShape"];
	}
	if([[[aTableColumn headerCell] stringValue] caseInsensitiveCompare:@"guessed shape"] == NSOrderedSame)
	{
		return [[testee objectAtIndex:rowIndex] objectForKey:@"guessedShape"];
	}
	else
	{
		return @"Error Getting Data";
	}
}

@end
