View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  
23  package org.opencastproject.metadata.mpeg7;
24  
25  import org.opencastproject.mediapackage.XmlElement;
26  
27  import java.util.Iterator;
28  
29  /**
30   * This interface describes that basis for a temporal decomposition of an audio, video or audiovisual content element.
31   */
32  public interface TemporalDecomposition<T extends Segment> extends XmlElement {
33  
34    /**
35     * Criteria of decomposition.
36     */
37    enum DecompositionCriteria {
38      Temporal
39    };
40  
41    /**
42     * Set the <code>hasGap</code> property indicating that there may be gaps in between the segments.
43     *
44     * @param hasGap
45     *          <code>true</code> if there are gaps
46     */
47    void setGap(boolean hasGap);
48  
49    /**
50     * Returns <code>true</code> if the segment has a gap.
51     *
52     * @return <code>true</code> if the segment has a gap
53     */
54    boolean hasGap();
55  
56    /**
57     * Set the <code>isOverlapping</code> property indicating that some segments may be overlapping.
58     *
59     * @param isOverlapping
60     *          <code>true</code> if elements are overlapping
61     */
62    void setOverlapping(boolean isOverlapping);
63  
64    /**
65     * Returns <code>true</code> if the segment overlaps with another one.
66     *
67     * @return <code>true</code> if the segment overlaps
68     */
69    boolean isOverlapping();
70  
71    /**
72     * Sets the decomposition criteria.
73     *
74     * @param criteria
75     *          the criteria
76     */
77    void setCriteria(DecompositionCriteria criteria);
78  
79    /**
80     * Returns the decomposition criteria.
81     *
82     * @return the criteria
83     */
84    DecompositionCriteria getCriteria();
85  
86    /**
87     * Creates a new segment and returns it.
88     *
89     * @param id
90     *          the segment identifier
91     * @return the new segment
92     */
93    T createSegment(String id);
94  
95    /**
96     * Returns <code>true</code> if the composition actually contains segments.
97     *
98     * @return <code>true</code> if there are segments
99     */
100   boolean hasSegments();
101 
102   /**
103    * Returns an iteration of the video's segments.
104    *
105    * @return the video segments
106    */
107   Iterator<T> segments();
108 
109   /**
110    * Returns the segment with the given identifier or <code>null</code> if the segment does not exist.
111    *
112    * @param segmentId
113    *          the segment identifier
114    * @return the segment
115    */
116   T getSegmentById(String segmentId);
117 
118 }