com::cosylab::logging::engine::FiltersVector Class Reference

Inheritance diagram for com::cosylab::logging::engine::FiltersVector:
Inheritance graph
[legend]
Collaboration diagram for com::cosylab::logging::engine::FiltersVector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FiltersVector ()
void addFilter (Filter f, boolean active)
void setFilters (Filter[] f, boolean[] active)
void setFilters (FiltersVector flts)
int[] getAppliedFiltersIndexes ()
boolean hasActiveFilters ()
boolean isActive (int n)
boolean applyFilters (ILogEntry log)
String getFilterString ()
void clear ()
void loadFilters (File f, boolean eraseFilters, String fileName) throws Exception
void saveFilters (File f) throws IOException
Filter remove (int index)
void activateFilter (Filter f, boolean active)

Private Member Functions

File convertOldFilterFile (File oldFile) throws Exception

Private Attributes

Vector< Integer > activeFilters = new Vector<Integer>()

Detailed Description

Author:
acaproni

This class stores all the filters defined by the user. It supports all the functionalities needed by the filters like load and save, the check if a log is compatible with the filters and so on

FiltersList is a Vector. It uses another vector to store the indexes of the active filters


Constructor & Destructor Documentation

com::cosylab::logging::engine::FiltersVector::FiltersVector (  )  [inline]

Constructor


Member Function Documentation

void com::cosylab::logging::engine::FiltersVector::activateFilter ( Filter  f,
boolean  active 
) [inline]

Activate/deactivate a filter

Parameters:
f The filter to activate/deactivate
active If true, activate the filter

References activeFilters.

Referenced by com::cosylab::logging::settings::FilterChooserDialog::saveFilters().

void com::cosylab::logging::engine::FiltersVector::addFilter ( Filter  f,
boolean  active 
) [inline]
boolean com::cosylab::logging::engine::FiltersVector::applyFilters ( ILogEntry  log  )  [inline]

Apply the (active) filters to a log

Parameters:
log The log to check
Returns:
true if the log pass all the active filters check

References activeFilters.

Referenced by alma::acs::logging::tools::LogFileExtractor::logEntryReceived(), and com::cosylab::logging::engine::LogMatcher::match().

void com::cosylab::logging::engine::FiltersVector::clear (  )  [inline]
File com::cosylab::logging::engine::FiltersVector::convertOldFilterFile ( File  oldFile  )  throws Exception [inline, private]

Convert a filter file from the old to the new format The difference between the old stile and this new format is the presence of the history as well as the document type. At the present the history is not needed anymore but I keep this method for converting the xml type.

NOTE: This method will be removed

Parameters:
f The file to convert
Returns:
The file with new format
Exceptions:
<code>Exception</code> In case of error converting the file

Referenced by loadFilters().

int [] com::cosylab::logging::engine::FiltersVector::getAppliedFiltersIndexes (  )  [inline]

Return the indexes of the active filters

Returns:
The array of the indexes of the active filters

References activeFilters.

Referenced by alma::acs::logging::table::LogTableRowFilter::buildTableFilters(), and com::cosylab::logging::settings::FilterChooserDialog::setupFields().

String com::cosylab::logging::engine::FiltersVector::getFilterString (  )  [inline]

Returns the filter(s) applied as a string.

Returns:
The string with the applied filters

References activeFilters.

Referenced by alma::acs::logging::table::LogTableRowSorter::getFiltersString(), and com::cosylab::logging::engine::ACS::LCEngine::getFiltersString().

boolean com::cosylab::logging::engine::FiltersVector::hasActiveFilters (  )  [inline]
boolean com::cosylab::logging::engine::FiltersVector::isActive ( int  n  )  [inline]

Return true if the filter is active

Parameters:
n The index of the filters
Returns:
true if the filter is active

References activeFilters.

Referenced by saveFilters(), alma::acs::logging::table::LogTableRowSorter::setFilters(), and com::cosylab::logging::engine::ACS::LCEngine::setFilters().

void com::cosylab::logging::engine::FiltersVector::loadFilters ( File  f,
boolean  eraseFilters,
String  fileName 
) throws Exception [inline]

Load filters In case of errors an exception is thrown

Parameters:
f The xml file to parse (java.io.File)
eraseFilters If true existing filters will be deleted before loading
fileName Is the name of the file (it is usually null and the name is read from the parameter f. However when this method is called recursively we need to pass the name because the file we're reading is a temporary file (generated by converting the original file)
Exceptions:
<code>Exception</code> In case of error loading the filters

References addFilter(), clear(), and convertOldFilterFile().

Referenced by com::cosylab::logging::settings::FilterChooserDialog::loadFilters(), alma::acs::logging::tools::LogFileExtractor::LogFileExtractor(), and alma::acs::logging::dialogs::main::LogFrame::LogFrame().

Filter com::cosylab::logging::engine::FiltersVector::remove ( int  index  )  [inline]

Remove an element from the FiltersVector (We need to override this method because we need to keep the activeFilters aligned)

References activeFilters.

Referenced by com::cosylab::logging::settings::FilterChooserDialog::ButtonListener::actionPerformed().

void com::cosylab::logging::engine::FiltersVector::saveFilters ( File  f  )  throws IOException [inline]

Save the filters on a file

Parameters:
f The xml file to store the filters in (java.io.File)

References isActive().

Referenced by com::cosylab::logging::settings::FilterChooserDialog::saveAsFilters(), and com::cosylab::logging::settings::FilterChooserDialog::saveFilters().

void com::cosylab::logging::engine::FiltersVector::setFilters ( FiltersVector  flts  )  [inline]

Set the filters in this vector to be the same of the passed vector

Parameters:
flts The vector of filters

References activeFilters, and clear().

void com::cosylab::logging::engine::FiltersVector::setFilters ( Filter[]  f,
boolean[]  active 
) [inline]

Set the filters in the vector deleting any other filter. The activeFilters vector is also updated

Parameters:
filters The array of filters to add
active The array of active filters

References activeFilters, and clear().

Referenced by com::cosylab::logging::settings::FilterChooserDialog::restoreFilters(), alma::acs::logging::table::LogTableRowSorter::setFilters(), and com::cosylab::logging::settings::FilterChooserDialog::setFilters().


Member Data Documentation

Vector<Integer> com::cosylab::logging::engine::FiltersVector::activeFilters = new Vector<Integer>() [private]

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2