• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please drop some comments to improve this program

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, expert here , i'm new in java , currently doing my assignment which is under software architecture subject . purpose for this assignment is to develop a program which base on better perfomance, saving memory space, faster and so on .
this assignment is actually belongs to KWIC (keyword in context)architecture problem I - shared data architecture .
as for below class, it one of my program part, this class use to circular the user input text, but i use some sample text to do it first. generally , the first element of text will append to last element of text and then second element will shift to first element and following .


as for result :

ARCHITECTURE WINS TECHNOLOGY WARS HOW
WINS TECHNOLOGY WARS HOW ARCHITECTURE
TECHNOLOGY WARS HOW ARCHITECTURE WINS
WARS HOW ARCHITECTURE WINS TECHNOLOGY
 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When is this boolean set to True??? Because it skips the while statement. If it's default is false, then just remove it as a boolean. Unless I'm missing a method. I do that sometimes.
[ January 16, 2004: Message edited by: Steve Wysocki ]
[ January 16, 2004: Message edited by: Steve Wysocki ]
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
boolean "chgStrControl" variable will set true after display the first line of result , it show in last three line of code. besides, chgStrControl variable actually use for decide to take latest appended string for tokenize..
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you need the synchronization that Vector uses? Would ArrayList be better in this instance?
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my reason to use vector is because of i can add string to tokenize without using any wasted space , in this program , you see input string "how architecture win technology wars" , but in fact , it actually for testing purpose , this program suppose let user keyin input string rather than predefine, so if user keyin in 10 words to tokenize, i need only need one vector with 10 elements, so it save space rather prefix the size of array ..
anyway , is it better i use arraylist ? what is the reason behind ...tq
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vector is an old class that uses synchronization. ArrayList does almost the same thing without the synchronization, so it's faster.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh....tq
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic