ritornello.core.conceitual
Class Scale

java.lang.Object
  |
  +--ritornello.core.conceitual.Scale
All Implemented Interfaces:
Collection

public class Scale
extends java.lang.Object
implements Collection


Field Summary
static int CHROMATIC
          The chromatic code.
static int MAJOR
          The major scale code.
static int MINOR_HARMONIC
          The minor harmonic scale code.
static int MINOR_MELODIC
          The minor melodic scale code.
 
Constructor Summary
Scale(Note root)
          Constructor.
 
Method Summary
 void addElement(java.lang.Object object)
           
static Scale getChromatic(Note root)
          Returns a build chromatic scale, given its root.
 java.util.Iterator getElements()
           
 java.util.Vector getIntervalList()
          Returns a list of all intervals of the given scale.
static Scale getMajor(Note root)
          Returns a build major scale, given its root.
static Scale getMinorHarmonic(Note root)
          Returns a build minor harmonic scale, given its root.
static Scale getMinorMelodic(Note root)
          Returns a build minor melodic scale, given its root.
 java.lang.String getName()
          Retrieves the scale name.
 Note getNoteByDegree(int degree)
          Retrieves a note from scale, given its degree.
 Note getRoot()
          Returns the scale root note.
 Chord getTriadByDegree(int degree)
          Retrieves a chord, given its degree in scale.
 int getValue()
          Retrieves the scale code (e.g. 0=CHROMATIC; 1=MAJOR,...).
static void main(java.lang.String[] argv)
          Test unit.
 void removeAllElements()
           
 boolean removeElement(java.lang.Object object)
           
 void setRoot(Note root)
          Sets the scale's root note.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAJOR

public static final int MAJOR
The major scale code.

See Also:
Constant Field Values

MINOR_MELODIC

public static final int MINOR_MELODIC
The minor melodic scale code.

See Also:
Constant Field Values

MINOR_HARMONIC

public static final int MINOR_HARMONIC
The minor harmonic scale code.

See Also:
Constant Field Values

CHROMATIC

public static final int CHROMATIC
The chromatic code.

See Also:
Constant Field Values
Constructor Detail

Scale

public Scale(Note root)
Constructor. Sets the root note.

Parameters:
root - - The root note.
Method Detail

getChromatic

public static Scale getChromatic(Note root)
                          throws ValidationException,
                                 IncompatibleElementException
Returns a build chromatic scale, given its root.

Parameters:
root - - The root note.
Returns:
Scale
Throws:
ValidationException
IncompatibleElementException

getMinorHarmonic

public static Scale getMinorHarmonic(Note root)
                              throws ValidationException,
                                     IncompatibleElementException
Returns a build minor harmonic scale, given its root.

Parameters:
root - - The root note.
Returns:
Scale
Throws:
ValidationException
IncompatibleElementException

getMajor

public static Scale getMajor(Note root)
                      throws ValidationException,
                             IncompatibleElementException
Returns a build major scale, given its root.

Parameters:
root - - The root note.
Returns:
Scale
Throws:
ValidationException
IncompatibleElementException

getMinorMelodic

public static Scale getMinorMelodic(Note root)
                             throws ValidationException,
                                    IncompatibleElementException
Returns a build minor melodic scale, given its root.

Parameters:
root - - The root note.
Returns:
Scale
Throws:
ValidationException
IncompatibleElementException

getIntervalList

public java.util.Vector getIntervalList()
                                 throws ValidationException
Returns a list of all intervals of the given scale.

Returns:
java.util.Vector
Throws:
ValidationException

getRoot

public Note getRoot()
Returns the scale root note.

Returns:
DesignModel.mx.Note

setRoot

public void setRoot(Note root)
Sets the scale's root note.

Parameters:
root - - The root note.

getName

public java.lang.String getName()
                         throws ValidationException
Retrieves the scale name.

Returns:
String
Throws:
ValidationException

removeElement

public boolean removeElement(java.lang.Object object)
Specified by:
removeElement in interface Collection
Parameters:
object -
Returns:
boolean

removeAllElements

public void removeAllElements()
Specified by:
removeAllElements in interface Collection

getValue

public int getValue()
             throws ValidationException
Retrieves the scale code (e.g. 0=CHROMATIC; 1=MAJOR,...).

Returns:
int
Throws:
ValidationException

main

public static void main(java.lang.String[] argv)
Test unit.

Parameters:
argv - - The command line arguments.

addElement

public void addElement(java.lang.Object object)
                throws IncompatibleElementException,
                       ValidationException
Specified by:
addElement in interface Collection
Parameters:
object -
Throws:
IncompatibleElementException
ValidationException

getElements

public java.util.Iterator getElements()
Specified by:
getElements in interface Collection
Returns:
java.util.Iterator

getNoteByDegree

public Note getNoteByDegree(int degree)
Retrieves a note from scale, given its degree. It is circular (e.g. in a scale of 7 degrees, the degree value = 7 and value = 14 have the same result).

Parameters:
degree - - The note degree in a scale.
Returns:
DesignModel.mx.Note

getTriadByDegree

public Chord getTriadByDegree(int degree)
                       throws IncompatibleElementException,
                              ValidationException
Retrieves a chord, given its degree in scale.

Parameters:
degree - - The scale degree.
Returns:
DesignModel.mx.Chord
Throws:
IncompatibleElementException
ValidationException