-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEPTwittererChainFinderController.m
61 lines (46 loc) · 1.61 KB
/
EPTwittererChainFinderController.m
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
58
59
60
61
//
// EPTwittererChainFinderController.m
// Degrees of Tweetdom
//
// Created by Simone Manganelli on 2008-08-24.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "EPTwittererChainFinderController.h"
#import "EPTwittererChainFinder.h"
@implementation EPTwittererChainFinderController
- (id)init;
{
if (self = [super initWithWindowNibName:@"TwittererChainFinder"]) {
twittererChainFinderInstance = [[EPTwittererChainFinder alloc] initWithStatusDelegate:self];
}
return self;
}
- (void)dealloc;
{
[twittererChainFinderInstance release];
[super dealloc];
}
- (void)addStatusLine:(NSString *)statusLine;
{
NSString *newStatus = [[errorConsoleView string] stringByAppendingString:[NSString stringWithFormat:@"%@\n",statusLine]];
[errorConsoleView performSelectorOnMainThread:@selector(setString:) withObject:newStatus waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(scrollErrorConsoleToBottom) withObject:nil waitUntilDone:NO];
}
- (void)scrollErrorConsoleToBottom;
{
[errorConsoleView scrollRangeToVisible:NSMakeRange([[errorConsoleView string] length]-1,1)];
}
- (IBAction)startChainSearch:(id)sender;
{
[errorConsoleView setString:@""];
[NSThread detachNewThreadSelector:@selector(doChainSearch)
toTarget:self
withObject:nil];
}
- (void)doChainSearch;
{
NSArray *startTwitterers = [NSArray arrayWithObject:[firstTwittererTextField stringValue]];
NSArray *endTwitterers = [NSArray arrayWithObject:[secondTwittererTextField stringValue]];
[twittererChainFinderInstance findShortestPathWithStartTwitterers:startTwitterers endTwitterers:endTwitterers];
}
@end