public class MetricSplitter extends Object
MetricTree
and parameters.
process(List)
/ #process(List.List)
. //FIXME Collection??
This returns a MetricSplitter.Result
object (possibly from cache).
From this, an inner instance of MetricSplitter.Result.WriteOut
must be created and the
abstract methods overridden to the desired behaviour, then its
"process()" method is called.
MetricSplitter.Parameters_explicitMode
must be provided on construction.
A MetricSplitter.Parameters_automatedMode
may be provided and enables
automated synthesis of alternatives for divisions non yet contained.
Instead, a MetricSplitter.Parameters_approximationMode
may be provided which
enables approximation by repeated division.Modifier and Type | Class and Description |
---|---|
protected static class |
MetricSplitter.Coverage
Represents one of many ALTERNATIVE SOLUTIONS, which decided locally
and concatenated before delivery.
|
static class |
MetricSplitter.MetricNotHitException
Thrown iff automated node synthesis is not active.
|
static class |
MetricSplitter.Parameters_approximationMode |
static class |
MetricSplitter.Parameters_automatedMode |
static class |
MetricSplitter.Parameters_beams
Control the generation of beam information.
|
static class |
MetricSplitter.Parameters_explicitMode |
class |
MetricSplitter.Result
Represents one result of processing a sequence of qualified durations.
|
Modifier and Type | Field and Description |
---|---|
protected Map<MetricTree,Integer> |
base_flags |
protected List<Tuple3<Integer,Integer,Integer>> |
beam_conditional_modifiers |
protected Map<Integer,Integer> |
beam_unconditional_replacements |
protected eu.bandm.tools.ramus.ana.Trie<MetricTree.QualifiedRational,MetricSplitter.Result> |
cache |
protected eu.bandm.tools.ramus.ana.Trie.Evaluator<MetricTree.QualifiedRational,MetricSplitter.Result> |
cacheEvaluator |
protected Map<MetricTree,StemEnd> |
genuine_beams |
protected MetricTree |
metricTree |
protected MetricSplitter.Parameters_approximationMode |
parameters_approximation |
protected MetricSplitter.Parameters_automatedMode |
parameters_automated |
protected MetricSplitter.Parameters_beams |
parameters_beams |
protected MetricSplitter.Parameters_explicitMode |
parameters_explicit |
protected Map<MetricTree,List<RationalDuration.DottedBaseDuration>> |
single_node_display_cache |
Constructor and Description |
---|
MetricSplitter(MetricTree metricTree) |
MetricSplitter(MetricTree metricTree,
MetricSplitter.Parameters_explicitMode parameters_explicit,
MetricSplitter.Parameters_automatedMode parameters_automated,
MetricSplitter.Parameters_approximationMode parameters_approximation,
MetricSplitter.Parameters_beams parameters_beams) |
Modifier and Type | Method and Description |
---|---|
protected static void |
addAlternative(MetricTree old,
MetricTree neu)
Aux function for adding a synthesized tree to the originial tree.
|
protected void |
collect_genuine_beams(MetricTree parent) |
protected void |
collect_genuine_beams(MetricTree parent,
StemEnd se_parent) |
(package private) List<Integer> |
div_plan(int factor)
Split factor into a plan, according to GLO IN parameters_automated.
|
(package private) List<Integer> |
div_plan(int divisor,
PrimeFactors pf)
Split factor into a plan, according to GLO IN parameters_automated.
|
(package private) List<Integer> |
div_plan(PrimeFactors pf)
Split factor into a plan, according to GLO IN parameters_automated.
|
protected void |
do_collect_genuine_beams(MetricTree parent,
StemEnd se_parent,
List<MetricTree> subtrees) |
protected void |
do1Alt(MetricTree mt,
List<Integer> spontPlan,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index)
Find coverage for one single alternative, possibly by descending
or by synthesizing a new subtree.
|
(package private) void |
do2PF_containing(PrimeFactors containing,
PrimeFactors contained,
MetricTree newMt,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index)
Render the events when there are two divisors, one contains the other
as factor.
|
protected void |
doFCs(MetricTree mt,
List<Integer> spontPlan,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index)
Aux methods for finding the Initial Coverage.
|
List<List<MetricTree>> |
findCoverage_B(MetricTree mt,
List<Rational> limits)
ADAPT old version to new implementation!
|
MetricSplitter.Coverage |
findCoverages(List<Rational> limits)
Finds the lists of all completely covered and maximal nodes for a list of events.
|
MetricTree |
get_metricTree() |
protected void |
make_initial_beam_plan()
Assign a
StemEnd to each node in metricTree , which will
be used later, possibly modified by neighbours. |
(package private) boolean |
n_writable(MetricTree mt,
int n,
int posDots)
Whether the conacatenation of "n" times "mt" is dotted-writable
with maximally "posDots" (set differently for pause and sound
by the caller).
|
(package private) void |
noSplit1PF(MetricTree newMt,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index,
PrimeFactors pf)
Render the events which fall in the MetricTree mt and which
need bracket/s for the PrimeFactors pf by only one(1) proportion.
|
protected void |
parseSiblingsAndDottings(List<MetricTree> irep,
boolean isPause,
Set<MetricTree> printThem,
Map<MetricTree,StemEnd> stemEnds)
Delivers all nodes which shall appear in the notation as a symbol, in the
Set
#result . |
MetricSplitter.Result |
process(List<MetricTree.QualifiedRational> eventStarts)
Main entry method: process the (ascending) list of start time points and
deliver a semantically sensible rendering plan.
|
MetricSplitter.Result |
process(List<Rational> eventStarts,
List<Boolean> isPause)
Main entry method: process the (ascending) list of start time points and
deliver a semantically sensible rendering plan.
|
(package private) void |
processSpontanuous_NEW(MetricTree mt,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index,
int upto) |
(package private) void |
processSpontanuous(MetricTree mt,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index,
int upto)
Spectral analysis: create a new node and memorize it for LATER
insertion, add quality values to cover and re-enter rh-generation
with a certain PLAN for the necessary divisions.
|
(package private) List<Integer> |
simple_factors(PrimeFactors pf,
boolean reverse)
Iterate over identic factors seperated, like "2, 2, 3, 5, 5", not "4,3,25".
|
(package private) void |
split1PF(MetricTree newMt,
MetricSplitter.Coverage cover,
List<Rational> limits,
int index,
PrimeFactors pf)
Render the events which fall in the MetricTree mt and which
need bracket/s for the PrimeFactors pf, by one proportion
or by splitting into more proportions,
according to the style parameters
GLO IN parameters_automated.
|
(package private) void |
splitDots_withBeams(List<MetricTree> irep,
Set<MetricTree> printThem,
Map<MetricTree,StemEnd> stemEnds,
int maxDots,
int startPos,
int endPos,
boolean leftNotRight,
boolean positiveDotting)
Add nodes from Initial Coverage to result, representing a sequence
of dotted values not exceeding maxDots.
|
(package private) void |
splitDots(List<MetricTree> irep,
Set<MetricTree> printThem,
int maxDots,
int startPos,
int endPos,
boolean leftNotRight) |
protected boolean |
testForSyncopeAndHemiola(List<MetricTree> irep)
Returns whether the node list, representing one event, can be replaced
by one single symbol, due to syncope or hemiola rules.
|
protected final MetricTree metricTree
protected final MetricSplitter.Parameters_beams parameters_beams
protected final MetricSplitter.Parameters_explicitMode parameters_explicit
protected final MetricSplitter.Parameters_automatedMode parameters_automated
protected final MetricSplitter.Parameters_approximationMode parameters_approximation
protected eu.bandm.tools.ramus.ana.Trie<MetricTree.QualifiedRational,MetricSplitter.Result> cache
protected final eu.bandm.tools.ramus.ana.Trie.Evaluator<MetricTree.QualifiedRational,MetricSplitter.Result> cacheEvaluator
protected Map<MetricTree,List<RationalDuration.DottedBaseDuration>> single_node_display_cache
protected Map<MetricTree,Integer> base_flags
protected Map<MetricTree,StemEnd> genuine_beams
protected final List<Tuple3<Integer,Integer,Integer>> beam_conditional_modifiers
public MetricSplitter(MetricTree metricTree)
public MetricSplitter(MetricTree metricTree, MetricSplitter.Parameters_explicitMode parameters_explicit, MetricSplitter.Parameters_automatedMode parameters_automated, MetricSplitter.Parameters_approximationMode parameters_approximation, MetricSplitter.Parameters_beams parameters_beams)
public MetricTree get_metricTree()
protected void make_initial_beam_plan()
StemEnd
to each node in metricTree
, which will
be used later, possibly modified by neighbours.
(In any case only DECREASING: in number and/or from long to short beams.)
Assume EssentialBrackets are all set.
Some style parameters can be considered already here.protected void collect_genuine_beams(MetricTree parent)
protected void collect_genuine_beams(MetricTree parent, StemEnd se_parent)
protected void do_collect_genuine_beams(MetricTree parent, StemEnd se_parent, List<MetricTree> subtrees)
public MetricSplitter.Result process(List<Rational> eventStarts, List<Boolean> isPause)
public MetricSplitter.Result process(List<MetricTree.QualifiedRational> eventStarts)
syncope = closed pattern. The duration which is exactly as long as the parent metric node, but the event starts later. x / \ (\ ) toplevel: any division possible / \ p p2 p and its follower p2 must have identical lengths / \ / \ and div-counts (2 or 3 only!) [----[ index of start and follower identical > 0 (will be applied only if p.duration is D-writable (e.g. for 15/16). In case of p.div==2, the pattern may stretch over more than one intermediate levels, limited by max_level_syncope_2 positive dotting pTop / / \ \ / x identical lengths on all levels / / \ x.div==2 required (but not for pTop.div) / x maximal dot count is limited by max_dots_positive. / / \ if exceeded, push dots up or down [----------[ negative dotting pTop / \ \ \ x \ identical lengths on all levels / \ \ x.div==2 required (but not for pTop.div) x \ maximal dot count is limited by max_dots_negative / \ \ if exceeded, push dots up or down [--------] sibling fusing (p.div >2) p / | \ - x x ident.length, n*x.duration must be D-writeable [----] x - x [----]In all patterns: Differences in the duration between siblings (candidates or parents of candiates) are ALWAYS A BARRIER. Differences in their division number, i.e. internal structure, in general are NOT.
#additionalProportions
, which must
be considered when programming any later write-out procedure.
P 2*3*(1/4) / \ P P / | \ / | \ x x X. Xz z P | 3*2*(1|4) / | \ P Q P / | / \ | \ /\ x x X. Xz z P 2*2*(1/4) / \ P P / \ / \ x X. X z P | 1/4+(2*1/4)+1/4 / | \ / Q \ / / \ \ x X. X z etc. 5*2*1/4|1/4+4*2*1/4+1/4 5*2*1/4|1/4+2*1/4+1/4+3*2*1/4|1/2+1/4+2*1/4+1/4+2*1/2| etc.data structure is event index 0 1 initialCoverage [a,b] [c, d, e] printed a c d summedDuration a d
public List<List<MetricTree>> findCoverage_B(MetricTree mt, List<Rational> limits)
public MetricSplitter.Coverage findCoverages(List<Rational> limits)
protected static void addAlternative(MetricTree old, MetricTree neu)
protected void do1Alt(MetricTree mt, List<Integer> spontPlan, MetricSplitter.Coverage cover, List<Rational> limits, int index)
#processSpontanuous()
, and this is a re-enter.void processSpontanuous(MetricTree mt, MetricSplitter.Coverage cover, List<Rational> limits, int index, int upto)
| start | end | 0/1 1/2 | 1/1 | . | | 1/3 | 2/3 | a-a (~a*b - a*b) | . | | 1/3 | 1/5 | a-b (~a*b-c*d) | . | | 1/3+1/4 | 1/5 | a+2-b | . | | 1/3 1/5 | | a+b-0 | . | | 1/3 1/5 | 1/2 | a+b-2 | . | | 1/15 | 1/3 | a*b-a (=a*b+a*b) | . | | 1/3 1/5 | 1/3 | a+b-a (=a+b-a+b) | . | | 1/15 | 1/21 | a*c + b*c | . | | 1/3 1/7 | 1/7 1/3| a - b - b - a | . | | 1/5 2/5 |4/7 4/5 | a+a - a+b | . | all other, more irregular distributions -> a>b>c or a
void processSpontanuous_NEW(MetricTree mt, MetricSplitter.Coverage cover, List<Rational> limits, int index, int upto)
void do2PF_containing(PrimeFactors containing, PrimeFactors contained, MetricTree newMt, MetricSplitter.Coverage cover, List<Rational> limits, int index)
void split1PF(MetricTree newMt, MetricSplitter.Coverage cover, List<Rational> limits, int index, PrimeFactors pf)
void noSplit1PF(MetricTree newMt, MetricSplitter.Coverage cover, List<Rational> limits, int index, PrimeFactors pf)
List<Integer> div_plan(int divisor, PrimeFactors pf)
List<Integer> div_plan(PrimeFactors pf)
List<Integer> div_plan(int factor)
List<Integer> simple_factors(PrimeFactors pf, boolean reverse)
protected void doFCs(MetricTree mt, List<Integer> spontPlan, MetricSplitter.Coverage cover, List<Rational> limits, int index)
t 0/0 measure.end | | index len-2 len-1 len=4 limits [0] [1] [2] [3] events [0] [1] [2]
protected boolean testForSyncopeAndHemiola(List<MetricTree> irep)
irep
- the initial representation, which shall be simplifiedvoid splitDots_withBeams(List<MetricTree> irep, Set<MetricTree> printThem, Map<MetricTree,StemEnd> stemEnds, int maxDots, int startPos, int endPos, boolean leftNotRight, boolean positiveDotting)
negative positive N N i=in Initial Coverage / \ / \ N Xi Xi N / \ / \ N Xi Xi N / \ / \ N Ni Ni X ---][^^^^^^^^^^^] [^^^^^^^^^]The whole interval of nodes is given by startpos to endpos (INCLUSIVE). LeftNotRight says on which side to begin the comprehensions. LeftNotRight = NegativeDotting XOR parameters.push_dots_down_not_up
void splitDots(List<MetricTree> irep, Set<MetricTree> printThem, int maxDots, int startPos, int endPos, boolean leftNotRight)
protected void parseSiblingsAndDottings(List<MetricTree> irep, boolean isPause, Set<MetricTree> printThem, Map<MetricTree,StemEnd> stemEnds)
#result
.
Filters out the subsequent nodes which shall not appear with an own symbol.
(As a consequence, their durations must be added to the predecessor when
writing out, in some later processing step.)
ppp / / \ \ \ n n+ pp pp / \ / \ / \ n p / \ / \ n [-------------------] positive dotting [----------------------] double pos. dotting [-------------] siblings [------------------] ppp / / \ \ \ +pp n n / \ / \ / \ +p n / \ n n [--------------] double neg. dotting [-----] negative dotting [--------------] siblings jump more than one level => no simplification possible! ppp / / \ \ \ pp N pp \ / \ / \ p p / \ / \ n n [---------] [-------------]In a first step for every node (not the very first) the kind of
Move
is
determined:
up-up-..-hori-hori-.. down-down pp / \ \ \ / \ \ \ p [] [] p / \ -------- / \ [] / hori \ [] /up \ down i0 i1 i2 i3 .... i0 again phase 0 1 3 4=flush i1 = last of neg.dot, first of siblings i2 = last of siblings, first of pos dot (iff any!)
boolean n_writable(MetricTree mt, int n, int posDots)