示例#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;
  }
示例#2
0
  private Collection<BaseDanmaku> subset(long startTime, long endTime) {
    if (mSortType == ST_BY_LIST || items == null || items.size() == 0) {
      return null;
    }
    if (subItems == null) {
      subItems = new Danmakus(mDuplicateMergingEnabled);
    }
    if (startSubItem == null) {
      startSubItem = createItem("start");
    }
    if (endSubItem == null) {
      endSubItem = createItem("end");
    }

    startSubItem.time = startTime;
    endSubItem.time = endTime;
    return ((SortedSet<BaseDanmaku>) items).subSet(startSubItem, endSubItem);
  }