public class Fields extends Object
Usage is like
f = new Fields().allow(1).allow(5).resolve();This provisorical implementation writes the found solutions in number form to stdout and as a musicXml score to a disk file.
Pitch classes and intervals are both represented symbollically by the numbers 0..11; pitches are represented by non-negative integers.
Modifier and Type | Class and Description |
---|---|
protected class |
Fields.Item
Each Item represents one construction step of a field.
|
Modifier and Type | Field and Description |
---|---|
protected SortedSet<Integer> |
allowedIntervals
The set of allowed intervals.
|
protected List<Fields.Item> |
results
All found fields after executing
resolve() . |
protected Fields.Item |
root
The start element of the fields' tree, representing a field with just one pitch =0.
|
Constructor and Description |
---|
Fields() |
Modifier and Type | Method and Description |
---|---|
(package private) Fields |
allow(int i)
Add a further interval to the set of allowed intervals.
|
int[] |
asArray(Fields.Item item)
Return a given field as an item of integers which represent the pitch classes.
|
eu.bandm.music.small_musicXml.Element_score_partwise |
asMusicXML()
Convert all solutions as stored in
results as an XML score block,
and combine these into one single score #Element_score_partwise . |
protected void |
asMusicXML(Fields.Item item,
int number,
List<eu.bandm.music.small_musicXml.Element_part> music_results,
List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
Encode one field as an ascending sequence of note heads in music XML.
|
List<PitchAndOctave<OctaveRegister,FunctionalPitchModOctave>> |
asPitches(Fields.Item item,
TwelveToneFunctionalRepresentation repr)
Convert one field into a sequence of pitches.
|
void |
dump(PrintStream ps)
Print all results found to "ps".
|
void |
dump(PrintStream ps,
@Opt Fields.Item i)
Print the pitch classes of all its predecessors, followed by that of "i".
|
static void |
main(String[] s)
Test application, allowed intervals must be added in the source text,
result is always written into "TESTOUT.xml"
|
void |
prolongate(Fields.Item start)
If the Item / field represented by the itme has already 12 / all pitch classes,
then store it in
results . |
void |
resolve()
Central service provider: Create a root note and prolongate it with 11 successors
to complete fields.
|
protected final SortedSet<Integer> allowedIntervals
allow(int)
after constructing this instance.protected final List<Fields.Item> results
resolve()
.protected Fields.Item root
Fields allow(int i)
public void resolve()
public void prolongate(Fields.Item start)
results
.
Otherwise test each of the allowed intervals: Its adding to the top of "start"
must deliver in a pitch class not yet present in "start".
If so, create a new Item and call prolongate(Item)
recursively.public void dump(PrintStream ps)
public void dump(PrintStream ps, @Opt @Opt Fields.Item i)
public List<PitchAndOctave<OctaveRegister,FunctionalPitchModOctave>> asPitches(Fields.Item item, TwelveToneFunctionalRepresentation repr)
results
.item
- represents the fieldrepr
- TwelveToneFunctionalRepresentation maps twelve tone pitch classes
into functional pitch classes, just to make them notatable in CWN.
Assume that both the fields and the TwelveToneFunctionalRepresentation
start with the index ==0.public int[] asArray(Fields.Item item)
public eu.bandm.music.small_musicXml.Element_score_partwise asMusicXML()
results
as an XML score block,
and combine these into one single score #Element_score_partwise
.
Therein each field/solution is contained in one dedicated staff/instrument/"part".protected void asMusicXML(Fields.Item item, int number, List<eu.bandm.music.small_musicXml.Element_part> music_results, List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
item
- the field to printnumber
- the number which appears in the name of the "part"/voice/staffmusic_results
- where to append the "Element_measure" which contains the notesindex_results
- where to index entry to this new staffpublic static void main(String[] s)
FIXME umbauen auf cmd line paraemter "8te" ==> "fields_8te.xml" "fields_8te.text"
FIXME zero solutions must not crash