public class NotFilter extends QDFilter implements QDFilter.UpdateListener
QDFilter.negate()
operation.QDFilter.Kind, QDFilter.SyntaxPrecedence, QDFilter.Updated, QDFilter.UpdateListener
Modifier and Type | Method and Description |
---|---|
boolean |
accept(QDContract contract,
DataRecord record,
int cipher,
String symbol)
Returns true if this filter accepts a given record and symbol on the specified contract.
|
protected void |
dynamicTrackingStart()
This method is called under
synchronized(getUpdated()) each time listeners list becomes non-empty. |
protected void |
dynamicTrackingStop()
This method is called under
synchronized(getUpdated()) each time listeners list becomes empty. |
boolean |
equals(Object o) |
void |
filterUpdated(QDFilter filter)
This method is fired at most once is a lifetime of a
dynamic filter when
it updates. |
String |
getDefaultName()
Composes default string representation of the filter.
|
QDFilter.Kind |
getKind()
Returns a kind of this filter that constrains and defines its overall behaviour.
|
int |
hashCode() |
boolean |
isDynamic()
Returns
true if this filter is dynamic, that is it can update and send the corresponding
notification. |
boolean |
isFast()
Returns
true if this filter is fast, that is it can be quickly checked without blocking. |
boolean |
isStable()
Returns
true if this filter is stable, that is the decision of its
accept method never changes for a given set of
arguments even from restart to restart and from one JVM to another. |
QDFilter |
negate()
Returns negation of this filter.
|
protected QDFilter |
produceUpdatedFilter()
This method is called under
synchronized(this) when fireFilterUpdated
is called with null argument to synchronously produce updated instance of this filter. |
QDFilter |
toStableFilter()
Returns a stable filter that is the same or more encompassing as this filter.
|
accept, acceptRecord, addUpdateListener, checkShortName, fireFilterUpdated, fromFilter, getScheme, getSymbolSet, getSyntaxPrecedence, getUpdated, getUpdatedFilter, hasShortName, removeUpdateListener, setName, setNameOrDefault, setShortName, toString, unwrap
public NotFilter(QDFilter delegate)
public QDFilter.Kind getKind()
QDFilter
public boolean accept(QDContract contract, DataRecord record, int cipher, String symbol)
QDFilter
public QDFilter negate()
QDFilter
new NotFilter
(this)
.public boolean isStable()
QDFilter
true
if this filter is stable, that is the decision of its
accept
method never changes for a given set of
arguments even from restart to restart and from one JVM to another.
Returns false if filter is dynamic.
This implementation returns true
when toStableFilter() == this
.
All overriding implementations have equivalent behavior.
isStable
in class QDFilter
QDFilter.toStableFilter()
public boolean isDynamic()
QDFilter
true
if this filter is dynamic, that is it can update and send the corresponding
notification. Use QDFilter.getUpdatedFilter()
to get the most recent instance of the dynamic filter.
This implementation returns false
and is designed for override.
public boolean isFast()
QDFilter
true
if this filter is fast, that is it can be quickly checked without blocking.
There filters are checked under the collector's global lock when processing subscription messages.
On the contrast, slow filters are checked outside of global lock when processing subscription messages.
This implementation returns false
and is designed for override.
public QDFilter toStableFilter()
QDFilter
QDFilter.ANYTHING
, which means that this filter is not stable
(it is dynamic) and the only stable extension of it constitutes everything.
Stable filters must return this
as a result of this method. The result of this method
satisfies the following constrains:
result.toStableFilter() == result
this.accept(...)
implies result.accept(...)
.
result.toString()
must parse back to the same filter via data scheme's
SubscriptionFilterFactory
.
This method shall never return null.
toStableFilter
in interface StableSubscriptionFilter
toStableFilter
in class QDFilter
protected void dynamicTrackingStart()
QDFilter
synchronized(getUpdated())
each time listeners list becomes non-empty.
This implementation does nothing and is designed for override to allocate resources for tracking
changes of this dynamic filter. This method is never invoked for non-dynamic filters.
This method is invoked only when this instance is the most up-to-date version of dynamic filter.dynamicTrackingStart
in class QDFilter
protected void dynamicTrackingStop()
QDFilter
synchronized(getUpdated())
each time listeners list becomes empty.
This implementation does nothing and is designed for override to free resources for tracking
changes of this dynamic filter. This method is never invoked for non-dynamic filters.
This method is invoked only after QDFilter.dynamicTrackingStart()
was invoked.dynamicTrackingStop
in class QDFilter
protected QDFilter produceUpdatedFilter()
QDFilter
synchronized(this)
when fireFilterUpdated
is called with null
argument to synchronously produce updated instance of this filter.
Note, that the result of this method must be produced by invoking a special
constructor QDFilter.QDFilter(DataScheme, QDFilter)
.produceUpdatedFilter
in class QDFilter
public void filterUpdated(QDFilter filter)
QDFilter.UpdateListener
dynamic
filter when
it updates. The new value of the filter shall be retrieved with QDFilter.getUpdatedFilter()
method.
This method is never called under synchronization on any filter to avoid deadlocks.filterUpdated
in interface QDFilter.UpdateListener
filter
- The filter that was updated. Use filter.getUpdateFilter()
to get the new instance of
the updated filter.public String getDefaultName()
QDFilter
QDFilterFactory
.
To parse this string representation back into the instance of this class use
CompositeFilters.valueOf(String, DataScheme)
.
This method must be overriden in custom QDFilter
implementations.
This implementation returns null
.
getDefaultName
in class QDFilter
Copyright © 2002-2020 Devexperts LLC. All Rights Reserved.