org.ka2ddo.yaac.filter
Class Filter

java.lang.Object
  extended by org.ka2ddo.yaac.filter.Filter
Direct Known Subclasses:
CumulativeBooleanAndFilter, DestinationFilter, LastDigipeatFilter, LocalStationFilter, MessageContentFilter, MicEFilter, OperatorPresentFilter, PacketSourceFilter, PlaybackFilter, PriorityFilter, RadiusFilter, RelativeTimeFilter, SendingStationFilter, StationClassFilter, SymbolFilter, ValidInvalidFilter

public abstract class Filter
extends java.lang.Object

This abstract class defines the basic concept of a message filter. It defines APIs by which an arbitrarily complex filter expression may be used to specify which messages and stations are displayed.

Note this abstract class does not extend the Cloneable interface, to ensure that Filter implementers explicitly ensure that the clone() method has been properly adjusted to correctly clone the stateful Filters.


Field Summary
static int RESULT_NEUTRAL
          This Filter cannot determine if this object passes the filter or not.
static int RESULT_PASS
          The object exactly passes this Filter and is completely acceptable by the Filter's constraints.
static int RESULT_REJECT
          The object is completely unacceptable to this Filter and should not be displayed, saved, etc..
static int RESULT_WEAK_PASS
          The object is loosely acceptable to the Filter.
static int RESULT_WEAK_REJECT
          The object is unacceptable to the Filter, but might want to be kept around and indicated as unacceptable.
 
Constructor Summary
Filter()
           
 
Method Summary
abstract  int acceptAX25Frame(AX25Frame frame)
          Indicate whether the specified message should be displayed or used to determine if a station should be displayed (if recursively called from acceptStation()).
abstract  int acceptMessage(AX25Message msg)
          Indicate whether the specified message should be displayed or used to determine if a station should be displayed (if recursively called from acceptStation()).
abstract  int acceptStation(StationState ss)
          Indicate whether the specified station should be displayed.
abstract  void addFilterChangeListener(FilterChangeListener l)
          Register a listener for changes of this Filter.
 java.lang.Object clone()
          Creates and returns a copy of this object.
abstract  java.lang.String getFilterHelpTagName()
          Report a tag name used to look up JavaHelp for a filter editor.
abstract  java.lang.String getFilterTypeTagName()
          Report a tag name used to look up the labelling for an editor panel for this editor instance in a ResourceBundle of translated names.
abstract  java.lang.String getFilterUIName()
          Get the class name of a dynamically loadable class for the the GUI for this filter.
abstract  void removeFilterChangeListener(FilterChangeListener l)
          Deregisters a listener.
abstract  void setToPassall()
          Reset the filter to a configuration that would pass the maximum amount of messages, packets, and stations.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESULT_REJECT

public static final int RESULT_REJECT
The object is completely unacceptable to this Filter and should not be displayed, saved, etc..

See Also:
Constant Field Values

RESULT_WEAK_REJECT

public static final int RESULT_WEAK_REJECT
The object is unacceptable to the Filter, but might want to be kept around and indicated as unacceptable.

See Also:
Constant Field Values

RESULT_NEUTRAL

public static final int RESULT_NEUTRAL
This Filter cannot determine if this object passes the filter or not.

See Also:
Constant Field Values

RESULT_WEAK_PASS

public static final int RESULT_WEAK_PASS
The object is loosely acceptable to the Filter.

See Also:
Constant Field Values

RESULT_PASS

public static final int RESULT_PASS
The object exactly passes this Filter and is completely acceptable by the Filter's constraints.

See Also:
Constant Field Values
Constructor Detail

Filter

public Filter()
Method Detail

getFilterTypeTagName

public abstract java.lang.String getFilterTypeTagName()
Report a tag name used to look up the labelling for an editor panel for this editor instance in a ResourceBundle of translated names.

Returns:
String to use in looking up form label for this filter's editor

getFilterHelpTagName

public abstract java.lang.String getFilterHelpTagName()
Report a tag name used to look up JavaHelp for a filter editor.

Returns:
String name (as defined in HelpMap.jhm) for this filter's online help, or null if there is no filter specific help

getFilterUIName

public abstract java.lang.String getFilterUIName()
Get the class name of a dynamically loadable class for the the GUI for this filter. The name is allowed to have a wildcard '*' in it where a GUI type ("gui" for standard Java or "android" for Android) can be substituted.

Returns:
String name of GUI class for this filter

acceptStation

public abstract int acceptStation(StationState ss)
Indicate whether the specified station should be displayed. The acceptMessage() and acceptAX25Frame() methods may be called to assist in the determination.

Parameters:
ss - StationState record to analyze
Returns:
RESULT_xxx constant indicating if station information should be displayed

acceptMessage

public abstract int acceptMessage(AX25Message msg)
Indicate whether the specified message should be displayed or used to determine if a station should be displayed (if recursively called from acceptStation()).

Parameters:
msg - the APRS Message record to analyze
Returns:
RESULT_xxx constant indicating if message information should be displayed

acceptAX25Frame

public abstract int acceptAX25Frame(AX25Frame frame)
Indicate whether the specified message should be displayed or used to determine if a station should be displayed (if recursively called from acceptStation()).

Parameters:
frame - the timestamped AX25 frame record to analyze
Returns:
RESULT_xxx constant indicating if message information should be displayed

addFilterChangeListener

public abstract void addFilterChangeListener(FilterChangeListener l)
Register a listener for changes of this Filter.

Parameters:
l - FilterChangeListener to register

removeFilterChangeListener

public abstract void removeFilterChangeListener(FilterChangeListener l)
Deregisters a listener. The listener will no longer be informed of changes to this filter.

Parameters:
l - FilterChangeListener to deregister

setToPassall

public abstract void setToPassall()
Reset the filter to a configuration that would pass the maximum amount of messages, packets, and stations.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:
 x.clone() != x
will be true, and that the expression:
 x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
 x.clone().equals(x)
will be true, this is not an absolute requirement, and can be false for Filters of the same class because of their filtering attributes changing post-cloning.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. Valid Filters should never throw this exception.
See Also:
Cloneable