@Override
 public void close() {
   if (replacement != null) {
     replacement.close();
     replacement.removeListener(listener);
   }
   if (substitution != null) {
     operandTree
         .getInstruction()
         .getModule()
         .getTypeManager()
         .removeTypeSubstitutionInstance(substitution);
   }
   if (instanceReferences != null && !instanceReferences.isEmpty()) {
     final TypeInstanceContainer container =
         operandTree.getInstruction().getModule().getContent().getTypeInstanceContainer();
     for (final TypeInstanceReference reference : instanceReferences) {
       container.deactivateTypeInstanceReference(reference);
     }
   }
 }
  /**
   * Creates a new operand tree node object.
   *
   * @param nodeId ID of the operand tree node.
   * @param type The type of the expression. This value must be one of the expression types defined
   *     in IOperandTree.
   * @param value The value of the operand expression.
   * @param replacement The replacement string of the operand expression.
   * @param references List of outgoing references of that operand tree node.
   * @param provider Synchronizes the operand tree node with the database.
   */
  public COperandTreeNode(
      final int nodeId,
      final int type,
      final String value,
      final INaviReplacement replacement,
      final List<IReference> references,
      final SQLProvider provider,
      final TypeManager typeManager,
      final TypeInstanceContainer instanceContainer) {
    this.provider =
        Preconditions.checkNotNull(provider, "IE02212: Provider argument can not be null");
    Preconditions.checkNotNull(value, "IE00214: Value can not be null");
    this.references =
        new ArrayList<IReference>(
            Preconditions.checkNotNull(references, "IE02211: References argument can not be null"));
    id = nodeId;
    for (final IReference reference : references) {
      Preconditions.checkNotNull(reference, "IE00215: Invalid reference in reference list");
    }
    Preconditions.checkNotNull(typeManager, "Type manager can not be null.");
    Preconditions.checkNotNull(instanceContainer, "Type instance container can not be null");

    initValue(type, value);

    if (expressionValue == null) {
      throw new IllegalArgumentException(
          String.format("IE00216: Unknown operand value '%s'", value));
    }

    this.replacement = replacement;
    if (replacement != null) {
      replacement.addListener(listener);
      displayStyle = OperandDisplayStyle.OFFSET;
    }
    instanceContainer.addListener(typeInstanceContainerListener);
  }