Improve support for query subclassing
Currently CQEngine allows the built-in Query objects such as Equal, Between etc. to be subclassed. However CQEngine's built-in indexes will only report that they support the specific types of queries which ship with CQEngine.
This means, if an application actually subclasses a Query, CQEngine will evaluate it correctly, but it will not benefit from any of CQEngine's built-in indexes.
The problem occurs because the built-in indexes check if the class of the query is contained in a set of supported query classes (where after a hash lookup, ultimately supportedQueryClass.equals(actualQueryClass) will be called).
The purpose of this issue is to investigate if that equality and set containment logic can be replaced with instanceof instead. This would allow built-in indexes to accelerate query subclasses, and it also might improve performance in general by eliminating hash lookups into the sets of supported query types.
Details
CQEngine uses the Index.supportsQuery() method to determine if any particular index can be used to accelerate a query. If so, it will then invoke Index.retrieve(). Currently there is a default implementation of supportsQuery() in AbstractAttributeIndex, and this default implementation is inherited by several indexes.
Obviously, the use of Set.contains() depends on object equality, so there's no easy way to replace that with queryClass.isAssignableFrom(), in order to be consistent with instanceof.
Therefore this investigation might involve removing the implementation of supportsQuery() from AbstractAttributeIndex and forcing each index which subclasses it to provide its own implementation of supportsQuery(). Each index could then use instanceof in both the Index.supportsQuery() method and in the Index.retrieve() method.