Class MacroRecorder

java.lang.Object
com.j3d.engine.interact.macros.MacroRecorder
All Implemented Interfaces:
EventListener

public class MacroRecorder extends Object implements EventListener
A single-instantiated class with the purpose of recording engine events to become a single Macro.

How it works is, it listens for the following events:

and simply formats them. The reverse of MacroRunner

Author:
Lehlogonolo Poole
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The ordered list of instructions.
    private String
    The name of the macro provided by RecordCmd
    private boolean
    Boolean indicating whether the macro is running or not
  • Constructor Summary

    Constructors
    Constructor
    Description
    Package-private default constructor (Only MacroUtils can instantiate it)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    <K> void
    onEvent(EventType event, EventPayload<K> properties)
    Listens for the 3 events listed in the MacroRecorder doc and applies human readable formatting if the recorded class instance does not provide a specialized macro-line method.
    void
    record(String name)
    Begins recording engine events to save as macro instructions.
    Stops recording the macro, clears all state such that a new macro can be recorded and returns a macro of the recorded instructions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • instructions

      private ArrayList<MacroLine> instructions
      The ordered list of instructions.
    • name

      private String name
      The name of the macro provided by RecordCmd
    • running

      private boolean running
      Boolean indicating whether the macro is running or not
  • Constructor Details

    • MacroRecorder

      MacroRecorder()
      Package-private default constructor (Only MacroUtils can instantiate it)
  • Method Details

    • record

      public void record(String name)
      Begins recording engine events to save as macro instructions. This serves as the start of recording a macro.
      Parameters:
      name - The name of the new macro
    • stop

      public Macro stop()
      Stops recording the macro, clears all state such that a new macro can be recorded and returns a macro of the recorded instructions.
      Returns:
      The recorded macro, unless the class was never running then null.
    • onEvent

      public <K> void onEvent(EventType event, EventPayload<K> properties)
      Listens for the 3 events listed in the MacroRecorder doc and applies human readable formatting if the recorded class instance does not provide a specialized macro-line method.
      Specified by:
      onEvent in interface EventListener
      Type Parameters:
      K - K.
      Parameters:
      event - The type of event
      properties - The given event payload
      See Also:
    • isRecording

      public boolean isRecording()