Guest User

Untitled

a guest
Nov 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  wordIndex.m
  3. //  Program 2
  4. //
  5. //  Created by Mark Grandi on 9/13/11.
  6. //  Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8.  
  9. #import "wordIndex.h"
  10.  
  11. @implementation wordIndex
  12.  
  13. /**
  14.  Init method
  15.  */
  16. - (id)init {
  17.  
  18.     self = [super init];
  19.     if (self) {
  20.         // Initialization code here.
  21.     }
  22.    
  23.     return self;
  24. }
  25.  
  26. /**
  27.  Dealloc override from NSObject
  28.  */
  29. - (void) dealloc {
  30.    
  31.     // release instance variables
  32.     [word release];
  33.     [lineNumberArray release];
  34.    
  35.     // call superclass
  36.     [super dealloc];
  37.    
  38.    
  39. }
  40.  
  41. /**
  42.  description override
  43.  @return a string description
  44.  */
  45. - (NSString*) description {
  46.        
  47.     NSString *result = [NSString stringWithFormat: @"<wordIndex: word: '%@', count: '%@', lineNumberArray: '%@'", word, count, lineNumberArray];
  48.    
  49.     return [result autorelease];
  50.                        
  51. }
  52.  
  53. /**
  54.  getter for word
  55.  @return the word instance variable
  56.  */
  57. - (NSString*) word {
  58.    
  59.     return word;
  60.    
  61. }
  62.  
  63. /**
  64.  Setter for word
  65.  @param newWord - the new word
  66.  */
  67. - (void) setWord:(NSString*) newWord {
  68.    
  69.     if (word != newWord) {
  70.        
  71.         [word release];
  72.         word = [newWord copy];
  73.        
  74.     }
  75.    
  76. }
  77.  
  78. /*
  79.  getter for count
  80.  @return the count instance variable
  81.  */
  82. - (int) count {
  83.    
  84.     return count;
  85.    
  86. }
  87.  
  88. /*
  89.  setter for count
  90.  @param newCount - the new count
  91.  */
  92. - (void) setCount: (int) newCount {
  93.    
  94.     count = newCount;
  95.    
  96. }
  97.  
  98. /*
  99.  getter for lineNumberArray
  100.  @return the lineNumberArray instance variable
  101.  */
  102. - (NSMutableArray*) lineNumberArray {
  103.    
  104.     return lineNumberArray;
  105.    
  106. }
  107.  
  108. /*
  109.  Setter for lineNumberArray
  110.  @param newArray - the new NSMutableArray
  111.  */
  112. - (void) setLineNumberArray:(NSMutableArray *)newArray {
  113.    
  114.     if (lineNumberArray != newArray) {
  115.        
  116.         [lineNumberArray release];
  117.         lineNumberArray = [newArray copy];
  118.        
  119.     }
  120.    
  121. }
  122.  
  123.  
  124.  
  125. @end
Add Comment
Please, Sign In to add comment