Current Page: NeXtMidas Training Primitives Primitive Restarts Restarting a Primitive
- - - | Restarting a Primitive: Typically the macro writer does not need to be aware of situations that require a restart. The primitive takes care of it inside one its `setFoo(..)` methods. Since a restart is similar to a normal start with different input parameters, the restart is implemented this way. Prior to a restart a primitive overwrites its original input arguments and then sets the state to `RESTART`. The arguments are overridden using the `setArg(name, value)` method. Example:
            public void setFrameSize(int fs) {
              setArg("FS", Integer.toString(fs));
              setState(RESTART);
            }
The `open()` treats the `setArg("FOO","newVal")` as if the user had put "`FOO=newVal`" on the command line.