Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. public interface ArrayListADT<T> extends Cloneable
  2. {
  3. public boolean isEmpty();
  4. //Method to determine whether the list is empty.
  5. //Postcondition: Returns true if the list is empty;
  6. // otherwise, returns false.
  7.  
  8. public boolean isFull();
  9. //Method to determine whether the list is full.
  10. //Postcondition: Returns true if the list is full;
  11. // otherwise, returns false.
  12.  
  13. public int listSize();
  14. //Method to return the number of elements in the list.
  15. //Postcondition: Returns the value of length.
  16.  
  17. public int maxListSize();
  18. //Method to return the maximum size of the list.
  19. //Postcondition: Returns the maximum number of elements
  20. // that can be inserted in the list.
  21.  
  22. public void print();
  23. //Method to output the elements of the list.
  24. //Postcondition: Elements of the list are output on the
  25. // standard output device.
  26.  
  27. public Object clone();
  28. //Returns a copy of objects data in store.
  29. //This method clones only the references stored in
  30. //the array. The objects that the array references
  31. //point to are not cloned.
  32.  
  33. public boolean isItemAtEqual(int location, T item);
  34. //Method to determine whether item is the same as the
  35. //item in the list at the position specified by location.
  36. //Postcondition: Returns true if the element in the list
  37. // at the position specified by location is
  38. // the same as item;
  39. // otherwise, returns false.
  40.  
  41. public void insertAt(int location, T insertItem);
  42. //Method to insert insertItem in the list at the position
  43. //specified by location.
  44. //Postcondition: Starting at location, the elements of
  45. // the list are shifted to make room for
  46. // insertItem; insertItem is inserted at
  47. // the position specified by location and
  48. // the length of the list is incremented
  49. // by 1. If the list is full or location
  50. // is out of range, an appropriate message
  51. // is output.
  52.  
  53. public void insertEnd(T insertItem);
  54. //Method to insert insertItem at the end of the list.
  55. //Postcondition: insertItem is inserted at the end of the
  56. // list and the length of the list is
  57. // incrmented by 1.
  58. // If the list is full, an appropriate
  59. // message is output.
  60.  
  61. public void removeAt(int location);
  62. //Method to remove the item from the list at the
  63. //position specified by location.
  64. //Postcondition: The element at the position specified by
  65. // location is removed from the list and
  66. // the length of the list is decremented by 1.
  67. // If location is out of range, an
  68. // appropriate message is output.
  69.  
  70. public T retrieveAt(int location);
  71. //Method to retrieve the element from the list at the
  72. //position specified by location.
  73. //Postcondition: A reference of the element at the
  74. // position specified by location is
  75. // returned. If location is out of range,
  76. // an appropriate message is output and
  77. // null is returned.
  78.  
  79. public void replaceAt(int location, T repItem);
  80. //Method to replace the element in the list at
  81. //the position specified by location with repItem.
  82. //Postcondition: repItem is inserted in the list at the
  83. // position specified by location.
  84. // If location is out of range, an
  85. // appropriate message is output.
  86.  
  87. public void clearList();
  88. //Method to remove all the elements from the list.
  89. //Postcondition: The length of the list is 0.
  90.  
  91. public int seqSearch(T searchItem);
  92. //Method to determine whether searchItem is in the list.
  93. //Postcondition: If searchItem is found, returns the
  94. // location in the array where searchItem
  95. // is found; otherwise, returns -1.
  96.  
  97. public void remove(T removeItem);
  98. //Method to remove an item from the list.
  99. //The parameter removeItem specifies the item to
  100. //be removed.
  101. //Postcondition: If removeItem is found in the list, it
  102. // is removed from the list and length is
  103. // decremented by one.
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement