Class SongPartCopyBuffer

java.lang.Object
org.jjazz.ss_editor.api.SongPartCopyBuffer

public class SongPartCopyBuffer extends Object
Singleton class to manage SongParts copy/cut/paste operations.

SongParts must be contiguous.

  • Method Details

    • getInstance

      public static SongPartCopyBuffer getInstance()
    • put

      public void put(List<SongPart> spts)
      Put a copy of each SongPart (and a copy of its parent section) in the buffer.

      SongParts must be contiguous.

      Parameters:
      spts -
    • clear

      public void clear()
    • getSize

      public int getSize()
      Returns:
      int The nb of RhyhmParts in the buffer.
    • getSptMinStartBarIndex

      public int getSptMinStartBarIndex()
    • getSptMaxStartBarIndex

      public int getSptMaxStartBarIndex()
    • isEmpty

      public boolean isEmpty()
    • getSourceSongStructure

      public SongStructure getSourceSongStructure()
      The SongStructure from which the songparts have been put in the buffer.
      Returns:
      Can be null if SongPartCopyBuffer is empty.
    • get

      public List<SongPart> get(SongStructure targetSgs, int targetStartBarIndex)
      Return a copy of the SongParts adapted to the specified targetSgs.

      The SongParts startBarIndexes are adjusted to start at targetStartBarIndex.
      nbBars is also adjusted if pasting in a different targetSgs.
      SongParts for which we could not find a matching parent section are discarded.

      Parameters:
      targetSgs - The container of the returned SongParts. If null songparts container is unchanged.
      targetStartBarIndex - The first returned SongPart will have startBarIndex=targetStartBarIndex.
      Returns:
    • addChangeListener

      public void addChangeListener(ChangeListener cl)
    • removeChangeListener

      public void removeChangeListener(ChangeListener cl)