faa.tg.filters
Class AbstractFilter

java.lang.Object
  extended by faa.tg.filters.AbstractFilter
All Implemented Interfaces:
Filter, FilterableListener, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
AbstractValidator, AcCountFilter, AcidFilter, AcidListFilter, AcKmlWriter, AcLatLonGeoMapPointFactory, AcTypeFilter, AidlAcWriter, AidlWriter, AircraftFilter, AirportFilter, AltFilter, AltSpdErrorFactory, BaseVsTestPlotXml, BeaconCodeFactory, ByDayFilter, BzProcessor, ClassFilter, Counter, DateFilter, DayOfMonthFilter, DelimWriter, DepartureAirportFilter, DestinationAirportFilter, DistanceFilter, DistanceSummaryFactory, DistFactory, DistTrackFactory, DraCounter, DraStore, DurationFactory, DynamicDensityFactory, EmptyTgfFlightPlanFilter, EnrouteCalcFactory, EventFileCombiner, ExclusionWrapper, FilterableObjectWriter, FilterList, FilterMultiplexer, FirstFilter, FixFilter, FlightplanLimiter, FlightplanPostProcessor, FlightplanPostProcessor2, FlyingStatusFilter, FuelBurnFactory, FzProcessor, FzRtByAcidListFilter, GateHoldFilter, GeoFilter, HflEnrouteFactory, HflGroundFactory, HflHandoffToBoundaryFilter, HflSpCmd, HflVisualFactory, LatLonAltWriter, LevelFilter, Location2Plot, NasFlightPlanExpansionFactory, ParameterFilter, PassThroughFilter, PduTimeFactory, PilotCmdFilter, PilotCmdSourceFilter, PlotGenerator, PositionFactory, PositionListFilter, PtplotWriter, PttReader, RadarMessageToBeaconLocation, RecordableReader, RecordableWriter, RecordingDeadReckonAircraftFactory, RouteLimiter, RtBySectorFilter, Runway2Plot, RunwayFilter, SectorFilter, SectorizingWriter, SetSectorFilter, ShapeFilter, SimDiff, SpeedByActype, SpeedWriter, TermSimCalcFactory, TermSimFactory, TextDataFileReader, TextFilter, TextWriter, TextWriter, TimeFilter, TimeSampler, TmfAircraftListener, TmfDataBaseListener, TmfEventListener, TmfFileListener, TmfFilterPlexer, TmfMessageSieve, TmfRawWriter, TransmittedSimDataReader, Tz2TriggeredTzMessageFactory, TzByUfpFilter, TzFilter, TzFilter, TzProcessor, UfpArrivalFilter, UfpByTriggeredTzFilter, UfpDepartureFilter, UfpFactory, UfpFactory2, UfpFromFzFactory, UfpFromRtFactory, UfpFromUzFactory, UfpNasMaker, UfpTgfFlightPlanFactory, UfpTimeFromTzFactory, UfpWriter, XmlWriter

public abstract class AbstractFilter
extends java.lang.Object
implements Filter, FilterableListener

 AbstractFilter is an abstract class for the Filter interface that provides
 methods to add and remove listeners from the list of registered listeners,
 and to send registered listeners a specified Filterable.  The user or
 subclass must provide a source for the objects to be reported.
 AbstractFilter is also capable of listening for Filterable objects.
 call filter.handlObject(filterable)  to have the AbstractFilter operate
 on the filterable object.... ie filter it.
 
See the source: AbstractFilter.java

Version:
$Id: AbstractFilter.java,v 3.1 2006/03/14 15:56:23 samf Exp $
Author:
Dana N. Whicker, FAA/ACT-510, Mon May 22 2000
See Also:
Serialized Form

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
static boolean DEFAULT_PASS_THROUGH
           
protected  java.util.Vector listeners
           
protected  boolean passThrough
          Boolean indicating whether to send the Filterables that do not have the attributes that this filter uses for its test.
