Class LinearKnob

    • Constructor Detail

      • LinearKnob

        public LinearKnob​(java.lang.String name)
    • Method Detail

      • getDescription

        public java.lang.String getDescription()
        Specified by:
        getDescription in interface Knob
        Returns:
        a description for this knob
      • doSetTotalValue

        protected void doSetTotalValue​(double value)
        Description copied from class: AbstractKnob
        has to be implemented by subclass to set the total value to madx. The only call from this is from setTotalValue, which also notifies the listeners.
        Specified by:
        doSetTotalValue in class AbstractKnob
        Parameters:
        value - the value to set
      • writeCurrentStateToModel

        public void writeCurrentStateToModel​(JMadModel model)
        Description copied from interface: StatefulKnob
        Write the current state of the Knob to the model given. E.g. for a linear knob that would trigger a calculate knob strength values from total knob value and write to the model provided.
        Specified by:
        writeCurrentStateToModel in interface StatefulKnob
        Parameters:
        model - the JMadModel to write the Knobs state to.
      • getKey

        public java.lang.String getKey()
        Specified by:
        getKey in interface Knob
        Returns:
        a unique key (within all knobs of the same type)
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Knob
        Returns:
        the name of the knob
      • getTotalValue

        public double getTotalValue()
        Specified by:
        getTotalValue in interface Knob
        Returns:
        the total value (value+offset)
      • addStrengthFactor

        public void addStrengthFactor​(java.lang.String strengthName,
                                      double factor)
        adds a factor for a strength
        Parameters:
        strengthName - the name of the strength
        factor - the scaling factor for this strength
      • updateAllStrengthFactor

        protected void updateAllStrengthFactor​(java.util.Map<java.lang.String,​java.lang.Double> strengthFactorMapping)
        update the knob definition to the given strength name value mapping. Strengths that are not contained in the mapping are 'trimmed' back to zero. And new strengths are added to the knob. After this call, the knob is defined with exactly the given strength-factor combinations and the strengths involved are trimmed to the value resulting from the current knob value.
        Parameters:
        strengthFactorMapping - the mapping between strength name and factor which defines the knob.
      • removeStrengthFactor

        protected void removeStrengthFactor​(java.lang.String strengthName)
        Remove the factor for the strength with the given name from the linear knob. This call will ensure, that the impact of the strength factor is removed from the underlying models. After this call the strength is not longer available in the linear knob.
        Parameters:
        strengthName - the name of the strength to remove from the linear knob
      • updateStrengthFactor

        protected void updateStrengthFactor​(java.lang.String strengthName,
                                            double factor)
        update one of the knobs strength factors. During update the old strength factors impact on the model is reset and the new factors resulting value written to the model. If the old factor and the new factor are equal, nothing is done.
        Parameters:
        strengthName - the name of the the strength whose factor to update
        factor - the new value of the scaling factor for this strength
      • getType

        public KnobType getType()
        Specified by:
        getType in interface Knob
        Returns:
        the type of this knob
      • roundToDecimalPlaces

        public static final double roundToDecimalPlaces​(double value,
                                                        int decPlaces)