From 22094368c2865dcfb6daf8366425212b721a4657 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 05 Feb 2009 17:42:14 +0000
Subject: [PATCH] Merge ASN1 branch to trunk
---
opends/src/server/org/opends/server/backends/jeb/IndexQuery.java | 305 ++++++++++++++++++++++++++------------------------
1 files changed, 159 insertions(+), 146 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/IndexQuery.java b/opends/src/server/org/opends/server/backends/jeb/IndexQuery.java
index 23e3e82..a811623 100644
--- a/opends/src/server/org/opends/server/backends/jeb/IndexQuery.java
+++ b/opends/src/server/org/opends/server/backends/jeb/IndexQuery.java
@@ -25,185 +25,198 @@
* Copyright 2009 Sun Microsystems, Inc.
*/
-
package org.opends.server.backends.jeb;
+
+
import java.util.Collection;
import static org.opends.server.backends.jeb.IndexFilter.*;
+
/**
* This class represents a JE Backend Query.
*/
@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.VOLATILE,
- mayInstantiate=false,
- mayExtend=true,
- mayInvoke=false)
+ stability = org.opends.server.types.StabilityLevel.VOLATILE,
+ mayInstantiate = false,
+ mayExtend = true,
+ mayInvoke = false)
public abstract class IndexQuery
{
/**
- * Evaluates the index query and returns the EntryIDSet.
- * @return The EntryIDSet as a result of evaulation of this query.
- */
+ * Evaluates the index query and returns the EntryIDSet.
+ *
+ * @return The EntryIDSet as a result of evaulation of this query.
+ */
public abstract EntryIDSet evaluate();
- /**
- * Creates an IntersectionIndexQuery object from a collection of IndexQuery
- * objects.
- * @param subIndexQueries A collection of IndexQuery objects.
- * @return An IntersectionIndexQuery object.
- */
- public static IndexQuery createIntersectionIndexQuery(
- Collection<IndexQuery> subIndexQueries)
- {
- return new IntersectionIndexQuery(subIndexQueries);
- }
-
-
-
- /**
- * Creates a union IndexQuery object from a collection of IndexQuery
- * objects.
- * @param subIndexQueries Collection of IndexQuery objects.
- * @return A UnionIndexQuery object.
- */
- public static IndexQuery createUnionIndexQuery(
- Collection<IndexQuery> subIndexQueries)
- {
- return new UnionIndexQuery(subIndexQueries);
- }
-
-
-
- /**
- * Creates an empty IndexQuery object.
- * @return A NullIndexQuery object.
- */
- public static IndexQuery createNullIndexQuery()
- {
- return new NullIndexQuery();
- }
-}
-
-
-
-/**
-* This class creates a Null IndexQuery. It is used when there
-* is no record in the index. It may also be used when the
- * index contains all the records but an empty EntryIDSet should be
- * returned as part of the optimization.
-*/
-final class NullIndexQuery extends IndexQuery
-{
/**
- * {@inheritDoc}
+ * Creates an IntersectionIndexQuery object from a collection of
+ * IndexQuery objects.
+ *
+ * @param subIndexQueries
+ * A collection of IndexQuery objects.
+ * @return An IntersectionIndexQuery object.
*/
- @Override
- public EntryIDSet evaluate()
+ public static IndexQuery createIntersectionIndexQuery(
+ Collection<IndexQuery> subIndexQueries)
{
- return new EntryIDSet();
- }
-}
-
-
-
-
-
-/**
- * This class creates an intersection IndexQuery from a collection of
- * IndexQuery objects.
- */
-final class IntersectionIndexQuery extends IndexQuery
-{
- /**
- * Collection of IndexQuery objects.
- */
- private final Collection<IndexQuery> subIndexQueries;
-
-
- /**
- * Creates an instance of IntersectionIndexQuery.
- * @param subIndexQueries Collection of IndexQuery objects.
- */
- IntersectionIndexQuery(Collection<IndexQuery> subIndexQueries)
- {
- this.subIndexQueries = subIndexQueries;
+ return new IntersectionIndexQuery(subIndexQueries);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public EntryIDSet evaluate()
- {
- EntryIDSet entryIDs = null;
- for (IndexQuery query : subIndexQueries)
- {
- if (entryIDs == null)
- {
- entryIDs = query.evaluate();
- }
- else
- {
- entryIDs.retainAll(query.evaluate());
- }
- if (entryIDs.isDefined() &&
- entryIDs.size() <= FILTER_CANDIDATE_THRESHOLD)
- {
- break;
- }
- }
- return entryIDs;
- }
-}
-
-/**
- * This class creates a union of IndexQuery objects.
- */
-final class UnionIndexQuery extends IndexQuery
-{
- /**
- * Collection containing IndexQuery objects.
- */
- private final Collection<IndexQuery> subIndexQueries;
/**
- * Creates an instance of UnionIndexQuery.
- * @param subIndexQueries The Collection of IndexQuery objects.
+ * Creates a union IndexQuery object from a collection of IndexQuery
+ * objects.
+ *
+ * @param subIndexQueries
+ * Collection of IndexQuery objects.
+ * @return A UnionIndexQuery object.
*/
- UnionIndexQuery(Collection<IndexQuery> subIndexQueries)
+ public static IndexQuery createUnionIndexQuery(
+ Collection<IndexQuery> subIndexQueries)
{
- this.subIndexQueries = subIndexQueries;
+ return new UnionIndexQuery(subIndexQueries);
}
+
/**
- * {@inheritDoc}
+ * Creates an empty IndexQuery object.
+ *
+ * @return A NullIndexQuery object.
*/
- @Override
- public EntryIDSet evaluate()
+ public static IndexQuery createNullIndexQuery()
{
- EntryIDSet entryIDs = null;
- for (IndexQuery query : subIndexQueries)
+ return new NullIndexQuery();
+ }
+
+
+
+ /**
+ * This class creates a Null IndexQuery. It is used when there is no
+ * record in the index. It may also be used when the index contains
+ * all the records but an empty EntryIDSet should be returned as part
+ * of the optimization.
+ */
+ private static final class NullIndexQuery extends IndexQuery
+ {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EntryIDSet evaluate()
{
- if (entryIDs == null)
- {
- entryIDs = query.evaluate();
- }
- else
- {
- entryIDs.addAll(query.evaluate());
- }
- if (entryIDs.isDefined() &&
- entryIDs.size() <= FILTER_CANDIDATE_THRESHOLD)
- {
- break;
- }
+ return new EntryIDSet();
}
- return entryIDs;
}
-}
\ No newline at end of file
+
+ /**
+ * This class creates an intersection IndexQuery from a collection of
+ * IndexQuery objects.
+ */
+ private static final class IntersectionIndexQuery extends IndexQuery
+ {
+ /**
+ * Collection of IndexQuery objects.
+ */
+ private final Collection<IndexQuery> subIndexQueries;
+
+
+
+ /**
+ * Creates an instance of IntersectionIndexQuery.
+ *
+ * @param subIndexQueries
+ * Collection of IndexQuery objects.
+ */
+ private IntersectionIndexQuery(Collection<IndexQuery> subIndexQueries)
+ {
+ this.subIndexQueries = subIndexQueries;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EntryIDSet evaluate()
+ {
+ EntryIDSet entryIDs = null;
+ for (IndexQuery query : subIndexQueries)
+ {
+ if (entryIDs == null)
+ {
+ entryIDs = query.evaluate();
+ }
+ else
+ {
+ entryIDs.retainAll(query.evaluate());
+ }
+ if (entryIDs.isDefined()
+ && entryIDs.size() <= FILTER_CANDIDATE_THRESHOLD)
+ {
+ break;
+ }
+ }
+ return entryIDs;
+ }
+ }
+
+ /**
+ * This class creates a union of IndexQuery objects.
+ */
+ private static final class UnionIndexQuery extends IndexQuery
+ {
+ /**
+ * Collection containing IndexQuery objects.
+ */
+ private final Collection<IndexQuery> subIndexQueries;
+
+
+
+ /**
+ * Creates an instance of UnionIndexQuery.
+ *
+ * @param subIndexQueries
+ * The Collection of IndexQuery objects.
+ */
+ private UnionIndexQuery(Collection<IndexQuery> subIndexQueries)
+ {
+ this.subIndexQueries = subIndexQueries;
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EntryIDSet evaluate()
+ {
+ EntryIDSet entryIDs = null;
+ for (IndexQuery query : subIndexQueries)
+ {
+ if (entryIDs == null)
+ {
+ entryIDs = query.evaluate();
+ }
+ else
+ {
+ entryIDs.addAll(query.evaluate());
+ }
+ if (entryIDs.isDefined()
+ && entryIDs.size() <= FILTER_CANDIDATE_THRESHOLD)
+ {
+ break;
+ }
+ }
+ return entryIDs;
+ }
+ }
+}
--
Gitblit v1.10.0