public boolean isBottomObject(Object object) {
   MappedObjectState mappedObjectState =
       (MappedObjectState) mappedObjectStateAdapterFactory.adapt(object, MappedObjectState.class);
   if (mappedObjectState != null)
     return !isTopToBottom() ? mappedObjectState.isInput() : mappedObjectState.isOutput();
   return false;
 }
 public Collection<? extends Mapping> getMappings(Object object) {
   MappedObjectState mappedObjectState = getMappedObjectState(object);
   if (mappedObjectState == null) {
     return Collections.emptySet();
   } else {
     return mappedObjectState.getMappings();
   }
 }
  public void deregister(Mapping mapping) {
    for (Object input : mapping.getInputs()) {
      MappedObjectState mappedObjectState = getMappedObjectState(input);
      if (mappedObjectState != null) {
        mappedObjectState.getMappings().remove(mapping);
      }
    }

    for (Object output : mapping.getOutputs()) {
      MappedObjectState mappedObjectState = getMappedObjectState(output);
      if (mappedObjectState != null) {
        mappedObjectState.getMappings().remove(mapping);
      }
    }
  }
  public void refreshMappedObjectStates(Mapping subtree) {
    for (Object input : subtree.getInputs()) {
      for (Iterator<?> objects = domain.treeIterator(input); objects.hasNext(); ) {
        Object object = objects.next();
        MappedObjectState mappedObjectState = getMappedObjectState(object);
        if (mappedObjectState != null) {
          mappedObjectState.setInput();
        }
      }
    }

    for (Object output : subtree.getOutputs()) {
      for (Iterator<?> objects = domain.treeIterator(output); objects.hasNext(); ) {
        MappedObjectState mappedObjectState = getMappedObjectState(objects.next());
        if (mappedObjectState != null) {
          mappedObjectState.setOutput();
        }
      }
    }

    for (Iterator<Mapping> mappings = subtree.treeIterator(); mappings.hasNext(); ) {
      Mapping mapping = mappings.next();
      for (Object input : mapping.getInputs()) {
        MappedObjectState mappedObjectState = getMappedObjectState(input);
        if (mappedObjectState != null) {
          mappedObjectState.getMappings().add(mapping);
        }
      }

      for (Object output : mapping.getOutputs()) {
        MappedObjectState mappedObjectState = getMappedObjectState(output);
        if (mappedObjectState != null) {
          mappedObjectState.getMappings().add(mapping);
        }
      }
    }
  }
 public boolean isOutputObject(Object object) {
   MappedObjectState mappedObjectState =
       (MappedObjectState) mappedObjectStateAdapterFactory.adapt(object, MappedObjectState.class);
   return mappedObjectState != null && mappedObjectState.isOutput();
 }