ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.beans.filter
Class AbleFilter

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.beans.filter.AbleFilter
All Implemented Interfaces:
AbleBean, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, java.io.Serializable

public class AbleFilter
extends AbleObject
implements java.io.Serializable

This class provides data translation and scaling functions for Able. It is most useful for neural networks that require numeric data between 0 and 1, or -0.5 and +0.5, or for conversion of string data to other values whether they are string or numeric.

This code performs complicated processing of data. Based on the field input and output data types, the code can be processed in a wide variety of ways.

Up to four internal buffers are used:

  1. TmpInSym - holds symbolic input (and pre processed data)
  2. TmpOutSym - holds symbolic output (and post processed data)
  3. TmpInNum - holds numeric input (and pre processed) data
  4. TmpOutNum - holds numeric output (and post processed) data


             TmpInSym                  TmpOutSym

                             Value
  Input                      Symbol                     Output
  Buffer                                                Buffer

             TmpInNum                  TmpOutNum

 

See Also:
Serialized Form

Field Summary
static int Able_FILT_INVALID_INDEX
           
static int Able_FILT_INVALID_NUMERIC_INPUT_INDEX
           
static int Able_FILT_INVALID_SYMBOLIC_INPUT_INDEX
           
static int Able_FILT_NOTANUMBER
           
static int Able_FILT_OPERATOR_ERROR
           
static int Able_FILT_READ_IO
           
static int Able_FILT_WRITE_IO
           
static int ABS
           
static int ACOS
           
static int ADD
           
static int ADDTOEND
           
protected  java.lang.Object altInputBuffer
          "altInputBuffer" is initialized to null, but can be used by other objects to provide input data to this bean's process() synchronous method via an AbleEvent with "process" as the action string and either a String[] or double[] as the argument Object.
static int ASIN
           
static int ATAN
           
static int[] binCodeOperList
           
static int BITAND
           
static int BITCOMP
           
static int BITOR
           
static int BITXOR
           
static int CEIL
           
static int COS
           
static int COSH
           
static java.lang.String defaultName
           
static int DISCRETIZE
           
static int DIV
           
static int EXP
           
static int EXP10
           
static int FLOOR
           
static int LOG
           
static int LOG10
           
static int LOWCASE
           
static int MAXUV
           
static int MINUV
           
static int MODULO
           
static int NONE
           
static int NORM1
           
static int NORM2
           
static int NORM3
           
static int[] numberOperList
           
static int NUMERIC
           
static int NUMLOGICALTYPES
           
static int NUMOPERATORTYPES
           
static int NUMSTATUSSTRINGS
           
static int NUMUSAGETYPES
           
static int[] oneOfNCodeOperList
           
static int[] oneOfNCodePostOperList
           
static int POW
           
static int POWERN
           
static int ROUND
           
static int SCALE
           
static int SIN
           
static int SINH
           
static int SQRT
           
static int SQUARE
           
static int SYMBOLIC
           
static int[] symbolOperList
           
static int TABLE
           
static int TAN
           
static int TANH
           
static int[] thermCodeOperList
           
static int THRESHOLD
           
static int TRANSLATE
           
static int TRUNC
           
static int[] typeList
           
static int UPCASE
           
static int[] vectorOperList
           
static int XBINCODE
           
static int XDIALOG
           
static int XEDIT
           
static int XIGNORE
           
static int XINBUFPOS
           
static int XINPUT
           
static int XNUMBER
           
static int XONEOFNCODE
           
static int XOUTPUFPOS
           
static int XOUTPUT
           
static int XSYMBOL
           
static int XTHERMCODE
           
static int XVECTOR
           
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AbleFilter()
          Construct a filter object with default name.
AbleFilter(java.lang.String name)
          Construct an AbleFilter object with specified name.
 
Method Summary
 void addTemplateRec(AbleTranslateTemplate template)
          Add a template to the end of the filter.
 void addTemplateRecs(java.util.Vector templates)
          Add a vector of templates to the end of the filter.
static void generateTranslateTemplates(AbleFilter inFilter, AbleFilter outFilter, java.util.Vector fields)
          Populate a filter for converting data to a bean's input specifications, and a filter for converting a bean's output specifications back to the original coordinates.
 java.lang.String getFieldNames()
          Return a list of all of the fields names in the template
 java.lang.String[] getFieldNamesArray()
          Get the list of field names.
 int getNumInFields()
           
 int getNumInUnits()
           
 int getNumNumericInUnits()
           
 int getNumNumericOutUnits()
           
 int getNumOutFields()
           
 int getNumOutUnits()
           
 int getNumSymInUnits()
           
 int getNumSymOutUnits()
           
 java.lang.String[] getStatusInfo()
          Get status line information.
 java.util.Vector getTable()
           
 AbleTranslateTemplate getTemplateRec(int inx)
           
 AbleTranslateTemplate getTemplateRec(java.lang.String name)
          Return the first field with the matching name, or null if no matching field was found.
 int getTotalInUnits()
           
 int getTotalOutUnits()
           
