Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.virtuosotechnologies.asaph.modelutils
Class SongUtilsImpl  view SongUtilsImpl download SongUtilsImpl.java

java.lang.Object
  extended bycom.virtuosotechnologies.asaph.modelutils.SongUtilsImpl
All Implemented Interfaces:
SongUtils

class SongUtilsImpl
extends java.lang.Object
implements SongUtils

Implementation of SongUtils API interface


Field Summary
private  DataTransferUtilsImpl dataTransferUtils_
           
private  com.virtuosotechnologies.asaph.notationmanager.NotationManager notationManager_
           
 
Fields inherited from interface com.virtuosotechnologies.asaph.modelutils.SongUtils
API_NAME
 
Constructor Summary
(package private) SongUtilsImpl(com.virtuosotechnologies.asaph.notationmanager.NotationManager notationManager)
          Constructor
 
Method Summary
 void compactLine(com.virtuosotechnologies.asaph.model.SongLine line, javax.swing.event.UndoableEditListener undoListener)
          Compact a line-- aggregates any consecutive comment strings or text strings, ensures inserts empty text between adjacent chords in the same chord set, and ensures that the line starts and ends with strings.
 void compactSong(com.virtuosotechnologies.asaph.model.Song song, javax.swing.event.UndoableEditListener undoListener)
          Compact a song-- performs compactLine on all lines in the song.
 void copySong(com.virtuosotechnologies.asaph.model.Song source, com.virtuosotechnologies.asaph.model.Song destination)
          Make one song a copy of another.
(package private)  com.virtuosotechnologies.asaph.model.notation.Chord fixChord(com.virtuosotechnologies.asaph.model.notation.Chord chord, com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)
           
(package private)  com.virtuosotechnologies.asaph.model.notation.Chord[] fixChords(com.virtuosotechnologies.asaph.model.notation.Chord[] chords, com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)
           
(package private)  com.virtuosotechnologies.asaph.model.notation.Note fixNote(com.virtuosotechnologies.asaph.model.notation.Note note, com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)
           
 java.lang.String getFieldValueAsString(com.virtuosotechnologies.asaph.model.Song song, java.lang.String fieldName)
          Get a field value as a string.
 java.lang.String[] getFieldValueAsStringArray(com.virtuosotechnologies.asaph.model.Song song, java.lang.String fieldName)
          Get a field value as a string array.
 java.lang.String getFirstLineAsString(com.virtuosotechnologies.asaph.model.Song song, boolean useVariation, com.virtuosotechnologies.asaph.model.Variation variation)
          Get the first line of the song as a string.
 int getMemberPosition(com.virtuosotechnologies.asaph.model.SongLineMember member, com.virtuosotechnologies.asaph.model.ChordSet set)
          Get the index of a line member within its line
 java.lang.String getMultiLineString(com.virtuosotechnologies.asaph.model.StringList stringList)
          Get the StringList value as a string with newline delimiters.
 java.lang.String getSongTextAsString(com.virtuosotechnologies.asaph.model.Song song, boolean useVariation, com.virtuosotechnologies.asaph.model.Variation variation)
          Get the entire song text as a string.
private  void internalTransposeLine(com.virtuosotechnologies.asaph.model.SongLine line, com.virtuosotechnologies.asaph.model.ChordSet chordSet, com.virtuosotechnologies.asaph.model.notation.Interval interval, javax.swing.event.UndoableEditListener undoListener)
           
 com.virtuosotechnologies.asaph.model.ChordAnnotation moveChordAnnotation(com.virtuosotechnologies.asaph.model.ChordAnnotation chord, com.virtuosotechnologies.asaph.model.StringSongLineMember destinationMember, int destinationPos, com.virtuosotechnologies.asaph.model.ChordSet destinationSet, javax.swing.event.UndoableEditListener undoListener)
          Move a chord marking
 boolean prepareSongForEditing(com.virtuosotechnologies.asaph.model.Song song)
          Normalize a song for editing.
 void removeLineRange(com.virtuosotechnologies.asaph.model.SongLine line, com.virtuosotechnologies.asaph.model.StringSongLineMember startMember, int startPos, com.virtuosotechnologies.asaph.model.StringSongLineMember endMember, int endPos, javax.swing.event.UndoableEditListener undoListener)
          Remove the given range from a line
