twaver.model
Class HashList<T extends Identifiable>

java.lang.Object
  extended by twaver.model.HashList<T>
Type Parameters:
T -
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Collection<T>, IHashList<T>
Direct Known Subclasses:
HashCollection

public class HashList<T extends Identifiable>
extends java.lang.Object
implements IHashList<T>, java.util.Collection<T>

兼具ListMap功能的数据集合,是twaver数据容器的基础,twaver内部使用


Field Summary
protected  java.util.ArrayList<T> dataList
           
protected   dataMap
           
 
Constructor Summary
HashList()
          构造函数
 
Method Summary
protected  boolean _remove(int id, T data)
           
 boolean add(java.util.Collection<? extends T> datas)
           
 boolean add(java.util.Collection<? extends T> datas, int index)
           
 void add(HashList<T> datas)
           
 boolean add(T data)
           
 boolean add(T data, int index)
           
 boolean addAll(java.util.Collection<? extends T> collection)
           
 boolean addLast(T data)
           
 void clear()
           
 boolean clearAll()
           
 boolean contains(java.lang.Object object)
           
 boolean contains(T data)
           
 boolean containsAll(java.util.Collection<?> collection)
           
 boolean containsById(int id)
           
protected  void doAdd(int index, T data)
           
protected  boolean doRemove(int id, T data)
           
 boolean forEach(Action<T> action)
           
 boolean forEach(Action<T> action, java.lang.Class<? extends T> type)
           
 boolean forEachReverse(Action<T> action)
           
 T getById(int id)
           
 T getByIndex(int index)
           
 java.util.List<T> getDatas()
           
 T getLastData()
           
 int indexOf(T data)
           
 boolean isEmpty()
           
 java.util.Iterator<T> iterator()
           
 boolean remove(java.util.Collection<? extends T> datas)
           
 boolean remove(java.lang.Object object)
           
 boolean remove(T data)
           
 boolean removeAll(java.util.Collection<?> collection)
           
 boolean removeById(int id)
           
 boolean removeByIndex(int index)
           
 boolean retainAll(java.util.Collection<?> collection)
           
 java.lang.Iterable<T> reverseIterator()
           
 boolean set(java.util.Collection<? extends T> datas)
           
 boolean set(T data)
           
 boolean setIndex(int index, T data)
           
 int size()
           
 void sort(java.util.Comparator<T> comparator)
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] array)
           
 java.util.List<T> toDatas()
           
 java.util.List<T> toDatas(IFilter<T> filter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

dataList

protected java.util.ArrayList<T extends Identifiable> dataList

dataMap

protected  dataMap
Constructor Detail

HashList

public HashList()
构造函数

Method Detail

getById

public T getById(int id)
Specified by:
getById in interface IHashList<T extends Identifiable>

getByIndex

public T getByIndex(int index)
Specified by:
getByIndex in interface IHashList<T extends Identifiable>

getDatas

public java.util.List<T> getDatas()
Specified by:
getDatas in interface IHashList<T extends Identifiable>

forEach

public boolean forEach(Action<T> action,
                       java.lang.Class<? extends T> type)

forEach

public boolean forEach(Action<T> action)
Specified by:
forEach in interface IHashList<T extends Identifiable>

forEachReverse

public boolean forEachReverse(Action<T> action)
Specified by:
forEachReverse in interface IHashList<T extends Identifiable>

size

public int size()
Specified by:
size in interface java.util.Collection<T extends Identifiable>
Specified by:
size in interface IHashList<T extends Identifiable>

contains

public boolean contains(T data)
Specified by:
contains in interface IHashList<T extends Identifiable>

containsById

public boolean containsById(int id)
Specified by:
containsById in interface IHashList<T extends Identifiable>

setIndex

public boolean setIndex(int index,
                        T data)
Specified by:
setIndex in interface IHashList<T extends Identifiable>

indexOf

public int indexOf(T data)
Specified by:
indexOf in interface IHashList<T extends Identifiable>

add

public boolean add(T data)
Specified by:
add in interface java.util.Collection<T extends Identifiable>
Specified by:
add in interface IHashList<T extends Identifiable>

add

public boolean add(T data,
                   int index)
Specified by:
add in interface IHashList<T extends Identifiable>

addLast

public boolean addLast(T data)

add

public boolean add(java.util.Collection<? extends T> datas)
Specified by:
add in interface IHashList<T extends Identifiable>

add

public void add(HashList<T> datas)

add

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

remove

public boolean remove(T data)
Specified by:
remove in interface IHashList<T extends Identifiable>

removeById

public boolean removeById(int id)
Specified by:
removeById in interface IHashList<T extends Identifiable>

removeByIndex

public boolean removeByIndex(int index)

remove

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

set

public boolean set(T data)
Specified by:
set in interface IHashList<T extends Identifiable>

set

public boolean set(java.util.Collection<? extends T> datas)
Specified by:
set in interface IHashList<T extends Identifiable>

clearAll

public boolean clearAll()
Specified by:
clearAll in interface IHashList<T extends Identifiable>

toDatas

public java.util.List<T> toDatas()
Specified by:
toDatas in interface IHashList<T extends Identifiable>

toDatas

public java.util.List<T> toDatas(IFilter<T> filter)

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<T extends Identifiable>
Specified by:
isEmpty in interface IHashList<T extends Identifiable>

_remove

protected boolean _remove(int id,
                          T data)

doAdd

protected void doAdd(int index,
                     T data)

doRemove

protected boolean doRemove(int id,
                           T data)

getLastData

public T getLastData()
Specified by:
getLastData in interface IHashList<T extends Identifiable>

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T extends Identifiable>
Specified by:
iterator in interface java.util.Collection<T extends Identifiable>

reverseIterator

public java.lang.Iterable<T> reverseIterator()
Specified by:
reverseIterator in interface IHashList<T extends Identifiable>

sort

public void sort(java.util.Comparator<T> comparator)

addAll

public boolean addAll(java.util.Collection<? extends T> collection)
Specified by:
addAll in interface java.util.Collection<T extends Identifiable>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<T extends Identifiable>

contains

public boolean contains(java.lang.Object object)
Specified by:
contains in interface java.util.Collection<T extends Identifiable>

containsAll

public boolean containsAll(java.util.Collection<?> collection)
Specified by:
containsAll in interface java.util.Collection<T extends Identifiable>

remove

public boolean remove(java.lang.Object object)
Specified by:
remove in interface java.util.Collection<T extends Identifiable>

removeAll

public boolean removeAll(java.util.Collection<?> collection)
Specified by:
removeAll in interface java.util.Collection<T extends Identifiable>

retainAll

public boolean retainAll(java.util.Collection<?> collection)
Specified by:
retainAll in interface java.util.Collection<T extends Identifiable>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<T extends Identifiable>

toArray

public <T> T[] toArray(T[] array)
Specified by:
toArray in interface java.util.Collection<T extends Identifiable>