static java.lang.String[] getValidOpers(java.lang.String dataType)
          Get a list of valid operators for a given data type.
 java.lang.String[] getValidTypes(java.lang.String dataType)
          Get a list of valid destination data types for the given source data type.
 java.lang.String getVersion()
           
 void insertTemplateRec(AbleTranslateTemplate template, int index)
          Insert a template record into the filter's Translate Table at the position specified, Insert a template into the filter.
 void process()
          Process a complete record (every field) from input to output buffer.
 java.lang.Object process(java.lang.Object theInputArg)
          Perform the main, standard processing function performed by this bean, using the argument Object (usually passed via an AbleEvent).
 void removeAllTemplateRecs()
          Remove all templates from the filter.
 void removeTemplateRec(int index)
          Remove the template at the position specified from the filter.
 void reset()
          Set processing options to default values.
 java.lang.String[] testTemplate(int index, java.lang.String[] inputString)
          Perform a test translation for a single template field.
 void update()
          Update all field buffer position info in the templates.
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, handleAbleEvent, hasInputBuffer, hasOutputBuffer, init, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, processTimerEvent, quitAll, quitEnabledEventProcessing, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeAll, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setDataFlowEnabled, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendAll, suspendEnabledEventProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultName

public static final java.lang.String defaultName

NUMUSAGETYPES

public static final int NUMUSAGETYPES
See Also:
Constant Field Values

NUMLOGICALTYPES

public static final int NUMLOGICALTYPES
See Also:
Constant Field Values

NUMOPERATORTYPES

public static final int NUMOPERATORTYPES
See Also:
Constant Field Values

NUMSTATUSSTRINGS

public static final int NUMSTATUSSTRINGS
See Also:
Constant Field Values

ADDTOEND

public static final int ADDTOEND
See Also:
Constant Field Values

Able_FILT_OPERATOR_ERROR

public static final int Able_FILT_OPERATOR_ERROR
See Also:
Constant Field Values

Able_FILT_INVALID_INDEX

public static final int Able_FILT_INVALID_INDEX
See Also:
Constant Field Values

Able_FILT_INVALID_SYMBOLIC_INPUT_INDEX

public static final int Able_FILT_INVALID_SYMBOLIC_INPUT_INDEX
See Also:
Constant Field Values

Able_FILT_NOTANUMBER

public static final int Able_FILT_NOTANUMBER
See Also:
Constant Field Values

Able_FILT_INVALID_NUMERIC_INPUT_INDEX

public static final int Able_FILT_INVALID_NUMERIC_INPUT_INDEX
See Also:
Constant Field Values

Able_FILT_READ_IO

public static final int Able_FILT_READ_IO
See Also:
Constant Field Values

Able_FILT_WRITE_IO

public static final int Able_FILT_WRITE_IO
See Also:
Constant Field Values

SYMBOLIC

public static final int SYMBOLIC
See Also:
Constant Field Values

NUMERIC

public static final int NUMERIC
See Also:
Constant Field Values

XINPUT

public static final int XINPUT
See Also:
Constant Field Values

XOUTPUT

public static final int XOUTPUT
See Also:
Constant Field Values

XIGNORE

public static final int XIGNORE
See Also:
Constant Field Values

XEDIT

public static final int XEDIT
See Also:
Constant Field Values

XINBUFPOS

public static final int XINBUFPOS
See Also:
Constant Field Values

XOUTPUFPOS

public static final int XOUTPUFPOS
See Also:
Constant Field Values

XDIALOG

public static final int XDIALOG
See Also:
Constant Field Values

XBINCODE

public static final int XBINCODE
See Also:
Constant Field Values

XNUMBER

public static final int XNUMBER
See Also:
Constant Field Values

XSYMBOL

public static final int XSYMBOL
See Also:
Constant Field Values

XTHERMCODE

public static final int XTHERMCODE
See Also:
Constant Field Values

XONEOFNCODE

public static final int XONEOFNCODE
See Also:
Constant Field Values

XVECTOR

public static final int XVECTOR
See Also:
Constant Field Values

ABS

public static final int ABS
See Also:
Constant Field Values

ACOS

public static final int ACOS
See Also:
Constant Field Values

ASIN

public static final int ASIN
See Also:
Constant Field Values

