Example #1
0
  @Override
  public IDanmakus sub(long startTime, long endTime) {
    if (mSortType == ST_BY_LIST || items == null || items.size() == 0) {
      return null;
    }
    if (subItems == null) {
      subItems = new Danmakus(mDuplicateMergingEnabled);
    }
    if (startItem == null) {
      startItem = createItem("start");
    }
    if (endItem == null) {
      endItem = createItem("end");
    }

    if (subItems != null) {
      long dtime = startTime - startItem.time;
      if (dtime >= 0 && endTime <= endItem.time) {
        return subItems;
      }
    }

    startItem.time = startTime;
    endItem.time = endTime;
    subItems.setItems(((SortedSet<BaseDanmaku>) items).subSet(startItem, endItem));
    return subItems;
  }
Example #2
0
 public Danmakus(Collection<BaseDanmaku> items) {
   setItems(items);
 }