com.virtuosotechnologies.asaph.model
Interface SongBlock

All Superinterfaces:
FieldContainer, SongMember
All Known Subinterfaces:
AddedSongBlock, StandardSongBlock

public interface SongBlock
extends SongMember, FieldContainer

This interface represents a block of lines in a song. A Song consists of an ordered list of blocks, and each block consists of an ordered list of lines. Blocks also have an indent level.


Field Summary
static String CHORUS_TYPE
          Well-known type value for chorus
static String TYPE_FIELD
          Type of block field.
 
Method Summary
 int getIndentLevel()
          Get the indent level
 int getLineCount()
          Get the number of lines
 SongLine getNextLine(SongLine reference)
          Get the next line following reference.
 SongLine getNthLine(int n)
          Get the nth line
 SongLine getPreviousLine(SongLine reference)
          Get the previous line preceding reference.
 String getSerializableID()
          Get a string ID that can be used to serialize references to this SongBlock.
 SongLine insertLineAfter(SongLine after, UndoableEditListener undoListener)
          Add a line at the given position.
 SongLine insertLineBefore(SongLine before, UndoableEditListener undoListener)
          Add a line at the given position.
 void removeLine(SongLine line, UndoableEditListener undoListener)
          Remove the given line.
 void setIndentLevel(int indent, UndoableEditListener undoListener)
          Set the indent level
 
Methods inherited from interface com.virtuosotechnologies.asaph.model.SongMember
getSong, isDefunct
 
Methods inherited from interface com.virtuosotechnologies.asaph.model.FieldContainer
addBinaryField, addBinaryListField, addStringField, addStringListField, getFieldCount, getNamedField, getNextField, getNthField, getPreviousField, removeField
 

Field Detail

TYPE_FIELD

public static final String TYPE_FIELD
Type of block field. Value is a StringField.

See Also:
Constant Field Values

CHORUS_TYPE

public static final String CHORUS_TYPE
Well-known type value for chorus

See Also:
Constant Field Values
Method Detail

getIndentLevel

public int getIndentLevel()
Get the indent level

Returns:
indent level

getLineCount

public int getLineCount()
Get the number of lines

Returns:
number of lines

getNthLine

public SongLine getNthLine(int n)
Get the nth line

Parameters:
n - index
Returns:
line

getNextLine

public SongLine getNextLine(SongLine reference)
Get the next line following reference. If reference is null, returns the first line. If reference is the last line, returns null;

Parameters:
reference - reference SongLine
Returns:
next line
Throws:
IllegalArgumentException - reference is not a member

getPreviousLine

public SongLine getPreviousLine(SongLine reference)
Get the previous line preceding reference. If reference is null, returns the last line. If reference is the first line, returns null;

Parameters:
reference - reference SongLine
Returns:
previous line
Throws:
IllegalArgumentException - reference is not a member

getSerializableID

public String getSerializableID()
Get a string ID that can be used to serialize references to this SongBlock. The ID is guaranteed to be unique among SongBlocks within the owning Song, and will remain the same for the same SongBlock across different executions of the tool. However, two SongBlocks from different Songs may have the same string ID, and the same string ID may be shared between SongBlocks, Variations and ChordSets within the same Song.

Returns:
a unique serializable String ID for this SongBlock

setIndentLevel

public void setIndentLevel(int indent,
                           UndoableEditListener undoListener)
Set the indent level

Parameters:
indent - new indent level
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits

insertLineBefore

public SongLine insertLineBefore(SongLine before,
                                 UndoableEditListener undoListener)
Add a line at the given position.

Parameters:
before - insert before this line, or at the end if null
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits
Returns:
added SongLine
Throws:
IllegalArgumentException - before is not a member

insertLineAfter

public SongLine insertLineAfter(SongLine after,
                                UndoableEditListener undoListener)
Add a line at the given position.

Parameters:
after - insert after this line, or at the beginning if null
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits
Returns:
added SongLine
Throws:
IllegalArgumentException - after is not a member

removeLine

public void removeLine(SongLine line,
                       UndoableEditListener undoListener)
Remove the given line.

Parameters:
line - line to remove
undoListener - listener to notify if an undoable edit is generated, or null to suppress generation of undoable edits
Throws:
IllegalArgumentException - line is not present
NullPointerException - line was null