Class SvgSource.ParamTranslate

java.lang.Object
eu.bandm.tools.util.java.Iterators.Pairwise<Event>
eu.bandm.music.top.SvgSource.ParamTranslate
Enclosing class:
SvgSource

protected class SvgSource.ParamTranslate extends eu.bandm.tools.util.java.Iterators.Pairwise<Event>
Visits all events of a given iterator pairwise and writes out the Svg/Smil commands.

In the code generation scheme, the target value of an interpolation process is already encoded with the command starting the interpoloation. In non-interpolation, a "set value" command is generated at the time of the event. Symbolically:

                     #0      #1       #2      #3 
  first(): prepare registers

  pairwise():        \-------/
      ipol==true     v0=====>v1... 
      ipol==false    v0!...
  pairwise():                 \--------/
      ipol==true              v1=======>v2... 
      left value == reachedValue --> NOP (No need for a command iff value simply STAYS!)
      ipol==false             v1!...
  pairwise():                           \--------/ 
                                        etc.
  last() AND ipol=false:                        v3!...

  
ATTENTION:
"animateColor()" seems not necessary (even in examples in the w3c SVG docu!-)
"set()" does NOT affect settings of "@transform".
  • Field Details

    • ipoltable

      @Opt protected final @Opt Map<Event,String> ipoltable
    • paramType

      protected final String paramType
    • paramName

      protected final String paramName
    • indent

      protected final String indent
    • isTransform

      protected final boolean isTransform
    • getParamValue

      protected final Function<Event,String> getParamValue
    • reachedValue

      @Opt protected @Opt String reachedValue
      Value currently valid in the state of the Svg/Smil processor, either as the endpoint of an interpolation, or set and held as a constant.
    • predecValue

      protected String predecValue
    • currentValue

      protected String currentValue
    • predecTime

      protected double predecTime
    • currentTime

      protected double currentTime
    • ipol

      protected boolean ipol
      Whether between the earlier and later event in pairwise(Event,Event) an interpolation is requested by the tscore source data.
  • Constructor Details

  • Method Details

    • time

      protected double time(Event e)
    • first

      public void first(Event e)
      Can be overridden by the user to visit the very first element before the first pair is visited by Iterators.Pairwise.pairwise(Object,Object). Here: Prepare the registers for the first call to pairwise(Event,Event).
      Overrides:
      first in class eu.bandm.tools.util.java.Iterators.Pairwise<Event>
    • writeSet

      protected void writeSet()
      Generate the source text which sets the parameter value only of the earlier event.

      ATTENTION, HACK: "set" does not work with "@transform", so we use a VERY FAST animation.

    • pairwise

      public void pairwise(Event predec, Event current)
      Must be overridden by the user to visit the define what to do with each pair of adjacent elements. These are visited in the sequential order of the underlying Iterator. On Execution, that has berformed a Iterator.next(), so that it "points" (e.g. with its Iterator.hasNext() to the successor of the later of both visited elements. Here: Generate either the source text which describes the interpolation between both events, or one which sets the parameter value only of the earlier event. Before processing, predecTime and predecValue correspond to the earlier event. After processing, predecTime and predecValue correspond to the later event = are prepared for the next cyclic call of this method.
      Specified by:
      pairwise in class eu.bandm.tools.util.java.Iterators.Pairwise<Event>
    • last

      public void last(Event e)
      Can be overridden by the user to visit the very last element after the last pair is visited by Iterators.Pairwise.pairwise(Object,Object).. Here: If the very last event's parameter is not reached by the last interpolation, then generate a "setValue" smil event.
      Overrides:
      last in class eu.bandm.tools.util.java.Iterators.Pairwise<Event>