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 Object
clone()
boolean
equals(Object o)
int
getDenominator()
The denominator of the time signature also known as "beat unit" or "note value of one beat", i.e.static TimeSignature
getInstance(int numerator, int denominator)
Create or re-use a time signature instance.int
getNumerator()
The numerator of the time signature also known as "beats per bar", i.e.int
hashCode()
void
readExternal(ObjectInput in)
void
setDenominator(int denominator)
Sets the denominator of the time signaturevoid
setNumerator(int numerator)
Sets the numerator of the time signature.String
toJSONString()
String
toString()
void
writeExternal(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 IllegalArgumentException
Sets 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 IllegalArgumentException
Sets 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:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-