(package private)  void setDataTransferUtils(DataTransferUtilsImpl dataTransferUtils)
           
 void setMultiLineString(com.virtuosotechnologies.asaph.model.StringList stringList, java.lang.String value, javax.swing.event.UndoableEditListener undoListener)
          Parses the given string into lines and sets the string list value.
 com.virtuosotechnologies.asaph.model.SongBlock splitBlock(com.virtuosotechnologies.asaph.model.SongBlock block, com.virtuosotechnologies.asaph.model.SongLine line, javax.swing.event.UndoableEditListener undoListener)
          Split a block in half.
 com.virtuosotechnologies.asaph.model.SongLine splitLine(com.virtuosotechnologies.asaph.model.StringSongLineMember member, int pos, javax.swing.event.UndoableEditListener undoListener)
          Split a line in half.
 void transpose(com.virtuosotechnologies.asaph.model.SongBlock block, com.virtuosotechnologies.asaph.model.ChordSet chordSet, com.virtuosotechnologies.asaph.model.notation.Interval interval, javax.swing.event.UndoableEditListener undoListener)
          Transpose chords in the given song block.
 void transpose(com.virtuosotechnologies.asaph.model.Song song, com.virtuosotechnologies.asaph.model.ChordSet chordSet, com.virtuosotechnologies.asaph.model.notation.Interval interval, javax.swing.event.UndoableEditListener undoListener)
          Transpose chords in the given song.
 void transpose(com.virtuosotechnologies.asaph.model.SongLine line, com.virtuosotechnologies.asaph.model.ChordSet chordSet, com.virtuosotechnologies.asaph.model.notation.Interval interval, javax.swing.event.UndoableEditListener undoListener)
          Transpose chords in the given song line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataTransferUtils_

private DataTransferUtilsImpl dataTransferUtils_

notationManager_

private com.virtuosotechnologies.asaph.notationmanager.NotationManager notationManager_
Constructor Detail

SongUtilsImpl

SongUtilsImpl(com.virtuosotechnologies.asaph.notationmanager.NotationManager notationManager)
Constructor

Method Detail

setDataTransferUtils

void setDataTransferUtils(DataTransferUtilsImpl dataTransferUtils)

fixNote

com.virtuosotechnologies.asaph.model.notation.Note fixNote(com.virtuosotechnologies.asaph.model.notation.Note note,
                                                           com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)

fixChord

com.virtuosotechnologies.asaph.model.notation.Chord fixChord(com.virtuosotechnologies.asaph.model.notation.Chord chord,
                                                             com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)

fixChords

com.virtuosotechnologies.asaph.model.notation.Chord[] fixChords(com.virtuosotechnologies.asaph.model.notation.Chord[] chords,
                                                                com.virtuosotechnologies.asaph.model.notation.NotationFactory factory)

copySong

public void copySong(com.virtuosotechnologies.asaph.model.Song source,
                     com.virtuosotechnologies.asaph.model.Song destination)
Make one song a copy of another. Clears out the destination song, and copies the source into it. Does not affect the SongID or owner database of the destination. Also not undoable, so note that it breaks the undo chain.

Specified by:
copySong in interface SongUtils

prepareSongForEditing

public boolean prepareSongForEditing(com.virtuosotechnologies.asaph.model.Song song)
Normalize a song for editing. Involves compacting each line and ensuring that the first and last song line member of each line is a text member. Not undoable, so note that it breaks the undo chain.

Specified by:
prepareSongForEditing in interface SongUtils

compactLine

public void compactLine(com.virtuosotechnologies.asaph.model.SongLine line,
                        javax.swing.event.UndoableEditListener undoListener)
Compact a line-- aggregates any consecutive comment strings or text strings, ensures inserts empty text between adjacent chords in the same chord set, and ensures that the line starts and ends with strings. After this operation, any old handles to LineMembers may be invalid.

Specified by:
compactLine in interface SongUtils

compactSong

public void compactSong(com.virtuosotechnologies.asaph.model.Song song,
                        javax.swing.event.UndoableEditListener undoListener)
Compact a song-- performs compactLine on all lines in the song. After this operation, any old handles to LineMembers may be invalid.

Specified by:
compactSong in interface SongUtils

getFieldValueAsString

public java.lang.String getFieldValueAsString(com.virtuosotechnologies.asaph.model.Song song,
                                              java.lang.String fieldName)
Get a field value as a string. If the field is not present, returns the empty string. If the field is a string field, returns its value. If the field is a string list field, returns the values delimited by newlines.

Specified by:
getFieldValueAsString in interface SongUtils

getFieldValueAsStringArray

public java.lang.String[] getFieldValueAsStringArray(com.virtuosotechnologies.asaph.model.Song song,
                                                     java.lang.String fieldName)
Get a field value as a string array. If the field is not present, returns the zero-length array. If the field is a string field, returns a one-element array with the value. If the field is a string list field, returns the values in an array.

Specified by:
getFieldValueAsStringArray in interface SongUtils

getMultiLineString

