eu.xtreemos.xosd.utilities.logger.filters
Class NonBlockingTokenFilter

java.lang.Object
  extended by eu.xtreemos.xosd.utilities.logger.filters.NonBlockingTokenFilter
All Implemented Interfaces:
ITokenFilter
Direct Known Subclasses:
BlockingTokenFilter, ContainsFilter

public abstract class NonBlockingTokenFilter
extends java.lang.Object
implements ITokenFilter

nonblocking filter always forwards the token as soon as possible (the add function must

Author:
uros

Field Summary
protected  TokenScatterUnit scatter
           
protected  java.util.ArrayList<IToken> tokens
           
 
Constructor Summary
NonBlockingTokenFilter()
           
 
Method Summary
 void add(IToken token)
          processes the token and stores it in its proper place in the pipelane
protected abstract  boolean checkToken(IToken token)
          implement this method to define your filtering criteria
 void clearPipe()
          removes all elements in the pipe
 TokenScatterUnit filters()
          returns unit for filter management
protected  void insert(IToken token)
          the tokens are not organized, new token is added at the end queue
 boolean isFinal()
          checks if the filter is final or just one in a chain
 void markLastToken()
          marks the flag, that the last token has been sent to the filter. this matters if the filter is a blocking filter, which needs all tokens before proceeding (blocking filters can be used for sorting elements).
 int numTokens()
           
 IToken topToken()
          Returns first elemen of the pipe, but only if there are no filters registered to use them. this function works only for final filters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scatter

protected TokenScatterUnit scatter

tokens

protected java.util.ArrayList<IToken> tokens
Constructor Detail

NonBlockingTokenFilter

public NonBlockingTokenFilter()
Method Detail

add

public void add(IToken token)
Description copied from interface: ITokenFilter
processes the token and stores it in its proper place in the pipelane

Specified by:
add in interface ITokenFilter

insert

protected void insert(IToken token)
the tokens are not organized, new token is added at the end queue

Parameters:
token -

checkToken

protected abstract boolean checkToken(IToken token)
implement this method to define your filtering criteria

Parameters:
token - TODO

clearPipe

public void clearPipe()
Description copied from interface: ITokenFilter
removes all elements in the pipe

Specified by:
clearPipe in interface ITokenFilter

filters

public TokenScatterUnit filters()
Description copied from interface: ITokenFilter
returns unit for filter management

Specified by:
filters in interface ITokenFilter
Returns:

isFinal

public boolean isFinal()
Description copied from interface: ITokenFilter
checks if the filter is final or just one in a chain

Specified by:
isFinal in interface ITokenFilter
Returns:

markLastToken

public void markLastToken()
Description copied from interface: ITokenFilter
marks the flag, that the last token has been sent to the filter. this matters if the filter is a blocking filter, which needs all tokens before proceeding (blocking filters can be used for sorting elements).

Specified by:
markLastToken in interface ITokenFilter

numTokens

public int numTokens()
Specified by:
numTokens in interface ITokenFilter

topToken

public IToken topToken()
Description copied from interface: ITokenFilter
Returns first elemen of the pipe, but only if there are no filters registered to use them. this function works only for final filters.

Specified by:
topToken in interface ITokenFilter
Returns:
remove the first element from the pipe and return it