twaver.model
Class HashCollection<T extends Data>

java.lang.Object
  extended by twaver.model.HashList<T>
      extended by twaver.model.HashCollection<T>
Type Parameters:
T - 容器内数据的类型
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Collection<T>, IHashCollection<T>, IHashList<T>, IHandler<ListEvent<T>>, IFilter<T>
Direct Known Subclasses:
DataBox, SelectionModel

public class HashCollection<T extends Data>
extends HashList<T>
implements IHashCollection<T>

数据容器,继承于 HashList,增加数据元素事件监听管理,以及过滤功能,是数据管理容器的基类


Field Summary
 
Fields inherited from class twaver.model.HashList
dataList, dataMap
 
Constructor Summary
HashCollection()
          构造函数,数据容器,继承于 HashList,增加数据元素事件监听管理,以及过滤功能,是数据管理容器的基类
 
Method Summary
protected  boolean _remove(int id, T data)
           
 boolean accept(T target)
          是否接受
 boolean add(java.util.Collection<? extends T> datas, int index)
           
 boolean add(T data, int index)
           
 boolean clearAll()
           
 FilterDispatcher<T> getFilterDispatcher()
          获取过滤派发器,可通过此对象添加或删除过滤器
 IDispatcher<ListEvent<T>> getListChangeDispatcher()
           
protected  void onClear()
          容器被清空
 boolean remove(java.util.Collection<? extends T> datas)
           
 boolean setIndex(int index, T data)
           
 void setListener(IListener<ListEvent<T>> listener)
          设置监听器
 
Methods inherited from class twaver.model.HashList
add, add, add, addAll, addLast, clear, contains, contains, containsAll, containsById, doAdd, doRemove, forEach, forEach, forEachReverse, getById, getByIndex, getDatas, getLastData, indexOf, isEmpty, iterator, remove, remove, removeAll, removeById, removeByIndex, retainAll, reverseIterator, set, set, size, sort, toArray, toArray, toDatas, toDatas
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface twaver.core.model.IHashList
add, add, contains, containsById, forEach, forEachReverse, getById, getByIndex, getDatas, getLastData, indexOf, isEmpty, remove, removeById, reverseIterator, set, set, size, toDatas
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

HashCollection

public HashCollection()
构造函数,数据容器,继承于 HashList,增加数据元素事件监听管理,以及过滤功能,是数据管理容器的基类

Method Detail

setIndex

public boolean setIndex(int index,
                        T data)
Specified by:
setIndex in interface IHashList<T extends Data>
Overrides:
setIndex in class HashList<T extends Data>

add

public boolean add(T data,
                   int index)
Specified by:
add in interface IHashList<T extends Data>
Overrides:
add in class HashList<T extends Data>

add

public boolean add(java.util.Collection<? extends T> datas,
                   int index)
Specified by:
add in interface IHashList<T extends Data>
Overrides:
add in class HashList<T extends Data>

remove

public boolean remove(java.util.Collection<? extends T> datas)
Specified by:
remove in interface IHashList<T extends Data>
Overrides:
remove in class HashList<T extends Data>

clearAll

public boolean clearAll()
Specified by:
clearAll in interface IHashList<T extends Data>
Overrides:
clearAll in class HashList<T extends Data>

onClear

protected void onClear()
容器被清空


_remove

protected boolean _remove(int id,
                          T data)
Overrides:
_remove in class HashList<T extends Data>

setListener

public void setListener(IListener<ListEvent<T>> listener)
Description copied from interface: IHandler
设置监听器

Specified by:
setListener in interface IHandler<ListEvent<T extends Data>>
Parameters:
listener - 监听器

getFilterDispatcher

public FilterDispatcher<T> getFilterDispatcher()
获取过滤派发器,可通过此对象添加或删除过滤器

Returns:
过滤派发器

accept

public boolean accept(T target)
Description copied from interface: IFilter
是否接受

Specified by:
accept in interface IFilter<T extends Data>
Parameters:
target - 数据元素
Returns:
是否接受

getListChangeDispatcher

public IDispatcher<ListEvent<T>> getListChangeDispatcher()
Specified by:
getListChangeDispatcher in interface IHashCollection<T extends Data>