(package private) static long serialVersionUID
           
 
Constructor Summary
AbstractFilter()
           
 
Method Summary
 void addFilterableListener(FilterableListener lis)
          Register a filter event listener to be notified when a filter event is sent from this class.
 void fire(Filterable evt)
          Sends events that emerge from the filter to all registered listeners.
 boolean getPassThrough()
          Gets the boolean indicating whether to send on the Filterables that do not have the attributes the Filter tests on (e.g., for a Filter that operates on aircraft IDs: if Filterables without aircraft IDs are received, they will be sent to listeners if passThrough is set to true, and will not be sent if passThrough is false.
abstract  void handleObject(Filterable evt)
          Called to have filter receive events that the Filter is registered for.
 void removeFilterableListener(FilterableListener listener)
          Remove a filter event listener from the notification list.
 void setPassThrough(boolean passThrough)
          Sets a boolean indicating whether to send on the Filterables that do not have the attributes the Filter tests on (e.g., for a Filter that operates on aircraft IDs: if Fix and Airport information is received, it would be sent to listeners if passThrough is set to true, and would not be sent if passThrough is false).
static java.lang.String substituteFileVariables(java.lang.String inFileName)
          Utility that replaces pre-defined file name variables with environment values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID

See Also:
Constant Field Values

DEFAULT_PASS_THROUGH

public static final boolean DEFAULT_PASS_THROUGH
See Also:
Constant Field Values

listeners

protected java.util.Vector listeners

passThrough

protected boolean passThrough
Boolean indicating whether to send the Filterables that do not have the attributes that this filter uses for its test. The default is TRUE to give a uniform convention for the filters.

Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

handleObject

public abstract void handleObject(Filterable evt)
Called to have filter receive events that the Filter is registered for. This is where most of the work of the filter is done. To pass the evt on to the next Filter(s) call fire()

Specified by:
handleObject in interface FilterableListener
Parameters:
evt - The event containing the Filterable object.

getPassThrough

public boolean getPassThrough()
Gets the boolean indicating whether to send on the Filterables that do not have the attributes the Filter tests on (e.g., for a Filter that operates on aircraft IDs: if Filterables without aircraft IDs are received, they will be sent to listeners if passThrough is set to true, and will not be sent if passThrough is false.

Specified by:
getPassThrough in interface Filter
Returns:
Boolean indicating whether other Filterables are sent on.

setPassThrough

public void setPassThrough(boolean passThrough)
Sets a boolean indicating whether to send on the Filterables that do not have the attributes the Filter tests on (e.g., for a Filter that operates on aircraft IDs: if Fix and Airport information is received, it would be sent to listeners if passThrough is set to true, and would not be sent if passThrough is false).

Specified by:
setPassThrough in interface Filter
Parameters:
passThrough - Boolean indicating if to send on other Filterables.

addFilterableListener

public void addFilterableListener(FilterableListener lis)
Register a filter event listener to be notified when a filter event is sent from this class. If a subclass has information that must be set specifically for each listener, override this method with one that uses default values, and create a similar method that accepts parameters to register the filter listener.

Specified by:
addFilterableListener in interface Filter
Parameters:
lis - The listener to be added to the notification list.

removeFilterableListener

public void removeFilterableListener(FilterableListener listener)
Remove a filter event listener from the notification list.

Specified by:
removeFilterableListener in interface Filter
Parameters:
listener - The listener to be removed from the notification list.

fire

public void fire(Filterable evt)
Sends events that emerge from the filter to all registered listeners. Implementations of handleObject should call this method to pass on the event to others filters downstream.

Specified by:
fire in interface Filter
Parameters:
evt - The event containing the filter event.

substituteFileVariables

public static java.lang.String substituteFileVariables(java.lang.String inFileName)
Utility that replaces pre-defined file name variables with environment values. Substitutions made are: REG-EXPR REPLACEMENT STRING "^$HOME" -> result of System.getProperty("user.home")