ATAN

public static final int ATAN
See Also:
Constant Field Values

BITAND

public static final int BITAND
See Also:
Constant Field Values

BITOR

public static final int BITOR
See Also:
Constant Field Values

BITXOR

public static final int BITXOR
See Also:
Constant Field Values

CEIL

public static final int CEIL
See Also:
Constant Field Values

COS

public static final int COS
See Also:
Constant Field Values

COSH

public static final int COSH
See Also:
Constant Field Values

DIV

public static final int DIV
See Also:
Constant Field Values

EXP

public static final int EXP
See Also:
Constant Field Values

EXP10

public static final int EXP10
See Also:
Constant Field Values

FLOOR

public static final int FLOOR
See Also:
Constant Field Values

LOG

public static final int LOG
See Also:
Constant Field Values

LOG10

public static final int LOG10
See Also:
Constant Field Values

LOWCASE

public static final int LOWCASE
See Also:
Constant Field Values

MAXUV

public static final int MAXUV
See Also:
Constant Field Values

MINUV

public static final int MINUV
See Also:
Constant Field Values

MODULO

public static final int MODULO
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

NORM1

public static final int NORM1
See Also:
Constant Field Values

NORM2

public static final int NORM2
See Also:
Constant Field Values

NORM3

public static final int NORM3
See Also:
Constant Field Values

ROUND

public static final int ROUND
See Also:
Constant Field Values

SCALE

public static final int SCALE
See Also:
Constant Field Values

SIN

public static final int SIN
See Also:
Constant Field Values

SINH

public static final int SINH
See Also:
Constant Field Values

SQRT

public static final int SQRT
See Also:
Constant Field Values

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

TABLE

public static final int TABLE
See Also:
Constant Field Values

TAN

public static final int TAN
See Also:
Constant Field Values

TANH

public static final int TANH
See Also:
Constant Field Values

THRESHOLD

public static final int THRESHOLD
See Also:
Constant Field Values

TRANSLATE

public static final int TRANSLATE
See Also:
Constant Field Values

TRUNC

public static final int TRUNC
See Also:
Constant Field Values

UPCASE

public static final int UPCASE
See Also:
Constant Field Values

ADD

public static final int ADD
See Also:
Constant Field Values

DISCRETIZE

public static final int DISCRETIZE
See Also:
Constant Field Values

BITCOMP

public static final int BITCOMP
See Also:
Constant Field Values

POW

public static final int POW
See Also:
Constant Field Values

POWERN

public static final int POWERN
See Also:
Constant Field Values

typeList

public static final int[] typeList

binCodeOperList

public static final int[] binCodeOperList

numberOperList

public static final int[] numberOperList

symbolOperList

public static final int[] symbolOperList

thermCodeOperList

public static final int[] thermCodeOperList

oneOfNCodeOperList

public static final int[] oneOfNCodeOperList

oneOfNCodePostOperList

public static final int[] oneOfNCodePostOperList

vectorOperList

public static final int[] vectorOperList

altInputBuffer

protected java.lang.Object altInputBuffer
"altInputBuffer" is initialized to null, but can be used by other objects to provide input data to this bean's process() synchronous method via an AbleEvent with "process" as the action string and either a String[] or double[] as the argument Object. This is used by the process(Object) method.

Constructor Detail

AbleFilter

public AbleFilter()
           throws AbleException
Construct a filter object with default name.


AbleFilter

public AbleFilter(java.lang.String name)
           throws AbleException
Construct an AbleFilter object with specified name.

Parameters:
name - A String containing the name used to identify this bean.
Method Detail

generateTranslateTemplates

public static void generateTranslateTemplates(AbleFilter inFilter,
                                              AbleFilter outFilter,
                                              java.util.Vector fields)
                                       throws AbleException
Populate a filter for converting data to a bean's input specifications, and a filter for converting a bean's output specifications back to the original coordinates. Translate templates are added to each filter for each field as appropriate for its field usage and datatype.

Parameters:
inFilter - The AbleFilter used to convert incoming data. A null value is not allowed.
outFilter - The AbleFilter used to convert outgoing data. A null value is allowed.
fields - A vector of AbleFields from which to derive the translation template.
Returns:
An array containing two AbleFilter objectshe translation template.
Throws:
AbleException

reset

public void reset()
           throws AbleException
Set processing options to default values. No timer or asynchronous event processing. Dataflow is enabled.

Specified by:
reset in interface AbleBean
Overrides:
reset in class AbleObject
Throws:
AbleException - If an error occurs.
See Also:
AbleBean.reset()

getVersion

public java.lang.String getVersion()

getTotalInUnits

public int getTotalInUnits()

getTotalOutUnits

public int getTotalOutUnits()

getNumInFields

public int getNumInFields()

getNumSymInUnits

public int getNumSymInUnits()

getNumInUnits

public int getNumInUnits()

getNumOutFields

public int getNumOutFields()

getNumSymOutUnits

public int getNumSymOutUnits()

getNumOutUnits

public int getNumOutUnits()

getNumNumericInUnits

public int getNumNumericInUnits()

getNumNumericOutUnits

public int getNumNumericOutUnits()

getTable

public java.util.Vector getTable()

getTemplateRec

public AbleTranslateTemplate getTemplateRec(int inx)

getTemplateRec

public AbleTranslateTemplate getTemplateRec(java.lang.String name)
Return the first field with the matching name, or null if no matching field was found.

Returns:
An AbleTranslateTemplate matching the name specified.

addTemplateRec

public void addTemplateRec(AbleTranslateTemplate template)
Add a template to the end of the filter.

Parameters:
template - The AbleTranslateTemplate template to be added.

addTemplateRecs

public void addTemplateRecs(java.util.Vector templates)
Add a vector of templates to the end of the filter.

Parameters:
templates - A Vector of AbleTranslateTemplates to be added.

Returns:
void.

insertTemplateRec

public void insertTemplateRec(AbleTranslateTemplate template,
                              int index)
Insert a template record into the filter's Translate Table at the position specified, Insert a template into the filter.

Parameters:
template - The AbleTranslateTemplate template to be inserted

index - The position where the template should be inserted

Returns:
void.

removeTemplateRec

public void removeTemplateRec(int index)
Remove the template at the position specified from the filter.

Parameters:
index - The index of the template to remove

removeAllTemplateRecs

public void removeAllTemplateRecs()
Remove all templates from the filter.


getFieldNames

public java.lang.String getFieldNames()
Return a list of all of the fields names in the template

Returns:
A single, space-delimited string of all field names.

getFieldNamesArray

public java.lang.String[] getFieldNamesArray()
Get the list of field names.

Returns:
A String array containing all field names in input order.

getStatusInfo

public java.lang.String[] getStatusInfo()
Get status line information.

Returns:
A 3 element array of information for the status line consisting of field, inputbuffer, and outputbuffer size information.

getValidOpers

public static java.lang.String[] getValidOpers(java.lang.String dataType)
Get a list of valid operators for a given data type.

Parameters:
dataType - The data type

Returns:
A String array of operators for the data type.

getValidTypes

public java.lang.String[] getValidTypes(java.lang.String dataType)
Get a list of valid destination data types for the given source data type.

Parameters:
dataType - The source data type

Returns:
The list of valid destination data types.

process

public void process()
             throws AbleException
Process a complete record (every field) from input to output buffer.

Specified by:
process in interface AbleBean
Overrides:
process in class AbleObject
Throws:
AbleException
See Also:
AbleObject.inputBuffer, AbleObject.outputBuffer, AbleBean.process()

process

public java.lang.Object process(java.lang.Object theInputArg)
                         throws AbleException
Perform the main, standard processing function performed by this bean, using the argument Object (usually passed via an AbleEvent). Typically, this function involves taking data from the argument object, processing the data, and placing the processed data into an AbleEvent.

Specified by:
process in interface AbleBean
Overrides:
process in class AbleObject
Parameters:
theInputArg - An Object used to initialize the bean. Note: AbleFilter only accepts Object[], String[], double[] or Vector as arguments.

Returns:
the results , a clone of the outputBuffer
Throws:
AbleException - In the following situations:
  • the inputBuffer variable is null (usually allocated in the init method)
  • the class of the parameter theArg does not match the class of the inputBuffer variable
  • the length of the parameter theArg array does not match the length of the inputBuffer array
  • the length of the parameter theArg Vector does not match the length of the inputBuffer Vector
  • when the bean has source data connections because the buffers could be overwritten from other threads
  • the outputBuffer variable is null (usually allocated in the init method)
  • the outputBuffer variable is an unsuppported class.
    See Also:
    AbleObject.inputBuffer, AbleObject.outputBuffer, AbleBean.process()

  • testTemplate

    public java.lang.String[] testTemplate(int index,
                                           java.lang.String[] inputString)
    Perform a test translation for a single template field.

    Parameters:
    index - The index of the template to test

    inputString - A string array containing the test input data

    Returns:
    A String array whose contents are the output of the translation.

    update

    public void update()
    Update all field buffer position info in the templates.


    ABLE 2.3.0 07/13/2005 14:21:00

    (C) Copyright IBM Corporation 1999, 2005