KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > smb > server > notify > NotifyChangeEventList


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.smb.server.notify;
18
19 import java.util.Vector JavaDoc;
20
21 /**
22  * Notify Change Event List Class
23  */

24 public class NotifyChangeEventList
25 {
26
27     // List of notify events
28

29     private Vector JavaDoc<NotifyChangeEvent> m_list;
30
31     /**
32      * Default constructor
33      */

34     public NotifyChangeEventList()
35     {
36         m_list = new Vector JavaDoc<NotifyChangeEvent>();
37     }
38
39     /**
40      * Return the count of notify events
41      *
42      * @return int
43      */

44     public final int numberOfEvents()
45     {
46         return m_list.size();
47     }
48
49     /**
50      * Return the specified change event
51      *
52      * @param idx int
53      * @return NotifyChangeEvent
54      */

55     public final NotifyChangeEvent getEventAt(int idx)
56     {
57
58         // Range check the index
59

60         if (idx < 0 || idx >= m_list.size())
61             return null;
62
63         // Return the required notify event
64

65         return m_list.get(idx);
66     }
67
68     /**
69      * Add a change event to the list
70      *
71      * @param evt NotifyChangeEvent
72      */

73     public final void addEvent(NotifyChangeEvent evt)
74     {
75         m_list.add(evt);
76     }
77
78     /**
79      * Remove the specified change event
80      *
81      * @param idx int
82      * @return NotifyChangeEvent
83      */

84     public final NotifyChangeEvent removeEventAt(int idx)
85     {
86
87         // Range check the index
88

89         if (idx < 0 || idx >= m_list.size())
90             return null;
91
92         // Return the required notify event
93

94         return m_list.remove(idx);
95     }
96
97     /**
98      * Remove all events from the list
99      */

100     public final void removeAllEvents()
101     {
102         m_list.removeAllElements();
103     }
104 }
105
Popular Tags