public java.lang.String getMultiLineString(com.virtuosotechnologies.asaph.model.StringList stringList)
Get the StringList value as a string with newline delimiters.

Specified by:
getMultiLineString in interface SongUtils

setMultiLineString

public void setMultiLineString(com.virtuosotechnologies.asaph.model.StringList stringList,
                               java.lang.String value,
                               javax.swing.event.UndoableEditListener undoListener)
Parses the given string into lines and sets the string list value.

Specified by:
setMultiLineString in interface SongUtils

getSongTextAsString

public java.lang.String getSongTextAsString(com.virtuosotechnologies.asaph.model.Song song,
                                            boolean useVariation,
                                            com.virtuosotechnologies.asaph.model.Variation variation)
Get the entire song text as a string. Comments are stripped. Lines are delimited by newlines, and blocks by double newlines.

Specified by:
getSongTextAsString in interface SongUtils

getFirstLineAsString

public java.lang.String getFirstLineAsString(com.virtuosotechnologies.asaph.model.Song song,
                                             boolean useVariation,
                                             com.virtuosotechnologies.asaph.model.Variation variation)
Get the first line of the song as a string. Comments are stripped.

Specified by:
getFirstLineAsString in interface SongUtils

removeLineRange

public void removeLineRange(com.virtuosotechnologies.asaph.model.SongLine line,
                            com.virtuosotechnologies.asaph.model.StringSongLineMember startMember,
                            int startPos,
                            com.virtuosotechnologies.asaph.model.StringSongLineMember endMember,
                            int endPos,
                            javax.swing.event.UndoableEditListener undoListener)
Remove the given range from a line

Specified by:
removeLineRange in interface SongUtils

moveChordAnnotation

public com.virtuosotechnologies.asaph.model.ChordAnnotation moveChordAnnotation(com.virtuosotechnologies.asaph.model.ChordAnnotation chord,
                                                                                com.virtuosotechnologies.asaph.model.StringSongLineMember destinationMember,
                                                                                int destinationPos,
                                                                                com.virtuosotechnologies.asaph.model.ChordSet destinationSet,
                                                                                javax.swing.event.UndoableEditListener undoListener)
Move a chord marking

Specified by:
moveChordAnnotation in interface SongUtils

getMemberPosition

public int getMemberPosition(com.virtuosotechnologies.asaph.model.SongLineMember member,
                             com.virtuosotechnologies.asaph.model.ChordSet set)
Get the index of a line member within its line

Specified by:
getMemberPosition in interface SongUtils

splitLine

public com.virtuosotechnologies.asaph.model.SongLine splitLine(com.virtuosotechnologies.asaph.model.StringSongLineMember member,
                                                               int pos,
                                                               javax.swing.event.UndoableEditListener undoListener)
Split a line in half.

Specified by:
splitLine in interface SongUtils

splitBlock

public com.virtuosotechnologies.asaph.model.SongBlock splitBlock(com.virtuosotechnologies.asaph.model.SongBlock block,
                                                                 com.virtuosotechnologies.asaph.model.SongLine line,
                                                                 javax.swing.event.UndoableEditListener undoListener)
Split a block in half.

Specified by:
splitBlock in interface SongUtils

internalTransposeLine

private void internalTransposeLine(com.virtuosotechnologies.asaph.model.SongLine line,
                                   com.virtuosotechnologies.asaph.model.ChordSet chordSet,
                                   com.virtuosotechnologies.asaph.model.notation.Interval interval,
                                   javax.swing.event.UndoableEditListener undoListener)

transpose

public void transpose(com.virtuosotechnologies.asaph.model.SongLine line,
                      com.virtuosotechnologies.asaph.model.ChordSet chordSet,
                      com.virtuosotechnologies.asaph.model.notation.Interval interval,
                      javax.swing.event.UndoableEditListener undoListener)
Transpose chords in the given song line.

Specified by:
transpose in interface SongUtils

transpose

public void transpose(com.virtuosotechnologies.asaph.model.SongBlock block,
                      com.virtuosotechnologies.asaph.model.ChordSet chordSet,
                      com.virtuosotechnologies.asaph.model.notation.Interval interval,
                      javax.swing.event.UndoableEditListener undoListener)
Transpose chords in the given song block.

Specified by:
transpose in interface SongUtils

transpose

public void transpose(com.virtuosotechnologies.asaph.model.Song song,
                      com.virtuosotechnologies.asaph.model.ChordSet chordSet,
                      com.virtuosotechnologies.asaph.model.notation.Interval interval,
                      javax.swing.event.UndoableEditListener undoListener)
Transpose chords in the given song.

Specified by:
transpose in interface SongUtils