public final class SymbolSetFilter extends QDFilter implements QDFilter.UpdateListener
QDFilter.Kind, QDFilter.SyntaxPrecedence, QDFilter.Updated, QDFilter.UpdateListener
Constructor and Description |
---|
SymbolSetFilter(DataScheme scheme,
SymbolSet set) |
SymbolSetFilter(QDFilter delegate) |
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.
|
SymbolSet |
getSymbolSet()
Returns a set of symbols that corresponds to this filter.
|
QDFilter.SyntaxPrecedence |
getSyntaxPrecedence() |
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. |
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. |
void |
setName(String name)
Sets a custom string representation for this filter.
|
QDFilter |
toStableFilter()
Returns a stable filter that is the same or more encompassing as this filter.
|
QDFilter |
unwrap()
Unwraps filter that wraps another filter for performance reasons only (functionally identical to its delegate).
|
static SymbolSetFilter |
valueOf(String spec,
DataScheme scheme)
Parses a given specification as symbol set filter for a given scheme.
|
accept, acceptRecord, addUpdateListener, checkShortName, fireFilterUpdated, fromFilter, getScheme, getUpdated, getUpdatedFilter, hasShortName, isStable, removeUpdateListener, setNameOrDefault, setShortName, toString
public SymbolSetFilter(DataScheme scheme, SymbolSet set)
public SymbolSetFilter(QDFilter delegate)
public static SymbolSetFilter valueOf(String spec, DataScheme scheme)
spec
- the filter specification.scheme
- the scheme.com.devexperts.util.InvalidFormatException
- if spec is invalid.public QDFilter.Kind getKind()
QDFilter
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 unwrap()
QDFilter
This implementation returns this
and is designed for override in wrapping filter implelentations.
public QDFilter negate()
QDFilter
new NotFilter
(this)
.public SymbolSet getSymbolSet()
QDFilter
null
when this filter does not have a symbol set.getSymbolSet
in class QDFilter
public boolean accept(QDContract contract, DataRecord record, int cipher, String symbol)
QDFilter
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.
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
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
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 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
public void setName(String name)
QDFilter
QDFilter.toString()
method.
It can be an arbitrarily complex expression, but this string representation should be parseable into this filter via QDFilterFactory
.
To parse this string representation back into the instance of this class use
CompositeFilters.valueOf(String, DataScheme)
.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
public QDFilter.SyntaxPrecedence getSyntaxPrecedence()
getSyntaxPrecedence
in class QDFilter
Copyright © 2002-2018 Devexperts LLC. All Rights Reserved.