ritornello.core.conceitual
Class Chord

java.lang.Object
  |
  +--ritornello.core.conceitual.Chord
All Implemented Interfaces:
Collection
Direct Known Subclasses:
PlayableChord

public class Chord
extends java.lang.Object
implements Collection


Field Summary
static int AUG_5TH
          The aug triad representation.
static int DIM_5TH
          The dim triad representation.
static int FLAT_13TH
          The b13 dissonance representation.
static int FLAT_9TH
          The b9 dissonance representation.
static int MAJOR_3RD
          The major triad representation.
static int MAJOR_7TH
          The maj 7th tetrad representation.
static int MINOR_3RD
          The minor triad representation.
static int MINOR_7TH
          The min 7th tetrad representation.
static int NATURAL_11TH
          The 11 dissonance representation.
static int NATURAL_13TH
          The 13 dissonance representation.
static int NATURAL_9TH
          The 9 dissonance representation.
static int PERFECT_5TH
          The perfect triad representation.
static int SHARP_11TH
          The #11 dissonance representation.
static int SHARP_9TH
          The #9 dissonance representation.
 
Constructor Summary
Chord(Note root)
          Constructor.
 
Method Summary
 void addElement(int type)
          Adds an element by its respective type.
 void addElement(java.lang.Object object)
           
 java.util.Iterator getElements()
           
 Note getFifth()
          Retrieves the fifth from chord.
 int getFifthType()
          Returns the fifth type from the selected chord.
static Chord getMajor(Note root)
          Retrieves a major chord, given its root note.
static Chord getMinor(Note root)
          Retrieves a minor chord, given its root.
 java.lang.String getName()
          Retrieves the chord name.
 java.util.Iterator getOtherChordsWithSameNotes()
          Retrieves other chords with same notes.
 Note getRoot()
          Retrieves the root note.
 Note getSeventh()
          Retrieves the seventh from chord.
 int getSeventhType()
          Returns the seventh type from the selected chord.
 Note getThird()
          Retrieves the third from chord.
 int getThirdType()
          Returns the third type from the selected chord.
static java.lang.String getTypeName(int type)
          Retrieves chord type name.
static java.lang.String getTypeRepresentation(int type, boolean showHidden)
          Retrieves chord type representation.
static void main(java.lang.String[] argv)
          Test unit.
 void removeAllElements()
           
 boolean removeElement(java.lang.Object object)
           
 void setRoot(Note root)
          Sets the root note.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINOR_3RD

public static final int MINOR_3RD
The minor triad representation.

See Also:
Constant Field Values

MAJOR_3RD

public static final int MAJOR_3RD
The major triad representation.

See Also:
Constant Field Values

DIM_5TH

public static final int DIM_5TH
The dim triad representation.

See Also:
Constant Field Values

PERFECT_5TH

public static final int PERFECT_5TH
The perfect triad representation.

See Also:
Constant Field Values

AUG_5TH

public static final int AUG_5TH
The aug triad representation.

See Also:
Constant Field Values

MINOR_7TH

public static final int MINOR_7TH
The min 7th tetrad representation.

See Also:
Constant Field Values

MAJOR_7TH

public static final int MAJOR_7TH
The maj 7th tetrad representation.

See Also:
Constant Field Values

FLAT_9TH

public static final int FLAT_9TH
The b9 dissonance representation.

See Also:
Constant Field Values

NATURAL_9TH

public static final int NATURAL_9TH
The 9 dissonance representation.

See Also:
Constant Field Values

SHARP_9TH

public static final int SHARP_9TH
The #9 dissonance representation.

See Also:
Constant Field Values

NATURAL_11TH

public static final int NATURAL_11TH
The 11 dissonance representation.

See Also:
Constant Field Values

SHARP_11TH

public static final int SHARP_11TH
The #11 dissonance representation.

See Also:
Constant Field Values

FLAT_13TH

public static final int FLAT_13TH
The b13 dissonance representation.

See Also:
Constant Field Values

NATURAL_13TH

public static final int NATURAL_13TH
The 13 dissonance representation.

See Also:
Constant Field Values
Constructor Detail

Chord

public Chord(Note root)
Constructor. Recieves the root note.

Parameters:
root - - The root note.
Method Detail

getName

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

Returns:
String
Throws:
ValidationException

getMajor

public static Chord getMajor(Note root)
                      throws ValidationException,
                             IncompatibleElementException
Retrieves a major chord, given its root note.

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

getMinor

public static Chord getMinor(Note root)
                      throws ValidationException,
                             IncompatibleElementException
Retrieves a minor chord, given its root.

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

main

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

Parameters:
argv - - Command line arguments.

setRoot

public void setRoot(Note root)
Sets the root note.

Parameters:
root - - The root note.

getRoot

public Note getRoot()
Retrieves the root note.

Returns:
Note

addElement

public void addElement(java.lang.Object object)
                throws IncompatibleElementException,
                       ValidationException
Specified by:
addElement in interface Collection
Parameters:
object -
Throws:
IncompatibleElementException
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

getElements

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

getThirdType

public int getThirdType()
                 throws ValidationException
Returns the third type from the selected chord. The possible values are major or minor.

Returns:
int
Throws:
ValidationException

getFifthType

public int getFifthType()
                 throws ValidationException
Returns the fifth type from the selected chord. The possible values are perfect, aug or dim.

Returns:
int
Throws:
ValidationException

getSeventhType

public int getSeventhType()
                   throws ValidationException
Returns the seventh type from the selected chord. The possible values are major or minor.

Returns:
int
Throws:
ValidationException

getThird

public Note getThird()
Retrieves the third from chord. If it does not exist, returns null.

Returns:
Note

getFifth

public Note getFifth()
Retrieves the fifth from chord. If it does not exist, returns null.

Returns:
Note

getSeventh

public Note getSeventh()
Retrieves the seventh from chord. If it does not exist, returns null.

Returns:
Note

addElement

public void addElement(int type)
                throws IncompatibleElementException,
                       ValidationException
Adds an element by its respective type.

Parameters:
type - The element type. Ex.: MINOR_3RD, MAJOR_3RD etc.
IncompatibleElementException
ValidationException

getTypeRepresentation

public static java.lang.String getTypeRepresentation(int type,
                                                     boolean showHidden)
                                              throws ValidationException
Retrieves chord type representation.

Parameters:
type - The chord type code.
showHidden - For certain king of chord types, the representation is optional. If "true", its representation is shown.
Returns:
String The chord type representation.
Throws:
ValidationException

getTypeName

public static java.lang.String getTypeName(int type)
                                    throws ValidationException
Retrieves chord type name.

Parameters:
type - The chord type code.
Returns:
String The chord type name.
Throws:
ValidationException

getOtherChordsWithSameNotes

public java.util.Iterator getOtherChordsWithSameNotes()
                                               throws ValidationException,
                                                      IncompatibleElementException
Retrieves other chords with same notes.

Returns:
java.util.Iterator The other chords.
Throws:
ValidationException
IncompatibleElementException