Class TimeSignature
- java.lang.Object
-
- com.tagtraum.audiokern.timesignature.TimeSignature
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,org.json.simple.JSONAware
public class TimeSignature extends Object implements Externalizable, org.json.simple.JSONAware, Cloneable
Time signature. E.g. 3/4 for a waltz.- Author:
- Hendrik Schreiber
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimeSignature()TimeSignature(int numerator, int denominator)Time signature.TimeSignature(String jsonString)Instantiate from JSON string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()booleanequals(Object o)intgetDenominator()The denominator of the time signature also known as "beat unit" or "note value of one beat", i.e.static TimeSignaturegetInstance(int numerator, int denominator)Create or re-use a time signature instance.intgetNumerator()The numerator of the time signature also known as "beats per bar", i.e.inthashCode()voidreadExternal(ObjectInput in)voidsetDenominator(int denominator)Sets the denominator of the time signaturevoidsetNumerator(int numerator)Sets the numerator of the time signature.StringtoJSONString()StringtoString()voidwriteExternal(ObjectOutput out)
-
-
-
Constructor Detail
-
TimeSignature
public TimeSignature(int numerator, int denominator)Time signature.- Parameters:
numerator- numeratordenominator- denominator
-
TimeSignature
public TimeSignature()
-
TimeSignature
public TimeSignature(String jsonString)
Instantiate from JSON string.- Parameters:
jsonString- data string- See Also:
toJSONString()
-
-
Method Detail
-
getInstance
public static TimeSignature getInstance(int numerator, int denominator)
Create or re-use a time signature instance.- Parameters:
numerator- numeratordenominator- denominator- Returns:
- instance
-
getNumerator
public int getNumerator()
The numerator of the time signature also known as "beats per bar", i.e. for a waltz in 3/4 time this method would return a 3.- Returns:
- meter numerator
- See Also:
setNumerator(int)
-
setNumerator
public void setNumerator(int numerator) throws IllegalArgumentExceptionSets the numerator of the time signature.- Parameters:
numerator- meter numerator- Throws:
IllegalArgumentException- if the value is less than 1- See Also:
getNumerator()
-
getDenominator
public int getDenominator()
The denominator of the time signature also known as "beat unit" or "note value of one beat", i.e. for a waltz in 3/4 time this method would return a 4.- Returns:
- meter denominator
-
setDenominator
public void setDenominator(int denominator) throws IllegalArgumentExceptionSets the denominator of the time signature- Parameters:
denominator- meter denominator- Throws:
IllegalArgumentException- if the value is less than 1- See Also:
getDenominator()
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
toJSONString
public String toJSONString()
- Specified by:
toJSONStringin interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-