60 lines
924 B
Java
60 lines
924 B
Java
package com.light.util;
|
||
|
||
import java.util.*;
|
||
/**
|
||
* @绫绘弿杩帮細浜嬩欢瀵硅薄闆嗕腑澶勭悊浠ュ強浜嬩欢鐨勭Щ闄や笌娣诲姞
|
||
* @椤圭洰鍚嶇О锛歋canDemo
|
||
* @鍖呭悕锛<E68295> piaost.base
|
||
* @绫诲悕绉帮細Event
|
||
* @鍒涘缓浜猴細Administrator
|
||
* @鍒涘缓鏃堕棿锛<E6A3BF>2016-5-25涓嬪崍4:18:02
|
||
*/
|
||
public class Event<T>
|
||
{
|
||
private List<T> m_List = new ArrayList<T>();
|
||
|
||
public void Add(T t)
|
||
{
|
||
if (t != null)
|
||
{
|
||
m_List.add(t);
|
||
}
|
||
}
|
||
|
||
public <M extends IEventExecute<T>> void Exeucte(M m) throws Exception
|
||
{
|
||
for (T item : m_List)
|
||
{
|
||
m.Execute(item);
|
||
}
|
||
}
|
||
|
||
public boolean Remove(T t)
|
||
{
|
||
if (t != null)
|
||
{
|
||
return m_List.remove(t);
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public void Clear()
|
||
{
|
||
m_List.clear();
|
||
}
|
||
|
||
public boolean Contants(T t)
|
||
{
|
||
if (t != null)
|
||
{
|
||
return m_List.contains(t);
|
||
}
|
||
return false;
|
||
}
|
||
|
||
public int size()
|
||
{
|
||
return m_List.size();
|
||
}
|
||
}
|