Package com.tagtraum.audiokern.segments
Class SimilarityList
- java.lang.Object
-
- com.tagtraum.audiokern.segments.SimilarityList
-
- All Implemented Interfaces:
Similarities
,Cloneable
,Iterable<Similarity>
,org.json.simple.JSONAware
public class SimilarityList extends Object implements Similarities, org.json.simple.JSONAware, Cloneable
Similarity list.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description SimilarityList(List<Similarity> similarities)
SimilarityList(org.json.simple.JSONObject jsonObject)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Similarities
alignWith(Beats beats)
Create a newSimilarities
object that contains beat/measure-aligned similarities.Object
clone()
int
count()
Number of similarities.boolean
equals(Object o)
int
hashCode()
Iterator<Similarity>
iterator()
int
size()
Size of list.String
toJSONString()
String
toString()
long[]
translate(long time, TimeUnit timeUnit)
Calculates other points in time, a given time is similar to.void
trim(int size)
Trims this list to the desired size, removing short similarities first.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.tagtraum.audiokern.segments.Similarities
stream
-
-
-
-
Constructor Detail
-
SimilarityList
public SimilarityList(List<Similarity> similarities)
-
SimilarityList
public SimilarityList(org.json.simple.JSONObject jsonObject)
-
-
Method Detail
-
translate
public long[] translate(long time, TimeUnit timeUnit)
Description copied from interface:Similarities
Calculates other points in time, a given time is similar to.- Specified by:
translate
in interfaceSimilarities
- Parameters:
time
- timetimeUnit
- time unit- Returns:
- array of times the given time is similar to
-
iterator
public Iterator<Similarity> iterator()
- Specified by:
iterator
in interfaceIterable<Similarity>
-
count
public int count()
Description copied from interface:Similarities
Number of similarities.- Specified by:
count
in interfaceSimilarities
- Returns:
- count or -1 if not known
-
alignWith
public Similarities alignWith(Beats beats)
Description copied from interface:Similarities
Create a newSimilarities
object that contains beat/measure-aligned similarities.- Specified by:
alignWith
in interfaceSimilarities
- Parameters:
beats
- beats- Returns:
- beat aligned similarities
- See Also:
Beats.changeTime(com.tagtraum.audiokern.timesignature.TimeSignature)
-
size
public int size()
Size of list.- Returns:
- size
-
trim
public void trim(int size)
Trims this list to the desired size, removing short similarities first.- Parameters:
size
- size to trim to
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-