Commits

Nzen committed 8b7ff1f

Unknown, just saving for next

There are some changes to these, but I don't know what they are. It has been months since I touched this project. However, the last challenge involves fixing the russian dolls test. So, I'm just committing whatever I did in anticipation of that.

Comments (0)

Files changed (3)

 			return T_Flag.f_seen;
 	}
 
-	// for lexer: diff flag signifies *, seen signifies @, unseen signifies ?
+	// state goes to initial; lexer: f_key == *, seen == @, unseen == ?
 	@Override
 	public T_Flag check_flag( char a_flag )
 	{
 		state = T_Flag.initial;
 		if ( a_flag == end.charAt( k_spot ) )
 		{
+			if ( previous == T_Flag.checking )
+				skip_list.set( focus, next_open );
 			save_char( a_flag );
 			return T_Flag.f_key;
 		}

TrieTestWhiteBox.java

 		fill_trie( all_ids );
 		boolean sole_assumption = only_first_char_seen( );
 		//return match_russian_dolls( all_ids ) && sole_assumption;
+		sole_assumption = match_russian_dolls( all_ids ) && sole_assumption;
 		show_trie();
-		System.out.print( "NOT MATCHING, JUST SHOWING. fix" );
-		return didnt;
+		System.out.print( "\nrussian dolls NOT MATCHING, JUST SHOWING. fix" );
+		return sole_assumption;
 	}
 
 	private void fill_trie( String[] all_ids )
 	// first id is longest, rest are decreasing size substrings
 	private boolean match_russian_dolls( String[] everything )
 	{
+		/*
+		test it as lexer ie see keys for the first two strings and seen for the other three
+		test that the letters were saved from the first, and then **???
+		test skiplist, ie from len of every[1] - [4], that the skips are increased by 1
+		 */
 		//alpha = "etaolin";
 		boolean worked = initial_assumption;
 		char key = '*';
 		IterableString only_word = new IterableString( everything[ longest ] );
 		for ( Character ln : only_word )
 		{
-			if ( ! later_ch_matches( everything[ longest ].charAt( should_be ), should_be - 1 ) )
+			// below reports string index overflow << FIX
+			if ( ! later_ch_matches( everything[ longest ].charAt( should_be ), should_be - 1 ) ) // overflows
 			{
 				System.out.printf( "mRd: didn't match first key %c at %d%n",
 						everything[ longest ].charAt( should_be ), should_be );
  - Alphabet
  seems fine
  - Trie
-
-index	  0|  1|  2|  3|  4|  5|  6|
-alpha	  t|  e|  a|  n|  o|  l|  i|
-jump	 -1|  0| -1| -1| -1| -1| -1|
-
-ind	  0|  1|  2|  3|  4|  5|  6|  7|  8|  9| 10|
-rest	  t|  a|  o|  l|  i|  n|  *|  *|  ?|  ?|  ?|
-skip	  0|  0| 10|  9|  8|  0|  0|  0|  0|  0|  0|NOT MATCHING, JUST SHOWING. fix - Lexer
-Needs more tests
-
+Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 8
+	at java.lang.String.charAt(Unknown Source)
+	at TrieTestWhiteBox.match_russian_dolls(TrieTestWhiteBox.java:274)
+	at TrieTestWhiteBox.case_russian_dolls(TrieTestWhiteBox.java:41)
+	at TestSuite.test_trie(TestSuite.java:102)
+	at Project2.run_tests(Project2.java:105)
+	at Project2.main(Project2.java:20)