package io.github.applecommander.bastools.api.code; /** * A {@code CodeMark} marks a dynamic address within the output stream. When referenced, it will report the * most recent address is knows, forcing the generation to run multiple times until it "settles". *

* Multiple passes occur for the following reasons:

* * @author rob */ public class CodeMark { private int address; public int getAddress() { return address; } /** * Update the current address based on the {@code GeneratorState}. * @return boolean indicating if the address changed */ public boolean update(GeneratorState state) { int currentAddress = state.currentAddress(); try { return currentAddress != address; } finally { this.address = currentAddress; } } }