Exemple #1
0
 public Danmakus(int sortType, boolean duplicateMergingEnabled) {
   BaseComparator comparator = null;
   if (sortType == ST_BY_TIME) {
     comparator = new TimeComparator(duplicateMergingEnabled);
   } else if (sortType == ST_BY_YPOS) {
     comparator = new YPosComparator(duplicateMergingEnabled);
   } else if (sortType == ST_BY_YPOS_DESC) {
     comparator = new YPosDescComparator(duplicateMergingEnabled);
   }
   if (sortType == ST_BY_LIST) {
     items = new LinkedList<BaseDanmaku>();
   } else {
     mDuplicateMergingEnabled = duplicateMergingEnabled;
     comparator.setDuplicateMergingEnabled(duplicateMergingEnabled);
     items = new TreeSet<BaseDanmaku>(comparator);
     mComparator = comparator;
   }
   mSortType = sortType;
   mSize = 0;
   iterator = new DanmakuIterator(items);
 }
Exemple #2
0
 private void setDuplicateMergingEnabled(boolean enable) {
   mComparator.setDuplicateMergingEnabled(enable);
   mDuplicateMergingEnabled = enable;
 }