public final class DOFQuery extends java.lang.Object implements DOFImmutable, java.io.Serializable
DOFSystem.QueryOperationListener
when object interfaces are added to or
removed from the system.
A DOFQuery consists of a list of filters and a restriction list of DOFInterfaceIDs.
A Filter consists of a list of DOFObjectIDs and a list of DOFInterfaceIDs; both may be empty.
To match a filter the providing object must be providing on ANY of the specified DOFObjectIDs (if the list of
DOFObjectIDs is empty it will match any OID) and must be providing ALL of the specified DOFInterfaceIDs (if the list
of DOFInterfaceIDs is empty it will match any IID).
To match a query the providing object must match ANY filter and and be in the restriction list (if the restriction
list is empty it will match any IID).
Must be created with a DOFQuery.Builder
. This class is immutable once built.
Any changes will need to be made using the Builder.Builder(DOFQuery) constructor.Modifier and Type | Class and Description |
---|---|
static class |
DOFQuery.Builder
Builder is used to build DOFQueries.
|
static class |
DOFQuery.MatchStyle
Represents the various styles of matching that may be performed during a query.
|
Constructor and Description |
---|
DOFQuery(java.util.List<org.opendof.core.internal.protocol.oap.QueryFilter> filterList,
java.util.Set<DOFInterfaceID> interfaceRestrictionList,
DOFQuery.MatchStyle style,
java.util.Set<DOFObjectID> filterMatchedSet) |
Modifier and Type | Method and Description |
---|---|
boolean |
isFilterMatch(DOFObjectID objectID,
java.util.List<DOFInterfaceID> iids)
Does the object and interfaces match a query.
|
boolean |
isPreviousFilterMatch(DOFObjectID objectID)
Does the objectID match a query and has it already been matched on this query.
|
java.util.List<DOFInterfaceID> |
restrict(java.util.List<DOFInterfaceID> iids)
Gets the intersection of the set of interfaces that are currently provided and the set of interfaces in the
restriction list.
|
java.lang.String |
toString() |
public DOFQuery(java.util.List<org.opendof.core.internal.protocol.oap.QueryFilter> filterList, java.util.Set<DOFInterfaceID> interfaceRestrictionList, DOFQuery.MatchStyle style, java.util.Set<DOFObjectID> filterMatchedSet)
public java.util.List<DOFInterfaceID> restrict(java.util.List<DOFInterfaceID> iids)
iids
- The set of interfaces that are currently provided. This must not be null.public boolean isPreviousFilterMatch(DOFObjectID objectID)
objectID
- The object identifier. Must not be null.public boolean isFilterMatch(DOFObjectID objectID, java.util.List<DOFInterfaceID> iids)
For details on how filters are matched see DOFQuery
.
objectID
- The object identifier. This must not be null.iids
- The current list of interfaces provided on the object. This must not be null.public java.lang.String toString()
toString
in class java.lang.Object