1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.cb.cardboard;
21
22 import java.util.List;
23
24 /***
25 * This interface defines the methods components like JCardBoard use
26 * to get the value of each card in a board and the length of the list.
27 * Logically the model is a vector, indices vary from 0 to
28 * CardBoardModel.getSize() - 1. Any change to the contents or
29 * length of the data model must be reported to all of the
30 * CardBoardModelListener.
31 *
32 * @author jerome@coffeebreaks.org - last modified by $LastChangedBy: jerome $
33 * @version $Id: CardBoardModel.java 123 2004-04-14 23:45:53Z jerome $
34 */
35 public interface CardBoardModel
36 {
37 /***
38 * Returns the number of cards on the board.
39 * @return the length of the list
40 */
41 int getSize();
42
43 /***
44 * Returns the value at the specified index.
45 * @param index the requested index
46 * @return the value at <code>index</code>
47 */
48 Card getElementAt(int index);
49
50
51 /***
52 * @return all the values.
53 */
54 List getElements();
55
56 /***
57 * Adds a listener to the list that's notified each time a change
58 * to the data model occurs.
59 * @param listener the <code>CardBoardModelListener</code> to be added
60 */
61 void addBoardDataListener(CardBoardModelListener listener);
62
63 /***
64 * Removes a listener from the list that's notified each time a
65 * change to the data model occurs.
66 * @param listener the <code>CardBoardModelListener</code> to be removed
67 */
68 void removeBoardDataListener(CardBoardModelListener listener);
69 }