File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Please drop some comments to improve this program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please drop some comments to improve this program" Watch "Please drop some comments to improve this program" New topic
Author

Please drop some comments to improve this program

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
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

Joined: Mar 02, 2003
Posts: 233

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

Joined: Jan 08, 2004
Posts: 834
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

Joined: Jul 22, 2000
Posts: 9047
    
  10
Do you need the synchronization that Vector uses? Would ArrayList be better in this instance?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
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

Joined: Jul 22, 2000
Posts: 9047
    
  10
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

Joined: Jan 08, 2004
Posts: 834
oh....tq
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please drop some comments to improve this program