class AbstractUnitBox implements UnitBox {

  protected Unit unit;

  @Override
  public boolean isBranchTarget() {
    return true;
  }

  @Override
  public void setUnit(Unit unit) {<FILL_FUNCTION_BODY>}

  @Override
  public Unit getUnit() {
    return unit;
  }

  @Override
  public void toString(UnitPrinter up) {
    up.startUnitBox(this);
    up.unitRef(unit, isBranchTarget());
    up.endUnitBox(this);
  }
}

    if (!canContainUnit(unit)) {
      throw new RuntimeException("attempting to put invalid unit in UnitBox");
    }

    // Remove this from set of back pointers.
    if (this.unit != null) {
      this.unit.removeBoxPointingToThis(this);
    }

    // Perform link
    this.unit = unit;

    // Add this to back pointers
    if (this.unit != null) {
      this.unit.addBoxPointingToThis(this);
    }
  
<no_super_class>