org.teamapps.ux.component.media.MediaTrackData Maven / Gradle / Ivy
/*-
* ========================LICENSE_START=================================
* TeamApps
* ---
* Copyright (C) 2014 - 2024 TeamApps.org
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =========================LICENSE_END==================================
*/
package org.teamapps.ux.component.media;
import org.teamapps.dto.UiMediaTrackData;
import org.teamapps.dto.UiMediaTrackMarker;
import java.util.ArrayList;
import java.util.List;
public class MediaTrackData {
private int trackCount;
private List markerData = new ArrayList<>();
private List data = new ArrayList<>();
public MediaTrackData() {
}
public List getMarkers() {
List markers = new ArrayList<>();
for (TrackMarkerData marker : markerData) {
markers.add(marker.createMarker());
}
return markers;
}
public List getTrackData() {
List result = new ArrayList<>();
for (TrackData trackData : data) {
UiMediaTrackData td = new UiMediaTrackData();
td.setTime(trackData.getTime());
td.setValues(trackData.getValues());
result.add(td);
}
return result;
}
public void addMarker(TrackMarkerData marker) {
markerData.add(marker);
}
public void addData(long time, int[] values) {
List list = new ArrayList<>();
for (int value : values) {
list.add(value);
}
data.add(new TrackData(time, list));
}
private void addData(long time, List values) {
data.add(new TrackData(time, values));
}
public int getTrackCount() {
return trackCount;
}
public void setTrackCount(int trackCount) {
this.trackCount = trackCount;
}
public List getMarkerData() {
return markerData;
}
public void setMarkerData(List markerData) {
this.markerData = markerData;
}
public List getData() {
return data;
}
public void setData(List data) {
this.data = data;
}
class TrackData {
private long time;
private List values;
public TrackData(long time, List values) {
this.time = time;
this.values = values;
}
public long getTime() {
return time;
}
public List getValues() {
return values;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy