1 /*
 2  Vertex.h
 3  graph_cmd
 4 
 5  Created by Jamie Griffin on Mon Mar 01 2004.
 6 
 7  This class contains a representation of a Vertex of a graph.
 8  Each vertex knows it's number (label), color, and other vertices
 9  connected to it.
10  
11  It implements the NSCopying protocol so that copies with and
12  without actual data duplication can be made through standard calls
13  (primarily for use by arrays). It also implements the NSCoding protocol
14  so that data may be encoded for saving graphs.
15 
16 
17 */
18 
19 //Version 1.0b6
20 
21 #import <Cocoa/Cocoa.h>
22 
23 
24 //Vertex implements the coding protocol for save and load
25 //and copying for copies
26 @interface Vertex : NSObject <NSCoding, NSCopying>
27 {
28 
29 	NSArray *connections;	//an array of NSNumber
30 	int number;
31 	int color;
32 }
33 
34 //init and copy methods
35 -(id)initWithNumber:(int)thisNumber connections:(NSArray *)theseConnections;
36 -(id)initWithString:(NSString *)stringVertex;
37 +(Vertex *)vertexWithVertex:(Vertex *)vertex; //class method to make a copy
38 
39 //accessors
40 -(int)getColor;					//by convention, should be -color but that method exists in a superclass
41 -(NSArray *)connections;
42 -(int)number;
43 -(NSString *)stringVertex;		//return the vertex in string form
44 -(int)numConnections;
45 
46 //mutators
47 -(void)setThisColor:(int)newColor;	//again, -setColor: exists in a superclass
48 -(void)setConnections:(NSArray *)newArray;
49 -(void)setNumber:(int)newNumber;
50 
51 
52 @end


syntax highlighted by Code2HTML, v. 0.9.1