sdr 0.3

net.cscott.sdr.calls.transform
Class RemoveIn

java.lang.Object
  extended by net.cscott.sdr.calls.transform.TransformVisitor<Fraction>
      extended by net.cscott.sdr.calls.transform.RemoveIn

public class RemoveIn
extends TransformVisitor<Fraction>

Remove Ins from a call tree by pushing them down and adjusting Prim timing. We use the "inherent" times given by a BeatCounter to proportionally allocate the available beats from the top down.

Tests:
Eliminate In from 1/2 DOSADO:
js> importPackage(net.cscott.sdr.calls.ast)
js> a = Apply.makeApply("_fractional", Apply.makeApply("1/2"), Apply.makeApply("dosado"))
(Apply _fractional (Apply 1/2) (Apply dosado))
js> def = a.expand()
(In 3 (Opt (From [FACING DANCERS] (Seq (Prim -1, 1, none, 1) (Prim 1, 1, none, 1)))))
js> RemoveIn.removeIn(def)
(Opt (From [FACING DANCERS] (Seq (Prim -1, 1, none, 1 1/2) (Prim 1, 1, none, 1 1/2))))

Method Summary
static Comp removeIn(Comp c)
          Main method: pass in a Comp, and get out a Comp without In nodes.
 Apply visit(Apply a, Fraction scale)
           
 Comp visit(In in, Fraction f)
           
 Par visit(Par p, Fraction f)
           
 Part visit(Part part, Fraction scale)
           
 Prim visit(Prim p, Fraction scale)
           
 Seq visit(Seq s, Fraction f)
           
 
Methods inherited from class net.cscott.sdr.calls.transform.TransformVisitor
visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

removeIn

public static Comp removeIn(Comp c)
Main method: pass in a Comp, and get out a Comp without In nodes.


visit

public Seq visit(Seq s,
                 Fraction f)
Overrides:
visit in class TransformVisitor<Fraction>

visit

public Prim visit(Prim p,
                  Fraction scale)
Overrides:
visit in class TransformVisitor<Fraction>

visit

public Apply visit(Apply a,
                   Fraction scale)
Overrides:
visit in class TransformVisitor<Fraction>

visit

public Part visit(Part part,
                  Fraction scale)
Overrides:
visit in class TransformVisitor<Fraction>

visit

public Par visit(Par p,
                 Fraction f)
Overrides:
visit in class TransformVisitor<Fraction>

visit

public Comp visit(In in,
                  Fraction f)
Overrides:
visit in class TransformVisitor<Fraction>

sdr 0.3

Copyright © 2006-2009 C. Scott Ananian