aspose file tools*
The moose likes Java in General and the fly likes Most Difficult Assignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Most Difficult Assignment" Watch "Most Difficult Assignment" New topic
Author

Most Difficult Assignment

kashif hameed
Greenhorn

Joined: Jun 15, 2003
Posts: 15
OPERATION BADAR
COMPULSORY ASSIGNMENT FOR STUDENTS WHO HAVE COMPLETED MODULE 9
Though the most efficient choice to hold a group of objects is an array, its size is fixed and this can be a constraint if number of elements is not known at compile-time. If we don’t don’t know in advance how many objects we would be storing, we can use Vector class of java.util package that, unlike an array, expands automatically when required and there is no limit to the number of elements one can add into it. This class implements the java.util.Collection interface. For this assignment, you have to write your own collection class with the name BadarVector implementing BadarCollection interface and having functionality and efficiency as much equivalent as possible to the Vector class. Also, one often needs to traverse through the sequence of stored objects. In case of using the java.util.Vector class, the method iterator() of this class returns an object of the Iterator type. The methods of this object are, in turn, used for traversing through the structure. Write your own class for iteration having the name BadarIteration implementing BadarIterator interface and providing the desired functionality of lightweight traversing. The source code of the two above mentioned interfaces is written below:
public interface BadarCollection
{
void add( int index, Object element);
boolean add(Object o);
int capacity();
int size();
void clear();
Object elementAt(int index);
Object firstElement();
Object lastElement();
Object remove(int index);
boolean remove (Object o);
BadarIterator iterator();
}
public interface BadarIterator
{
boolean hasNext();
Object next();
}
Note: To measure the performance of your class methods, you can use System.currentTimeMillis() at the start and end of the main method of your test class. The difference of time will indicate the approximate time consumed to perform the actions specified in between. Just call any method, say addElement(Object), of your class a considerable number of times and note down the time it took main call to return. Then call method of the same name in the Vector class same number of times and compare the time difference
Who gesign this
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You just want someone to do your homework for your??
:roll:


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Most Difficult Assignment