• Post Reply Bookmark Topic Watch Topic
  • New Topic

I am stuck in cross reference  RSS feed

 
Wing Kai Lam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everbody as i got a problem and i have no idea how to start with and the problem is that i need to create a cross reference map for a Java source file.

detail show below

it mean that the input to the program is a Java source file. The program will first read each program line and remember the line number. It then picks out each identifier in the line and keep this piece of information (the identifier and the line number) inside a data structure for later generation of the cross-reference map. Finally, the cross-reference map is output. In the cross-reference map, the identifiers should be listed in alphabetical order, and the line numbers on which each identifier appears should be listed in ascending order

and i must use tokenizer, LinkedList, BinarySearchTree, to do it rather than mapping method and i have no idea that how to start it and do it can someone help me please?
 
Wesleigh Pieters
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really struggle to follow what you are trying to say, please review what you are asking in a more coherent simplistic way.

From what I do gather though I would use a Map implementation and then sort it.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Why have you been told to use a Tokenizer, because it may be legacy code, not recommended for new code?
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Wing Kai Lam, and welcome to the Ranch! Like Wesleigh, I'm not entirely sure what you are looking for, but if I understood your post correctly you might find a SortedMap<String, SortedSet<Integer>> suitable.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:but if I understood your post correctly you might find a SortedMap<String, SortedSet<Integer>> suitable.

And another class you might find useful is LineNumberReader.

Winston
 
Wesleigh Pieters
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:
Darryl Burke wrote:but if I understood your post correctly you might find a SortedMap<String, SortedSet<Integer>> suitable.

And another class you might find useful is LineNumberReader.

Winston


very cool that nice
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!