All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.ui.api.impl.UiMediaImpl Maven / Gradle / Ivy

/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.ui.api.impl;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import io.github.mmm.ui.api.datatype.media.UiMedia;
import io.github.mmm.ui.api.datatype.media.UiMediaPreview;
import io.github.mmm.ui.api.datatype.media.UiMediaSource;
import io.github.mmm.ui.api.datatype.media.UiMediaTrack;
import io.github.mmm.ui.api.datatype.media.UiMediaType;

/**
 * Implementation of {@link UiMedia}.
 */
public class UiMediaImpl implements UiMedia {

  private final UiMediaType type;

  private final UiMediaPreview preview;

  private final List sources;

  private final List tracks;

  /**
   * The constructor.
   *
   * @param type the {@link #getType() type}.
   * @param sources the {@link #getSources() sources}.
   * @param tracks the {@link #getTracks() tracks}.
   * @param preview the {@link #getPreview() preview}. May be {@code null}.
   */
  public UiMediaImpl(UiMediaType type, UiMediaSource[] sources, UiMediaTrack[] tracks, UiMediaPreview preview) {

    super();

    this.type = type;
    this.sources = Arrays.asList(sources);
    if (tracks == null) {
      this.tracks = Collections.emptyList();
    } else {
      this.tracks = Arrays.asList(tracks);
    }
    this.preview = preview;
  }

  @Override
  public UiMediaType getType() {

    return this.type;
  }

  @Override
  public UiMediaPreview getPreview() {

    return this.preview;
  }

  @Override
  public Iterable getSources() {

    return this.sources;
  }

  @Override
  public Iterable getTracks() {

    return this.tracks;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy