org.modeshape.jcr.query.engine

## Class IndexPlan

- java.lang.Object
- - org.modeshape.jcr.query.engine.IndexPlan

- All Implemented Interfaces:
    Comparable<IndexPlan>

      @Immutable
      public final class IndexPlan
      extends Object
      implements Comparable<IndexPlan>

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IndexPlan.StandardIndexPlanner`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `CHILDREN_BY_PATH_INDEX_NAME`
    `protected static String` | `DESCENDANTS_BY_PATH_INDEX_NAME`
    `protected static String` | `NODE_BY_PATH_INDEX_NAME`
    `protected static String` | `PATH_PARAMETER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexPlan(String name, String providerName, Collection<Constraint> constraints, int costEstimate, long cardinalityEstimate, Map<String,Object> parameters)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(IndexPlan that)`
    `long` | `getCardinalityEstimate()` Return an esimate of the number of nodes that will be returned by this index given the constraints.
    `Collection<Constraint>` | `getConstraints()` Get the constraints that should be applied to this index if/when it is used.
    `int` | `getCostEstimate()` Return an estimate of the cost of using the index for the query in question.
    `String` | `getName()` Get the name of this index.
    `Map<String,Object>` | `getParameters()` Get the provider-specific parameters for this index usage.
    `String` | `getProviderName()` The name of the provider that owns the index.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### NODE_BY_PATH_INDEX_NAME

          protected static final String NODE_BY_PATH_INDEX_NAME

      See Also:
        Constant Field Values

    - #### CHILDREN_BY_PATH_INDEX_NAME

          protected static final String CHILDREN_BY_PATH_INDEX_NAME

      See Also:
        Constant Field Values

    - #### DESCENDANTS_BY_PATH_INDEX_NAME

          protected static final String DESCENDANTS_BY_PATH_INDEX_NAME

      See Also:
        Constant Field Values

    - #### PATH_PARAMETER

          protected static final String PATH_PARAMETER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### IndexPlan

          public IndexPlan(String name,
                   String providerName,
                   Collection<Constraint> constraints,
                   int costEstimate,
                   long cardinalityEstimate,
                   Map<String,Object> parameters)

  - ### Method Detail

    - #### getCardinalityEstimate

          public long getCardinalityEstimate()

      Return an esimate of the number of nodes that will be returned by this index given the constraints. For example, an index that will return one node should have a cardinality of 1.

      When possible, the actual cardinality should be used. However, since an accurate number is often expensive or impossible to determine in the planning phase, the cardinality can instead represent a rough order of magnitude.

      Indexes with lower costs and lower `cardinalities` will be favored over other indexes.

      Returns:
        the cardinality estimate; never negative

    - #### getCostEstimate

          public int getCostEstimate()

      Return an estimate of the cost of using the index for the query in question. An index that is expensive to use will have a higher cost than another index that is less expensive to use. For example, if a `IndexProvider` that owns the index is in a remote process, then the cost estimate will need to take into account the cost of transmitting the request with the criteria and the response with all of the node that meet the criteria of the index.

      Indexes with lower costs and lower `cardinalities` will be favored over other indexes.

      Returns:
        the cost estimate; never negative

    - #### getName

          public String getName()

      Get the name of this index.
      Returns:
        the index name; never null

    - #### getProviderName

          public String getProviderName()

      The name of the provider that owns the index.
      Returns:
        the provider name; null if the index is handled internally by ModeShape by something other than a provider

    - #### getConstraints

          public Collection<Constraint> getConstraints()

      Get the constraints that should be applied to this index if/when it is used.
      Returns:
        the constraints; may be null or empty if there are no constraints

    - #### getParameters

          public Map<String,Object> getParameters()

      Get the provider-specific parameters for this index usage.
      Returns:
        the parameters; never null but possibly empty

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### compareTo

          public int compareTo(IndexPlan that)

      Specified by:
        `compareTo` in interface `Comparable<IndexPlan>`

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