All pastes #979145 Raw Edit

Untitled

public text v1 · immutable
·published 2008-04-10 02:42 UTC
rendered paste body
word = word.toLowerCase();
			
				if (word.length() > 3 ) {
				if (contains(word) == -1){
					add(word);
				}
	
//******************************************************************
//
//				Write other methods after this comment block
//
//******************************************************************

		public void add(String word){
			if ( isFull()) {
				resize();
			}	
			list[count++] = word;
		}


		public int contains(String other){
			int i; 
			for ( i = 0; i < count; i++) {
				if (list[i].equals(other)){
					return i;
					}
				}
			return -1; 
		}


		public int numCharacters(){ 
			int num = 0;
			int i; 

			for(i = 0; i < count; i ++){
				num = num +list[i].length(); 
			}
			return num; 
		}

		public Wordlist wordsWithSubstr(String substr){
			int i; 
			Wordlist wl = new Wordlist(10); 

			for ( i = 0; i < count; i ++){
				if (list[i].indexOf(substr) != -1){
					wl.add(substr);
				}
				return wl; 
			}
		}
		
		public Wordlist wordsWithLength(int value){
			int i; 
			Wordlist wl = new Wordlist(10);
			for ( i = 0; i < count; i ++){
				if (list[i].length() == value){
					wl.add(list[i]);
				}
				return wl;
			}
		}
		
		public Wordlist wordBefore(String word1){
			int i; 
			Wordlist wl = new Wordlist(10);
			for ( i = 0; i < count; i ++){
				if (list[i].compareTo(word1) < 0) {
					wl.add(list[i]);
				}
				return wl;
			}
	
		}
		
		public int findLongestWord(){
			int i;
			int num = 0; 
			for ( i = 0; i < count; i ++){
				if (list[i].length() > num) {
					num = i; 
				}
			}
			return num; 
		}
		
		public Wordlist longestWords(){
			return wordsWithLength(findLongestWord());
		}