/**
* The model can only store up to MAX_RECORDS
*/
public static final int MAX_RECORDS = 10000;
/**
* The array storing the records
*/
protected Entity[] allRecords;
/**
* The number of records being stored
*/
protected int totalRecords;
/**
* The current record index. The main purpose of the class is to
* maintain this.
*/
protected int current;
/**
* A count of the number of records that have been marked for deletion
*/
protected int delRecCount;
// CONSTRUCTORS
/**
* Creates a EntityModel capable of storing MAX_RECORDS using
* an array
*
* The current position is set to -1 (undefined)
*
* Creates the array
*
* Sets current to be -1
*
*
*/
public EntityModel() {
//TODO
}
// INSERTING RECORDS
public Entity add(Entity entity) {
//TODO
return null; //remove or modify this line as needed
}
Posted Sep 25, 2013, 2:03 AM
EntityModel.Java
Entity.Java (Replace this class with your actual entity class)
EntryPoint.java (To test EntityModel.java class)
The entire source code is attached.
Hope this helps you !
Please let me know, if you need anything.
AlexPosted Sep 25, 2013, 2:28 AM
Thanx a lot
AlexPosted Sep 25, 2013, 1:39 AM
This method adds the entity to the array. It will need to increment the totalRecords counter and also check if the entity being added is marked for deletion.
Posted Sep 25, 2013, 1:24 AM
Do you want to implement add() method?