org.herac.tuxguitar.gui.editors.chord
Class ChordRecognizer

java.lang.Object
  extended by Composite
      extended by org.herac.tuxguitar.gui.editors.chord.ChordRecognizer

public class ChordRecognizer
extends Composite


Nested Class Summary
protected  class ChordRecognizer.Proposal
           
 
Field Summary
protected static int ADDCHK_INDEX
           
protected static int ALTERATION_INDEX
           
protected static int BASS_INDEX
           
protected static int CHORD_INDEX
           
protected static int I11_INDEX
           
protected static int I5_INDEX
           
protected static int I9_INDEX
           
protected static int PLUSMINUS_INDEX
           
protected static int TONIC_INDEX
           
 
Constructor Summary
ChordRecognizer(ChordDialog dialog, Composite parent, int style)
           
 
Method Summary
protected  void addProposal(int[] params, java.lang.String name)
           
protected  void clearProposals()
           
protected  int getAddNote(int type, int selectionIndex)
          Return required interval in semitones for add type and +- modificator
protected  java.lang.String getChordName(int[] param, boolean sharp)
          Assembles chord name according to ChordNamingConvention
protected  ChordDialog getDialog()
           
protected  List getProposalList()
           
 void init()
           
protected  boolean isValidProcess(long processId)
           
 GridData makeGridData()
           
protected  int[] makeProposals(long processId, TGChord chord, boolean sharp)
          Fills the component's list with alternative names
 void recognize(TGChord chord, boolean redecorate, boolean setChordName)
          - Recognizes the chord string - Fills the component's list with alternative names - Sets all the ChordSelector fields into recognized chord (tonic, bass, chord, alterations) - Makes the alternatives and puts them into ChordList - Writes the chord formula into appropriate label
protected  void redecorate(int[] params)
          adjusts widgets on the Recognizer combo
 void shellsort(java.util.List a, int sortIndex)
          Shellsort, using a sequence suggested by Gonnet.
protected  void showChord(int index)
          sets the current chord to be selected proposal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TONIC_INDEX

protected static final int TONIC_INDEX
See Also:
Constant Field Values

CHORD_INDEX

protected static final int CHORD_INDEX
See Also:
Constant Field Values

ALTERATION_INDEX

protected static final int ALTERATION_INDEX
See Also:
Constant Field Values

PLUSMINUS_INDEX

protected static final int PLUSMINUS_INDEX
See Also:
Constant Field Values

BASS_INDEX

protected static final int BASS_INDEX
See Also:
Constant Field Values

ADDCHK_INDEX

protected static final int ADDCHK_INDEX
See Also:
Constant Field Values

I5_INDEX

protected static final int I5_INDEX
See Also:
Constant Field Values

I9_INDEX

protected static final int I9_INDEX
See Also:
Constant Field Values

I11_INDEX

protected static final int I11_INDEX
See Also:
Constant Field Values
Constructor Detail

ChordRecognizer

public ChordRecognizer(ChordDialog dialog,
                       Composite parent,
                       int style)
Method Detail

makeGridData

public GridData makeGridData()

init

public void init()

showChord

protected void showChord(int index)
sets the current chord to be selected proposal


recognize

public void recognize(TGChord chord,
                      boolean redecorate,
                      boolean setChordName)
- Recognizes the chord string - Fills the component's list with alternative names - Sets all the ChordSelector fields into recognized chord (tonic, bass, chord, alterations) - Makes the alternatives and puts them into ChordList - Writes the chord formula into appropriate label

Parameters:
chord - chord structure (frets, strings)
redecorate - is the Chord Editor in editing mode, or it is just changed by ChordSelector

makeProposals

protected int[] makeProposals(long processId,
                              TGChord chord,
                              boolean sharp)
Fills the component's list with alternative names

Parameters:
chord - TGChord to be recognized
Returns:
parameters for adjustWidgets and getChordName methods

redecorate

protected void redecorate(int[] params)
adjusts widgets on the Recognizer combo


getChordName

protected java.lang.String getChordName(int[] param,
                                        boolean sharp)
Assembles chord name according to ChordNamingConvention


getAddNote

protected int getAddNote(int type,
                         int selectionIndex)
Return required interval in semitones for add type and +- modificator

Parameters:
type - 0=add9, 1=add11, 2=add13
selectionIndex - 0=usual, 1="+", 2="-"

shellsort

public void shellsort(java.util.List a,
                      int sortIndex)
Shellsort, using a sequence suggested by Gonnet. -- a little adopted

Parameters:
a - List of Proposals, unsorted
sortIndex - 1 to sort by don'tHaveGrade, 2 to sort by unusualGrade

addProposal

protected void addProposal(int[] params,
                           java.lang.String name)

clearProposals

protected void clearProposals()

getDialog

protected ChordDialog getDialog()

getProposalList

protected List getProposalList()

isValidProcess

protected boolean isValidProcess(long processId)