|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.qe.OrderingScore<S>
public class OrderingScore<S extends Storable>
Evaluates an index for how well it matches a query's desired ordering. An ordering score is not a single absolute value – instead it has a relative weight when compared to other scores.
An index matches a desired ordering if the arrangement of properties
matches. Not all properties of the index need to be used, however. Also,
gaps in the arrangement are allowed if a property identity filter
matches. A property identity filter is of the form "a = ?".
An OrderingScore measures the number of ordering properties that are matched and the number that are remaining. If there are remainder properties, then the user of the evaluated index will need to perform a post-sort operation to achieve the desired results.
In general, an OrderingScore is better than another if it has more matched properties and fewer remainder properties. Index clustering, property count, and natural order is also considered.
FilteringScore,
CompositeScore| Method Summary | ||
|---|---|---|
boolean |
canMergeRemainderOrdering(OrderingScore<S> other)
Returns true if the given score uses an index exactly the same as this one. |
|
static
|
evaluate(OrderedProperty<S>[] indexProperties,
boolean unique,
boolean clustered,
Filter<S> filter,
OrderingList<S> ordering)
Evaluates the given index properties for its ordering capabilities against the given filter and order-by properties. |
|
static
|
evaluate(StorableIndex<S> index,
Filter<S> filter,
OrderingList<S> ordering)
Evaluates the given index for its ordering capabilities against the given filter and order-by properties. |
|
static Comparator<OrderingScore<?>> |
fullComparator()
Returns a comparator which determines which OrderingScores are better. |
|
OrderingList<S> |
getFreeOrdering()
Returns potential ordering properties that the evaluated index can handle, if arranged to immediately follow the handled orderings. |
|
int |
getHandledCount()
Returns the number of desired orderings the evaluated index supports. |
|
OrderingList<S> |
getHandledOrdering()
Returns the ordering properties that the evaluated index supports. |
|
int |
getIndexPropertyCount()
Returns the amount of properties in the evaluated index. |
|
int |
getRemainderCount()
Returns the number of desired orderings the evaluated index does not support. |
|
OrderingList<S> |
getRemainderOrdering()
Returns the ordering properties that the evaluated index does not support. |
|
OrderingList<S> |
getUnusedOrdering()
Returns unused ordering properties of the evaluated index because they were filtered out. |
|
boolean |
isIndexClustered()
Returns true if evaluated index is clustered. |
|
OrderingList<S> |
mergeRemainderOrdering(OrderingScore<S> other)
Merges the remainder orderings of this score with the one given. |
|
boolean |
shouldReverseOrder()
Returns true if evaluated index must be iterated in reverse to achieve the desired ordering. |
|
String |
toString()
|
|
OrderingScore<S> |
withRemainderOrdering(OrderingList<S> ordering)
Returns a new OrderingScore with the remainder replaced. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <S extends Storable> OrderingScore<S> evaluate(StorableIndex<S> index,
Filter<S> filter,
OrderingList<S> ordering)
index - index to evaluatefilter - optional filter which cannot contain any logical 'or' operations.ordering - optional properties which define desired ordering
IllegalArgumentException - if index is null or filter is not supported
public static <S extends Storable> OrderingScore<S> evaluate(OrderedProperty<S>[] indexProperties,
boolean unique,
boolean clustered,
Filter<S> filter,
OrderingList<S> ordering)
indexProperties - index properties to evaluateunique - true if index is uniqueclustered - true if index is clusteredfilter - optional filter which cannot contain any logical 'or' operations.ordering - optional properties which define desired ordering
IllegalArgumentException - if index is null or filter is not supportedpublic static Comparator<OrderingScore<?>> fullComparator()
<0 if first
score is better, 0 if equal, or >0 if second is better.
public boolean isIndexClustered()
public int getIndexPropertyCount()
public int getHandledCount()
public OrderingList<S> getHandledOrdering()
public int getRemainderCount()
public OrderingList<S> getRemainderOrdering()
public boolean shouldReverseOrder()
public OrderingList<S> getFreeOrdering()
public OrderingList<S> getUnusedOrdering()
public boolean canMergeRemainderOrdering(OrderingScore<S> other)
public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other)
public OrderingScore<S> withRemainderOrdering(OrderingList<S> ordering)
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||