1: /** Adds a new entry to this bag.
2: @param newEntry the object to be added as a new entry.
3: @return true if the addition is successful, or false if not. */
4: public boolean add(T newEntry)
5: {
6: boolean result = true;
7: if (isArrayFull())
8: {
9: result = false;
10: }
11: else
12: { // Assertion: result is true here
13: bag[numberOfEntries] = newEntry;
14: numberOfEntries++;
15: } // end if
16:
17: return result;
18: } // end add