org.modeshape.jcr.cache

## Class ReferrerCounts

- java.lang.Object
- - org.modeshape.jcr.cache.ReferrerCounts

-     @Immutable
      public final class ReferrerCounts
      extends Object

  An immutable snapshot of the referrers to a node.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ReferrerCounts.MutableReferrerCounts`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ReferrerCounts(Map<NodeKey,Integer> strongCountsByReferrerKey, Map<NodeKey,Integer> weakCountsByReferrerKey)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static int` | `count(Integer count)`
    `int` | `countStrongReferencesFrom(NodeKey referrer)` Get the number of strong references of a particular referring node.
    `int` | `countWeakReferencesFrom(NodeKey referrer)` Get the number of weak references of a particular referring node.
    `static ReferrerCounts` | `create(Map<NodeKey,Integer> strongCountsByReferrerKey, Map<NodeKey,Integer> weakCountsByReferrerKey)` Create a new instance of the snapshot.
    `static ReferrerCounts.MutableReferrerCounts` | `createMutable()`
    `Set<NodeKey>` | `getStrongReferrers()` Get the set of node keys to the nodes with strong references.
    `Set<NodeKey>` | `getWeakReferrers()` Get the set of node keys to the nodes with weak references.
    `ReferrerCounts.MutableReferrerCounts` | `mutable()` Get a mutable version of this snapshot.

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

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

- - ### Constructor Detail

    - #### ReferrerCounts

          protected ReferrerCounts(Map<NodeKey,Integer> strongCountsByReferrerKey,
                        Map<NodeKey,Integer> weakCountsByReferrerKey)

  - ### Method Detail

    - #### create

          public static ReferrerCounts create(Map<NodeKey,Integer> strongCountsByReferrerKey,
                              Map<NodeKey,Integer> weakCountsByReferrerKey)

      Create a new instance of the snapshot.
      Parameters:
        `strongCountsByReferrerKey` - the map of weak reference counts keyed by referrer's node keys; may be null or empty
        `weakCountsByReferrerKey` - the map of weak reference counts keyed by referrer's node keys; may be null or empty
      Returns:
        the counts snapshot; null if there are no referrers

    - #### createMutable

          public static ReferrerCounts.MutableReferrerCounts createMutable()

    - #### count

          protected static int count(Integer count)

    - #### getStrongReferrers

          public Set<NodeKey> getStrongReferrers()

      Get the set of node keys to the nodes with strong references.
      Returns:
        the referring node keys; never null but possibly empty

    - #### getWeakReferrers

          public Set<NodeKey> getWeakReferrers()

      Get the set of node keys to the nodes with weak references.
      Returns:
        the referring node keys; never null but possibly empty

    - #### countStrongReferencesFrom

          public int countStrongReferencesFrom(NodeKey referrer)

      Get the number of strong references of a particular referring node.
      Parameters:
        `referrer` - the referring node
      Returns:
        the number of references, or 0 if there are none or if `referrer` is null

    - #### countWeakReferencesFrom

          public int countWeakReferencesFrom(NodeKey referrer)

      Get the number of weak references of a particular referring node.
      Parameters:
        `referrer` - the referring node
      Returns:
        the number of references, or 0 if there are none or if `referrer` is null

    - #### mutable

          public ReferrerCounts.MutableReferrerCounts mutable()

      Get a mutable version of this snapshot.
      Returns:
        the mutable representation

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