public class MCover extends Object
MetricTree
nodes = a set of nodes
which realizes a given rhythm.
Tests all alternatives already contained in the MetricTree, and
modifies it by inserting new divisions if necessary.
MCover.Parameters_divide
!=null inserts new proportions, if no single alternative matches;
MCover.Parameters_approximate
!=null makes equidist-bi-divisions until below a threshold;
process(MTree,Parameters_approximate,Parameters_divide,List)
.
The list must be a list of time points, strictly increasing and normalized, i.e.
starting with the Rational 0/1 and ending with the duration of the measure.
get_ic()
will return a list of list of nodes, giving the initial cover for the
events.Modifier and Type | Class and Description |
---|---|
static class |
MCover.MetricNotHitException
Thrown iff neither of both automated synthesis modes is active.
|
static class |
MCover.Parameters_approximate
The parameters when MCover works in "binary approximation mode", which divides only
by two(2) until the approximation is better than the given thresholds.
|
static class |
MCover.Parameters_divide
The parameters when MCover works in "auto-division mode", which inserts new
alternatives of child nodes whenever necessary.
|
Modifier and Type | Field and Description |
---|---|
(package private) int |
eventToProcess
Realizes Co-Routine character: index of the currently processed event, switched forth
globally.
|
(package private) List<List<MTree>> |
ic
The accumulator for the result; maps (via index) events to lists of MTree nodes.
|
protected List<Rational> |
limits
The list of time points to analyze.
|
protected MTree |
metricTree
The top-level metric tree (modelling the whole measure) as passed to
process(MTree, Parameters_approximate, Parameters_divide, List) . |
(package private) Map<MTree,MTree> |
newAlts
Synthesized alternatives for nodes.
|
(package private) int |
nodeCount
Quality criterium for alternative decision.
|
protected @Opt MCover.Parameters_approximate |
parameters_approximate
Parameters for "binary approximation mode".
|
protected @Opt MCover.Parameters_divide |
parameters_divide
Parameters for "auto-division mode".
|
(package private) int |
spontNodeCount
Quality criterium for alternative decision: Number of nodes FIXME.
|
protected MStackingPlanner |
stackingPlanner
The strategy for introducing new brackets/divisions in "auto-division mode".
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addNode(MTree mt,
int compareResult)
Store to the result the fact that the given arguments (node and event) are related.
|
(package private) void |
appendNodes(MCover other)
Merge the intermediate results (ic-mapping, reached input index, quality criteria,
new mtree alternatives)
from an alternative finally selected (=OTHER) into THIS.
|
protected void |
do1Alt(MTree mt)
Test to split the duration of one alternative (of possibly several), which all are
EXPLICIT nodes (=from MTS, not synthetic).
|
protected void |
doAlts(MTree mt)
Test the sub-nodes and the alternatives of a node which is not completely
in the current event interval, so some sub-nodes must be found to cover that interval.
|
protected void |
doApprox(MTree mt,
int index,
int upto,
boolean endIsHit)
One ore more event starts lie truely in the current node's interval,
partly with prime factors != 2.
|
protected void |
doFC_bin(MTree mt)
Here the bottom of the MTree is reached: only binary divisions are required,
all other primes factors have already been realized somewhere above.
|
protected void |
doFC_synt(MTree mt,
MStackingPlanner.Plan spontPlan)
Is only called if synthesizing is necessary.
|
protected void |
doFC_top(MTree mt)
Main method for finding the Initial MCover;
called once for the top node from
process(MTree,Parameters_approximate parameters_approximate,Parameters_divide,List) ,
and later repeatedly for different alternatives in the middle of
do1Alt(MTree) . |
protected void |
doSynthOrImplicit(MTree mt,
MStackingPlanner.Plan spontPlan)
The current event interval is truely included in that of the MTree node,
but there are no child nodes.
|
void |
dump()
Auxiliary debugging print-out.
|
List<List<MTree>> |
get_ic()
Return the accumulated result, which maps events (by their index) to lists of nodes.
|
protected MTree |
makeSyntheticAlternative(MTree mt,
int division)
Search if a synthetic alternative with this division already exists, otherwise
make one and memorize it for later tree insertion.
|
static MCover |
process(MTree metricTree,
@Opt MCover.Parameters_approximate parameters_approximate,
@Opt MCover.Parameters_divide parameters_divide,
List<Rational> limits)
Main entry method:
Finds the lists of all completely covered and maximal nodes for a list of events.
|
static MCover |
process(MTree metricTree,
MCover.Parameters_approximate parameters_approximate,
@Opt MCover.Parameters_divide parameters_divide,
List<Rational> limits,
@Opt MStackingPlanner stackingPlanner)
Same functionality as
process(MTree,Parameters_approximate,Parameters_divide,List) ,
but a different bracket order stacking planner can be plugged in. |
protected final MTree metricTree
process(MTree, Parameters_approximate, Parameters_divide, List)
.protected final MStackingPlanner stackingPlanner
@Opt protected final @Opt MCover.Parameters_approximate parameters_approximate
@Opt protected final @Opt MCover.Parameters_divide parameters_divide
protected final List<Rational> limits
List<List<MTree>> ic
Map<MTree,MTree> newAlts
int spontNodeCount
int nodeCount
ic
.)int eventToProcess
public static MCover process(MTree metricTree, @Opt @Opt MCover.Parameters_approximate parameters_approximate, @Opt @Opt MCover.Parameters_divide parameters_divide, List<Rational> limits) throws MCover.MetricNotHitException
get_ic()
of the returned instance.MCover.MetricNotHitException
public static MCover process(MTree metricTree, MCover.Parameters_approximate parameters_approximate, @Opt @Opt MCover.Parameters_divide parameters_divide, List<Rational> limits, @Opt @Opt MStackingPlanner stackingPlanner) throws MCover.MetricNotHitException
process(MTree,Parameters_approximate,Parameters_divide,List)
,
but a different bracket order stacking planner can be plugged in.
("parameters_approximate" is NOT optional, because with ==null you do not need
an MStackingPlanner !-)MCover.MetricNotHitException
public List<List<MTree>> get_ic()
void addNode(MTree mt, int compareResult)
eventToProcess
.mt
- the node which relates to the event.compareResult
- of comparing the node's and the event's end time.
if identic, than change eventToProcess
to the next event.
// RAUS ALT : Adjust quality criterion accordingly.void appendNodes(MCover other)
doAlts(MTree)
, could be inlined.public void dump()
protected void doFC_top(MTree mt)
process(MTree,Parameters_approximate parameters_approximate,Parameters_divide,List)
,
and later repeatedly for different alternatives in the middle of
do1Alt(MTree)
.
t= 0/0 measure.endTime | | len-2 len-1 limits.length=4 limits [0] [1] [2] [3] events [0] [1] [2] eventToProcess == 0 1 2
protected void doAlts(MTree mt)
Two aux instances of MCover are created and the node "mt" and its alternative
(ic any) are tested by .
The two results are compared directly, one is discarded, the other merged into "THIS".
This can be done locally/pairwise, because the "better than" relation is transitive.
Only called from doFC_top(MTree)
and itself; could be inlined.
protected void do1Alt(MTree mt)
doFC_top(MTree)
recursively. (These are also only non-synthetics,
because synthetics are linked as ALTERNATIVES into an MTree!)doSynthOrImplicit(MTree,MStackingPlanner.Plan)
.doAlts(MTree)
.protected void doSynthOrImplicit(MTree mt, MStackingPlanner.Plan spontPlan)
protected MTree makeSyntheticAlternative(MTree mt, int division)
protected void doFC_synt(MTree mt, MStackingPlanner.Plan spontPlan)
mt
- is a new, synthetic alternative with the correct division. It has the
appropriate list of childs (which have no childs, but possibly alternatives)spontPlan
- the plan for further divisions, to be created in necessarily this order.protected void doFC_bin(MTree mt)
protected void doApprox(MTree mt, int index, int upto, boolean endIsHit)
If distance eventStart-nodeStart is too high: make division. continue recursively with that node the event lies in. If distance eventStart-nodeStart is NOT too high, but there is a second event in the node: If this is allowed: map both events to the same node make bi-division and continue with the lower half.
|===========| ! ! (! |=====|=====| ! ! (! |=====|=====| ! ! (!