Package org.eclipse.handly.model.impl.support

## Class SourceConstruct

- java.lang.Object
- - org.eclipse.core.runtime.PlatformObject
  - - org.eclipse.handly.model.impl.support.Element
    - - org.eclipse.handly.model.impl.support.SourceConstruct

- All Implemented Interfaces:
    `org.eclipse.core.runtime.IAdaptable`, `IElement`, `IElementImpl`, `IElementImplExtension`, `ISourceConstructImpl`, `ISourceConstructImplExtension`, `ISourceElementImpl`, `IElementImplSupport`, `IModelManager.Provider`, `ISourceConstructImplSupport`, `ISourceElementImplSupport`, `ISourceConstruct`, `ISourceElement`

      public abstract class SourceConstruct
      extends Element
      implements ISourceConstructImplSupport

  Provides a skeletal implementation of `ISourceConstructImplExtension` to minimize the effort required to implement that interface. Clients might as well implement ("mix in") `ISourceConstructImplSupport` directly if extending this class is not possible/desirable for some reason.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.handly.model.impl.IElementImplExtension

      `IElementImplExtension.CloseHint`

  - ### Field Summary

    - ### Fields inherited from interface org.eclipse.handly.model.impl.IElementImplExtension

      `CLOSE_HINT, FORCE_OPEN`

    - ### Fields inherited from interface org.eclipse.handly.model.impl.support.IElementImplSupport

      `NEW_ELEMENTS, NO_BODY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SourceConstruct​(IElement parent, java.lang.String name)` | Creates a handle for a source construct with the given parent element and the given name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getOccurrenceCount_()` | Returns the count used to distinguish source constructs that would otherwise be equal (such as two fields with the same name in the same type).
    `void` | `setOccurrenceCount_​(int occurrenceCount)` | Sets the occurrence count for this element.

    - ### Methods inherited from class org.eclipse.handly.model.impl.support.Element

      `equals, getName_, getParent_, hashCode, toString`

    - ### Methods inherited from class org.eclipse.core.runtime.PlatformObject

      `getAdapter`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.handly.model.IElement

      `equals, hashCode`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.IElementImpl

      `equalsAndSameParentChain_, fetchChildren_, fetchChildrenOfType_, getChildrenOfType_, getHandleMemento_, getLocationUri_, getName_, getRoot_, toDisplayString_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.IElementImplExtension

      `close_, getBody_, getBody_, getChildren_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.support.IElementImplSupport

      `canEqual_, close_, findBody_, getChildrenFromBody_, getElementManager_, getModel_, newDoesNotExistException_, open_, openParent_, peekAtBody_, remove_, removing_, toString_, toStringAncestors_, toStringBody_, toStringChildren_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.support.IModelManager.Provider

      `getModelManager_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.ISourceConstructImpl

      `getParent_, getResource_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.support.ISourceConstructImplSupport

      `buildStructure_, defaultEquals_, defaultHashCode_, exists_, isOpenable_, toStringName_, validateExistence_`

    - ### Methods inherited from interface org.eclipse.handly.model.impl.support.ISourceElementImplSupport

      `getSourceElementAt_, getSourceElementAt_, getSourceElementInfo_`

- - ### Constructor Detail

    - #### SourceConstruct

          public SourceConstruct​(IElement parent,
                                 java.lang.String name)

      Creates a handle for a source construct with the given parent element and the given name.
      Parameters:
        `parent` - the parent of the element (not `null`)
        `name` - the name of the element, or `null` if the element has no name

  - ### Method Detail

    - #### getOccurrenceCount_

          public final int getOccurrenceCount_()

      Description copied from interface: `ISourceConstructImplExtension`
      Returns the count used to distinguish source constructs that would otherwise be equal (such as two fields with the same name in the same type). Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
      Specified by:
        `getOccurrenceCount_` in interface `ISourceConstructImplExtension`
      Returns:
        the occurrence count for this element

    - #### setOccurrenceCount_

          public void setOccurrenceCount_​(int occurrenceCount)

      Description copied from interface: `ISourceConstructImplExtension`
      Sets the occurrence count for this element.

      This method is intended to be used only when building the structure of a source file to distinguish source constructs that would otherwise be equal.

      Specified by:
        `setOccurrenceCount_` in interface `ISourceConstructImplExtension`
      Parameters:
        `occurrenceCount` - the occurrence count for this element (> 0)