/**
* 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 24, 2013, 10:03 PM EDT
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.
Posted Sep 24, 2013, 9:24 PM EDT
Do you want to implement add() method?
Alex50 reputationPosted Sep 24, 2013, 9:39 PM EDT
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.
Alex50 reputationPosted Sep 24, 2013, 10:28 PM EDT
Thanx a lot
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts