Class ChordSymbolTextInput
java.lang.Object
org.jjazz.chordsymboltextinput.api.ChordSymbolTextInput
Define methods how to convert CLI_ChordSymbols from/to Strings.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
static final char
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
toBarString
(TimeSignature ts, List<? extends CLI_ChordSymbol> items) Make a string representing the bar chord symbols.
This string can be used as input for toCLI_ChordSymbols().static CLI_ChordSymbol
toCLI_ChordSymbol
(String str, Position defaultPos, ChordLeadSheet cls) Return a new CLI_ChordSymbol built from specified string.static List<CLI_ChordSymbol>
toCLI_ChordSymbolsNoPosition
(String str, int barIndex, ChordLeadSheet cls, boolean swing) Analyze a string describing a bar like "C Fm7" and return the list of CLI_ChordSymbols.static String
toString
(CLI_ChordSymbol cli, ChordSymbolTextInput.PositionDisplay pDisplay) Return a CLI_ChordSymbol as a string.static String
toStringNoPosition
(List<? extends CLI_ChordSymbol> items) A String like "C7 Am7 D"
-
Field Details
-
OPEN_POS_CHAR
public static final char OPEN_POS_CHAR- See Also:
-
CLOSE_POS_CHAR
public static final char CLOSE_POS_CHAR- See Also:
-
-
Constructor Details
-
ChordSymbolTextInput
public ChordSymbolTextInput()
-
-
Method Details
-
toCLI_ChordSymbol
public static CLI_ChordSymbol toCLI_ChordSymbol(String str, Position defaultPos, ChordLeadSheet cls) throws ParseException Return a new CLI_ChordSymbol built from specified string.Recognized strings:
"C7" => C7 at pos=defaultPos
"C7[2]" => C7 at pos=defaultPos.getBar()/beat 2
"C7[1:2]" => C7 at pos=bar 1/beat 2- Parameters:
str
- As produced by ChordSymboInput.toString(CLI_ChordSymbol).defaultPos
- Used when position data is missing in str.cls
- The container for this CLI_ChordSymbol.- Returns:
- Throws:
ParseException
-
toCLI_ChordSymbolsNoPosition
public static List<CLI_ChordSymbol> toCLI_ChordSymbolsNoPosition(String str, int barIndex, ChordLeadSheet cls, boolean swing) throws ParseException Analyze a string describing a bar like "C Fm7" and return the list of CLI_ChordSymbols.If 1 chord, beat=0.
If 2 chords, second chord is at the "half" of the bar.
If 3 chords, second chord is at the "half" of the bar and last one on last beat
If more chords place them at regular intervals.- Parameters:
str
-barIndex
-cls
-swing
- If true for example for 3/4 time signature place half-beat chord symbols at 1.666 (5/3) instead of 1.5- Returns:
- Throws:
ParseException
- When thrown, GetErrorOffset() represents the faulty chord symbol index.
-
toBarString
Make a string representing the bar chord symbols.
This string can be used as input for toCLI_ChordSymbols().- Parameters:
ts
- The TimeSignature of the bar.items
- The chord symbols in the bar.- Returns:
-
toStringNoPosition
A String like "C7 Am7 D"- Parameters:
items
-- Returns:
-
toString
Return a CLI_ChordSymbol as a string. Returned String can be used as an input for toCLI_ChordSymbol().- Parameters:
cli
-pDisplay
- Define how position is represented.- Returns:
-