/** Parse a line from a serialized file */
  @SuppressWarnings("unchecked")
  @Override
  public void serializeParse(MarkerSerializer markerSerializer) {
    super.serializeParse(markerSerializer);

    Markers markers = markerSerializer.getNextFieldMarkers();
    for (Marker m : markers) add((T) m);
  }
  @SuppressWarnings("unchecked")
  @Override
  public IntervalAndSubIntervals<T> clone() {
    IntervalAndSubIntervals<T> copy = (IntervalAndSubIntervals<T>) super.clone();
    copy.reset();

    for (T m : this) {
      T mcopy = (T) m.clone();
      mcopy.setParent(copy);
      copy.add(mcopy);
    }

    return copy;
  }
  /** Apply a variant. */
  @Override
  @SuppressWarnings("unchecked")
  public IntervalAndSubIntervals<T> apply(Variant variant) {
    if (!shouldApply(variant)) return this;

    IntervalAndSubIntervals<T> newMarker = (IntervalAndSubIntervals<T>) super.apply(variant);
    if (newMarker == null) return null;
    newMarker.reset();

    for (T m : this) {
      T mcopy = (T) m.apply(variant);

      // Do not add if interval is completely removed
      if (mcopy != null) {
        mcopy.setParent(newMarker);
        newMarker.add(mcopy);
      }
    }

    return newMarker;
  }
 /** Add all markers */
 @SuppressWarnings("unchecked")
 public void addAll(Markers markers) {
   for (Marker m : markers) add((T) m);
   invalidateSorted();
 }
 /** Add all intervals */
 public void addAll(Iterable<T> ts) {
   for (T t : ts) add(t);
   invalidateSorted();
 }