ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.beans.filter
Class AbleFilter

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.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, 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 tempRec)
          Add a template to the end of the filter.
 void addTemplateRecs(java.util.Vector tempRecs)
          Add a vector of templates to the end of the filter.
static java.lang.String Copyright()
          Determine the copyright of this class.
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 tempRec, 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, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, 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, 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, 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

NUMLOGICALTYPES

public static final int NUMLOGICALTYPES

NUMOPERATORTYPES

public static final int NUMOPERATORTYPES

NUMSTATUSSTRINGS

public static final int NUMSTATUSSTRINGS

ADDTOEND

public static final int ADDTOEND

Able_FILT_OPERATOR_ERROR

public static final int Able_FILT_OPERATOR_ERROR

Able_FILT_INVALID_INDEX

public static final int Able_FILT_INVALID_INDEX

Able_FILT_INVALID_SYMBOLIC_INPUT_INDEX

public static final int Able_FILT_INVALID_SYMBOLIC_INPUT_INDEX

Able_FILT_NOTANUMBER

public static final int Able_FILT_NOTANUMBER

Able_FILT_INVALID_NUMERIC_INPUT_INDEX

public static final int Able_FILT_INVALID_NUMERIC_INPUT_INDEX

Able_FILT_READ_IO

public static final int Able_FILT_READ_IO

Able_FILT_WRITE_IO

public static final int Able_FILT_WRITE_IO

SYMBOLIC

public static final int SYMBOLIC

NUMERIC

public static final int NUMERIC

XINPUT

public static final int XINPUT

XOUTPUT

public static final int XOUTPUT

XIGNORE

public static final int XIGNORE

XEDIT

public static final int XEDIT

XINBUFPOS

public static final int XINBUFPOS

XOUTPUFPOS

public static final int XOUTPUFPOS

XDIALOG

public static final int XDIALOG

XBINCODE

public static final int XBINCODE

XNUMBER

public static final int XNUMBER

XSYMBOL

public static final int XSYMBOL

XTHERMCODE

public static final int XTHERMCODE

XONEOFNCODE

public static final int XONEOFNCODE

XVECTOR

public static final int XVECTOR

ABS

public static final int ABS

ACOS

public static final int ACOS

ASIN

public static final int ASIN

ATAN

public static final int ATAN

BITAND

public static final int BITAND

BITOR

public static final int BITOR

BITXOR

public static final int BITXOR

CEIL

public static final int CEIL

COS

public static final int COS

COSH

public static final int COSH

DIV

public static final int DIV

EXP

public static final int EXP

EXP10

public static final int EXP10

FLOOR

public static final int FLOOR

LOG

public static final int LOG

LOG10

public static final int LOG10

LOWCASE

public static final int LOWCASE

MAXUV

public static final int MAXUV

MINUV

public static final int MINUV

MODULO

public static final int MODULO

NONE

public static final int NONE

NORM1

public static final int NORM1

NORM2

public static final int NORM2

NORM3

public static final int NORM3

ROUND

public static final int ROUND

SCALE

public static final int SCALE

SIN

public static final int SIN

SINH

public static final int SINH

SQRT

public static final int SQRT

SQUARE

public static final int SQUARE

TABLE

public static final int TABLE

TAN

public static final int TAN

TANH

public static final int TANH

THRESHOLD

public static final int THRESHOLD

TRANSLATE

public static final int TRANSLATE

TRUNC

public static final int TRUNC

UPCASE

public static final int UPCASE

ADD

public static final int ADD

DISCRETIZE

public static final int DISCRETIZE

BITCOMP

public static final int BITCOMP

POW

public static final int POW

POWERN

public static final int POWERN

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.

reset

public void reset()
           throws AbleException
Set processing options to default values. No timer or asynchronous event processing. Dataflow is enabled.
Overrides:
reset in class AbleObject
Following copied from class: com.ibm.able.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 tempRec)
Add a template to the end of the filter.
Parameters:
template - The AbleTranslateTemplate template to be added.

addTemplateRecs

public void addTemplateRecs(java.util.Vector tempRecs)
Add a vector of templates to the end of the filter.
Parameters:
template - A Vector of AbleTranslateTemplates to be added.

Returns:
void.

insertTemplateRec

public void insertTemplateRec(AbleTranslateTemplate tempRec,
                              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.
Overrides:
process in class AbleObject
Following copied from class: com.ibm.able.AbleObject
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.
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

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.

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.


ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003