org.modeshape.jcr.cache.document

## Class ImmutableChildReferences.Segmented

- java.lang.Object
- - org.modeshape.jcr.cache.document.AbstractChildReferences
  - - org.modeshape.jcr.cache.document.ImmutableChildReferences.Segmented

- All Implemented Interfaces:
    Iterable<ChildReference>, ChildReferences
  Enclosing class:
    ImmutableChildReferences

      @Immutable
      public static class ImmutableChildReferences.Segmented
      extends AbstractChildReferences

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.cache.document.AbstractChildReferences

      `AbstractChildReferences.ChildReferenceWithNameIterator`

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.cache.ChildReferences

      `ChildReferences.BasicContext, ChildReferences.Changes, ChildReferences.ChildInsertions, ChildReferences.Context, ChildReferences.NoChanges, ChildReferences.NoContext, ChildReferences.NoSnsIndexesContext, ChildReferences.SingleNameContext, ChildReferences.WithChanges`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected WorkspaceCache` | `cache`
    `protected long` | `totalSize`

    - ### Fields inherited from interface org.modeshape.jcr.cache.ChildReferences

      `UNKNOWN_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ImmutableChildReferences.Segmented(WorkspaceCache cache, ChildReferences firstSegment, DocumentTranslator.ChildReferencesInfo info)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterator<NodeKey>` | `getAllKeys()` Get the keys for all of the children.
    `ChildReference` | `getChild(Name name, int snsIndex, ChildReferences.Context context)` Look for the child reference that has the given name and SNS index.
    `ChildReference` | `getChild(NodeKey key)` Look for the child reference that has the node key.
    `ChildReference` | `getChild(NodeKey key, ChildReferences.Context context)` Look for the child reference that has the node key.
    `int` | `getChildCount(Name name)` Return the number of nodes that have the supplied name.
    `boolean` | `hasChild(NodeKey key)` Determine if this contains a reference to the specified child.
    `Iterator<ChildReference>` | `iterator(ChildReferences.Context context)` Get an iterator over all child references in this collection, but base the SNS indexes upon those already consumed.
    `Iterator<ChildReference>` | `iterator(Name name, ChildReferences.Context context)` Get an iterator over all of the children that have same name matching the supplied value.
    `long` | `size()` Get the total number of child references for the node, including all subsequent blocks of ChildReferences.
    `boolean` | `supportsGetChildReferenceByKey()` Return whether it is possible/feasible to `find` a ChildReference for a child node given only its NodeKey.
    `StringBuilder` | `toString(StringBuilder sb)`

    - ### Methods inherited from class org.modeshape.jcr.cache.document.AbstractChildReferences

      `contextSensitiveIterator, getChild, getChild, getChild, isEmpty, iterator, iterator, iterator, iterator, iterator, toString`

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

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

- - ### Field Detail

    - #### cache

          protected final WorkspaceCache cache

    - #### totalSize

          protected final long totalSize

  - ### Constructor Detail

    - #### ImmutableChildReferences.Segmented

          public ImmutableChildReferences.Segmented(WorkspaceCache cache,
                                            ChildReferences firstSegment,
                                            DocumentTranslator.ChildReferencesInfo info)

  - ### Method Detail

    - #### size

          public long size()

      Description copied from interface: `ChildReferences`
      Get the total number of child references for the node, including all subsequent blocks of ChildReferences.
      Returns:
        the total number of children, or `ChildReferences.UNKNOWN_SIZE`

    - #### supportsGetChildReferenceByKey

          public boolean supportsGetChildReferenceByKey()

      Description copied from interface: `ChildReferences`
      Return whether it is possible/feasible to `find` a ChildReference for a child node given only its NodeKey. Implementations that have very large numbers of children may provide an alternative way to `lookup` a child reference directly. In such cases, this method may return false.
      Specified by:
        `supportsGetChildReferenceByKey` in interface `ChildReferences`
      Overrides:
        `supportsGetChildReferenceByKey` in class `AbstractChildReferences`
      Returns:
        true if `ChildReferences.getChild(NodeKey)` and `ChildReferences.getChild(NodeKey, Context)` should be used to find the ChildReference, or false if doing so is not recommended.

    - #### getChildCount

          public int getChildCount(Name name)

      Description copied from interface: `ChildReferences`
      Return the number of nodes that have the supplied name. If there are no siblings with the same supplied name, this method will return 1; otherwise it will return the number of same-name-siblings.
      Parameters:
        `name` - the name
      Returns:
        the number of siblings with the supplied name; never negative

    - #### getChild

          public ChildReference getChild(Name name,
                                int snsIndex,
                                ChildReferences.Context context)

      Description copied from interface: `ChildReferences`
      Look for the child reference that has the given name and SNS index.
      Parameters:
        `name` - the name for the node
        `snsIndex` - the same-name-sibling index; must be positive
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the child reference, or null if there is no such child

    - #### hasChild

          public boolean hasChild(NodeKey key)

      Description copied from interface: `ChildReferences`
      Determine if this contains a reference to the specified child.
      Parameters:
        `key` - the node key of the child
      Returns:
        true if there is a child reference, or false if there is none

    - #### getChild

          public ChildReference getChild(NodeKey key)

      Description copied from interface: `ChildReferences`
      Look for the child reference that has the node key.
      Parameters:
        `key` - the node key of the child
      Returns:
        the child reference, or null if there is no such child

    - #### getChild

          public ChildReference getChild(NodeKey key,
                                ChildReferences.Context context)

      Description copied from interface: `ChildReferences`
      Look for the child reference that has the node key.
      Parameters:
        `key` - the node key of the child
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the child reference, or null if there is no such child

    - #### iterator

          public Iterator<ChildReference> iterator(Name name,
                                          ChildReferences.Context context)

      Description copied from interface: `ChildReferences`
      Get an iterator over all of the children that have same name matching the supplied value. This essentially returns an iterator over all of the same-name-siblings.
      Specified by:
        `iterator` in interface `ChildReferences`
      Overrides:
        `iterator` in class `AbstractChildReferences`
      Parameters:
        `name` - the name of the same-name-sibling nodes; may not be null
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the iterator; never null

    - #### iterator

          public Iterator<ChildReference> iterator(ChildReferences.Context context)

      Description copied from class: `AbstractChildReferences`
      Get an iterator over all child references in this collection, but base the SNS indexes upon those already consumed.
      Specified by:
        `iterator` in interface `ChildReferences`
      Overrides:
        `iterator` in class `AbstractChildReferences`
      Parameters:
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the iterator over all references; never null

    - #### getAllKeys

          public Iterator<NodeKey> getAllKeys()

      Description copied from interface: `ChildReferences`
      Get the keys for all of the children. The resulting iterator is lazy where possible, but it may be an expensive call if there are large numbers of children.
      Returns:
        the iterator over the keys; never null

    - #### toString

          public StringBuilder toString(StringBuilder sb)

      Specified by:
        `toString` in class `AbstractChildReferences`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.