Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.compare.structuremergeviewer
Class DiffContainer

    java.lang.Object
      org.eclipse.compare.structuremergeviewer.DiffElement
          org.eclipse.compare.structuremergeviewer.DiffContainer

All Implemented Interfaces:
  IDiffContainer, IDiffElement, ITypedElement

Direct Known Subclasses:
  DiffNode

public abstract class DiffContainer
extends DiffElement
implements IDiffContainer

The standard implementation of a diff container element.

This class may be instantiated, or further subclassed.

Field Summary

Fields inherited from interface org.eclipse.compare.ITypedElement
`FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE`

Constructor Summary
`DiffContainer(IDiffContainer parent, int kind)` Creates a new container with the specified kind under the given parent.

Method Summary
`void` | `add(IDiffElement diff)` Adds the given child to this container.
`IDiffElement` | `findChild(String name)` Tries to find the child with the given name.
`IDiffElement[]` | `getChildren()` Returns the children of this container.
`boolean` | `hasChildren()` Returns whether this container has at least one child.
`void` | `remove(IDiffElement child)` Removes the given child (non-recursively) from this container.
`void` | `removeToRoot(IDiffElement child)` Removes the given child from this container.

Methods inherited from class org.eclipse.compare.structuremergeviewer.DiffElement
`getImage, getKind, getParent, getType, setKind, setParent`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.compare.structuremergeviewer.IDiffElement
`getKind, getParent, setParent`

Methods inherited from interface org.eclipse.compare.ITypedElement
`getImage, getName, getType`

Constructor Detail

### DiffContainer

    public DiffContainer(IDiffContainer parent,
                         int kind)

  Creates a new container with the specified kind under the given parent.

Parameters:
  `parent` - under which the new container is added as a child or `null`.
  `kind` - of difference (defined in `Differencer`).

Method Detail

### findChild

    public IDiffElement findChild(String name)

  Tries to find the child with the given name. Returns `null` if no such child exists.

  Parameters:
    `name` - of the child to find
  Returns:
    the first element with a matching name

### add

    public void add(IDiffElement diff)

  Description copied from interface: `IDiffContainer`
  Adds the given child to this container. If the child is already contained in this container, this method has no effect.

  Specified by:
    `add` in interface `IDiffContainer`
  Parameters:
    `diff` - the child to be added to this container

### removeToRoot

    public void removeToRoot(IDiffElement child)

  Removes the given child from this container. If the container becomes empty it is removed from its container.

  Specified by:
    `removeToRoot` in interface `IDiffContainer`
  Parameters:
    `child` - the child to be removed from this container

### remove

    public void remove(IDiffElement child)

  Removes the given child (non-recursively) from this container.

  Parameters:
    `child` - to remove

### hasChildren

    public boolean hasChildren()

  Description copied from interface: `IDiffContainer`
  Returns whether this container has at least one child. In some cases this methods avoids having to call the potential more costly `getChildren` method.

  Specified by:
    `hasChildren` in interface `IDiffContainer`
  Returns:
    `true` if this container has at least one child

### getChildren

    public IDiffElement[] getChildren()

  Description copied from interface: `IDiffContainer`
  Returns the children of this container. If this container has no children an empty array is returned (not `null`).

  Specified by:
    `getChildren` in interface `IDiffContainer`
  Returns:
    the children of this container as an array

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.