public void register(Scoped scoped) {
    assertNotDead();
    if (tearDowns.contains(scoped)) {
      // Ignore redundant registrations.
      return;
    }

    MortarScope scope = searchFromRoot(scoped);
    if (scope != null) {
      throw new IllegalStateException(
          format("\"%s\" is already registered within \"%s\".", scoped, scope));
    }

    tearDowns.add(scoped);
    scoped.onEnterScope(this);
  }
public void register ( Scoped scoped ) { assertNotDead ( ) ; if ( tearDowns . contains ( scoped ) ) { return ; } MortarScope scope = searchFromRoot ( scoped ) ; if ( scope != null ) { throw new IllegalStateException ( format ( "\"%s\" is already registered within \"%s\"." , scoped , scope ) ) ; } tearDowns . add ( scoped ) ; scoped . onEnterScope ( this ) ; }
Register the given {@link Scoped} instance to have its {@link Scoped#onEnterScope(MortarScope)}
and {@link Scoped#onExitScope()} methods called. Redundant registrations are safe,
they will not lead to additional calls to these two methods.
<p>
{@link Scoped#onEnterScope(MortarScope) onEnterScope} is called synchronously.

@throws IllegalStateException if this scope has been destroyed, or if the scoped object
is already registered with another scope in the same scope hierarchy.