Files
demo-ickwrite/src/com/light/util/Event.java
2018-05-20 21:07:42 +08:00

60 lines
924 B
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
}
}