public abstract class AccessQuery extends DefinitionalObject
Modifier | Constructor and Description |
---|---|
protected |
AccessQuery()
Initializes a new instance.
|
protected |
AccessQuery(AccessQuery existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
static AccessQueryAnd |
and(AccessQuery... queries)
Creates a query that is satisfied whenever all of its sub-queries are satisfied.
|
static AccessQueryAnd |
and(AccessQuery first,
AccessQuery second)
Combines two queries using a logical AND operation.
|
static AccessQuery |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
int maximumLength,
IServiceProvider... links)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static <T extends IServiceProvider> |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
int maximumLength,
Iterable<T> links)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static AccessQuery |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
int maximumLength,
LinkGraph linkGraph)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static AccessQuery |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
IServiceProvider... links)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static <T extends IServiceProvider> |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
Iterable<T> links)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static AccessQuery |
anyPath(IServiceProvider transmitter,
IServiceProvider receiver,
LinkGraph linkGraph)
Creates a query which is satisfied whenever any path exists between a given transmitter and receiver.
|
static AccessQueryAtLeastN |
atLeastN(int n,
AccessQuery... queries)
Creates a query that is satisfied whenever at least N of the specified sub-queries are satisfied.
|
static AccessQueryAtMostN |
atMostN(int n,
AccessQuery... queries)
Creates a query that is satisfied whenever no more than N of the specified sub-queries are satisfied.
|
protected abstract boolean |
checkForSameDefinition(AccessQuery other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected boolean |
checkForSameDefinition(DefinitionalObject other)
Checks to determine if another instance has the same definition as this instance and
returns
true if it does. |
protected int |
computeCurrentDefinitionHashCode()
Computes a hash code based on the current properties of this object.
|
static AccessQueryExactlyN |
exactlyN(int n,
AccessQuery... queries)
Creates a query that is satisfied whenever exactly N of the specified sub-queries are satisfied.
|
static AccessQuery |
fromObject(IServiceProvider constrainedObject)
Constructs an access query from the constraints applied to a given object.
|
static AccessQuery |
fromObjectAllowNoConstraints(IServiceProvider constrainedObject)
Constructs an access query from the constraints applied to a given object or link.
|
HierarchicalLogger |
getDebuggingLogger()
Gets a logger to which debugging information will be written.
|
abstract int |
getEvaluationOrder()
Gets the suggested evaluation order of this query.
|
AccessEvaluator |
getEvaluator()
Gets an evaluator that can be used to evaluate this query for a given time or for intervals of time.
|
AccessEvaluator |
getEvaluator(IServiceProvider timeObserver)
Gets an evaluator that can be used to evaluate this query for a given time or for intervals of time.
|
abstract AccessEvaluator |
getEvaluator(IServiceProvider timeObserver,
EvaluatorGroup group)
Gets an evaluator that can be used to evaluate this query for a given time or for intervals of time.
|
static AccessQueryNot |
not(AccessQuery query)
Inverts a query using a logical NOT operation.
|
static AccessQueryOr |
or(AccessQuery... queries)
Creates a query that is satisfied whenever any of its sub-queries are satisfied.
|
static AccessQueryOr |
or(AccessQuery first,
AccessQuery second)
Combines two queries using a logical OR operation.
|
void |
setDebuggingLogger(HierarchicalLogger value)
Sets a logger to which debugging information will be written.
|
abstract AccessQuery |
toDisjunctiveNormalForm()
Transforms this query to disjunctive normal form (DNF).
|
areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, areSameDefinition, clone, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, collectionItemsAreSameDefinition, dictionaryItemsAreSameDefinition, enumerateDependencies, freeze, freezeAggregatedObjects, getCollectionHashCode, getCollectionHashCode, getCollectionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDefinitionHashCode, getDictionaryHashCode, getIsFrozen, isSameDefinition, throwIfFrozen
protected AccessQuery()
protected AccessQuery(@Nonnull AccessQuery existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.protected final boolean checkForSameDefinition(DefinitionalObject other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.checkForSameDefinition
in class DefinitionalObject
other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected abstract boolean checkForSameDefinition(AccessQuery other)
true
if it does. Derived classes MUST override this method and check
all new fields introduced by the derived class for definitional equivalence. It is NOT necessary
to check base class fields because the base class will already have done that. When overriding this method,
you should NOT call the base implementation because it will return false
for all derived-class instances.
Derived classes should check the type of other
to preserve the symmetric nature of IEquatableDefinition.isSameDefinition(java.lang.Object)
.other
- The other instance to compare to this one.true
if the two objects are defined equivalently; otherwise false
.protected int computeCurrentDefinitionHashCode()
AccessQuery.checkForSameDefinition(agi.foundation.infrastructure.DefinitionalObject)
method.computeCurrentDefinitionHashCode
in class DefinitionalObject
public abstract int getEvaluationOrder()
AccessQueryAnd
) generally evaluate their sub-queries in
ascending order of this value, so queries with a lower evaluation order are evaluated
earlier than queries with a higher evaluation order.@Nonnull public final AccessEvaluator getEvaluator()
This attempts to create an evaluator without a specified time observer.
An exception will be thrown if the AccessQuery
has time delays
or other features that require a specified observer.
@Nonnull public final AccessEvaluator getEvaluator(IServiceProvider timeObserver)
timeObserver
- The IServiceProvider
time observer to use when evaluating this query.@Nonnull public abstract AccessEvaluator getEvaluator(IServiceProvider timeObserver, @Nonnull EvaluatorGroup group)
timeObserver
- The IServiceProvider
time observer to use when evaluating this query.group
- The group with which to associate the new evaluator. By grouping evaluators
that are often evaluated at the same Julian dates, common computations can be performed only once
for the entire group instead of multiple times for each evaluator.@Nonnull public abstract AccessQuery toDisjunctiveNormalForm()
public final HierarchicalLogger getDebuggingLogger()
public final void setDebuggingLogger(HierarchicalLogger value)
public static AccessQueryAnd and(AccessQuery first, AccessQuery second)
first
- The first query.second
- The second query.first
and second
queries.public static AccessQueryOr or(AccessQuery first, AccessQuery second)
first
- The first query.second
- The second query.first
and second
queries.public static AccessQueryNot not(AccessQuery query)
query
- The query to invert.public static AccessQuery fromObject(IServiceProvider constrainedObject)
LinkInstantaneous
or LinkSpeedOfLight
, or it can be
a single object, such as
Platform
.
This method assembles a query from the constraints attached to the specified object using
IAccessConstraintsService
. This service can be added to a
Platform
,
a LinkInstantaneous
, or a LinkSpeedOfLight
by adding the
AccessConstraintsExtension
to the object's Extensions
(get
)
collection. If the specified constrainedObject
is a link, the returned query will
also include constraints attached to the Transmitter
(get
) and Receiver
(get
),
if any.
In all cases, this method attempts to infer the objects to which the constraints apply from their
context. For example, if the Transmitter end of a link specified as the
constrainedObject
parameter has an
ElevationAngleConstraint
attached to it, the constraint's
ConstrainedLink
(get
/ set
)
property will be set to the constrainedObject
link and the
ConstrainedLinkEnd
(get
/ set
)
property will be set to LinkRole.TRANSMITTER
. Instead of modifying the constraints directly,
this method will copy them and include the copies in the returned query.
constrainedObject
- The link or single object from which to construct a query.IllegalStateException
- The constrainedObject
does not have any constraints associated with it.public static AccessQuery fromObjectAllowNoConstraints(@Nonnull IServiceProvider constrainedObject)
null
will
be returned. This method is identical to AccessQuery.fromObject(agi.foundation.IServiceProvider)
except that it will not
throw when the object does not provide the IAccessConstraintsService
.constrainedObject
- The link or single object from which to construct a query.null
if the object does not have any constraints.public static AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, IServiceProvider... links)
transmitter
- The transmitter.receiver
- The receiver.links
- The list of links from which the possible paths are deduced.public static AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, int maximumLength, IServiceProvider... links)
transmitter
- The transmitter.receiver
- The receiver.maximumLength
- The maximum length of a path between the transmitter and receiver, expressed as the number of links traversed.
To allow paths of any length, pass Integer.MAX_VALUE
for this argument.links
- The list of links from which the possible paths are deduced.public static <T extends IServiceProvider> AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, Iterable<T> links)
T
- The type used to represent a link.transmitter
- The transmitter.receiver
- The receiver.links
- The list of links from which the possible paths are deduced.public static <T extends IServiceProvider> AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, int maximumLength, @Nonnull Iterable<T> links)
T
- The type used to represent a link.transmitter
- The transmitter.receiver
- The receiver.maximumLength
- The maximum length of a path between the transmitter and receiver, expressed as the number of links traversed.
To allow paths of any length, pass Integer.MAX_VALUE
for this argument.links
- The list of links from which the possible paths are deduced.public static AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, @Nonnull LinkGraph linkGraph)
LinkGraph
.transmitter
- The transmitter.receiver
- The receiver.linkGraph
- The graph of links from which the possible paths between the transmitter
and receiver
are computed.public static AccessQuery anyPath(IServiceProvider transmitter, IServiceProvider receiver, int maximumLength, @Nonnull LinkGraph linkGraph)
LinkGraph
.transmitter
- The transmitter.receiver
- The receiver.maximumLength
- The maximum length of a path between the transmitter and receiver, expressed as the number of links traversed.
To allow paths of any length, pass Integer.MAX_VALUE
for this argument.linkGraph
- The graph of links from which the possible paths between the transmitter
and receiver
are computed.@Nonnull public static AccessQueryAtLeastN atLeastN(int n, @Nonnull AccessQuery... queries)
n
- The number of the given queries that must be satisfied for the returned query to be satisfied.queries
- The queries, at least n
of which must be satisfied.@Nonnull public static AccessQueryAtMostN atMostN(int n, @Nonnull AccessQuery... queries)
n
- The maximum number of the given queries that can be satisfied for the returned query to be satisfied.queries
- The queries, at most n
of which can be satisfied.@Nonnull public static AccessQueryExactlyN exactlyN(int n, @Nonnull AccessQuery... queries)
n
- The number of the given queries that can be satisfied for the returned query to be satisfied.queries
- The queries, exactly n
of which must be satisfied.@Nonnull public static AccessQueryAnd and(@Nonnull AccessQuery... queries)
queries
- The queries, all of which must be satisfied.@Nonnull public static AccessQueryOr or(@Nonnull AccessQuery... queries)
queries
- The queries, any of which can be satisfied.