MathIsDivisibleByMutator

public final class MathIsDivisibleByMutator extends Mutator

Implements math_is_divisibleby_mutator Mutator for the math_number_property block, which adds the DIVISOR input if the property is "is divisible by". This mutator has no serialized state.

Constant Summary

String MUTATOR_ID

Inherited Constant Summary

Field Summary

public static final Factory<MathIsDivisibleByMutator> FACTORY

Inherited Field Summary

Protected Constructor Summary

Public Method Summary

void
onAttached(Block block)
Called immediately after the mutator is attached to the block.
void
serialize(XmlSerializer serializer)
Serializes the Mutator's state to an XML <mutation> element.
void
update(XmlPullParser parser)
Updates the mutator state from the provided <mutation> XML.

Inherited Method Summary

Constants

public static final String MUTATOR_ID

Constant Value: "math_is_divisibleby_mutator"

Fields

public static final Factory<MathIsDivisibleByMutator> FACTORY

Protected Constructors

protected MathIsDivisibleByMutator (Factory factory, BlocklyController controller)

Parameters
factory
controller

Public Methods

public void onAttached (Block block)

Called immediately after the mutator is attached to the block. Can be used to perform additional block initialization related to this mutator.

Parameters
block

public void serialize (XmlSerializer serializer)

Serializes the Mutator's state to an XML <mutation> element. Compare with block.mutationToDom() on web Blockly (added by extensions or mixins), or Mutator.toXMLElement() on blockly-ios.

Throws
IOException

public void update (XmlPullParser parser)

Updates the mutator state from the provided <mutation> XML. The parser state is such that parser.next() will return START_TAG, the beginning of the <mutation> element. Compare with block.domToMutation() on web Blockly (added by extensions or mixins), or Mutator.update() on blockly-ios.

Parameters
parser The parser with the <mutation> element.
Throws
BlockLoadingException
IOException
XmlPullParserException