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>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexPlan(String name, String workspaceName, String providerName, Collection<Constraint> constraints, Collection<JoinCondition> joinConditions, int costEstimate, long cardinalityEstimate, float selectivityEstimate, 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.
    `Collection<JoinCondition>` | `getJoinConditions()` Get the join conditions that should be applied to this index if/when it is used.
    `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.
    `Float` | `getSelectivityEstimate()` Get the estimate of the selectivity of this index for the query constraints.
    `String` | `getWorkspaceName()` Get the name of the workspace to which this index applies.
    `boolean` | `hasSelectivityEstimate()` Determine if there is a `selectivity estimate`.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### IndexPlan

          public IndexPlan(String name,
                   String workspaceName,
                   String providerName,
                   Collection<Constraint> constraints,
                   Collection<JoinCondition> joinConditions,
                   int costEstimate,
                   long cardinalityEstimate,
                   float selectivityEstimate,
                   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

    - #### hasSelectivityEstimate

          public boolean hasSelectivityEstimate()

      Determine if there is a `selectivity estimate`. This is equivalent to calling:

             return getSelectivityEstimate() != null

      Returns:
        true if there is an estimate of selectivity, or false if there is none

    - #### getSelectivityEstimate

          public Float getSelectivityEstimate()

      Get the estimate of the selectivity of this index for the query constraints. The selectivity is the ration of the number of rows that will be returned to the total number of rows, or

           selectivity = cardinality / total

      Thus the selectivity (if known) will always be between 0 and 1.0, inclusive.

      This method returns the estimated selectivity if it is know, or null if it is not known.

      Returns:
        the selectivity estimate, or null if there is none

    - #### getName

          public String getName()

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

    - #### getWorkspaceName

          public String getWorkspaceName()

      Get the name of the workspace to which this index applies.
      Returns:
        the workspace name; may be null if an implicit workspace is used

    - #### 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

    - #### getJoinConditions

          public Collection<JoinCondition> getJoinConditions()

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

    - #### 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.