@KFStep(category="Flow", toolTipText="Inner join on one or more key fields") public class Join extends javax.swing.JPanel implements BeanCommon, Visible, java.io.Serializable, DataSource, DataSourceListener, TrainingSetListener, TestSetListener, InstanceListener, EventConstraints, StructureProducer, EnvironmentHandler
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Join.InstanceHolder
Small helper class for holding an instance and the values of any string
attributes it might have.
|
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
KEY_SPEC_SEPARATOR
Separator used to separate first and second input key specifications
|
protected boolean |
m_busy
True if we are busy
|
protected java.util.concurrent.atomic.AtomicInteger |
m_count
Used to cycle over the headers in the header pool
|
protected java.util.ArrayList<DataSourceListener> |
m_dataListeners
Downstream steps listening to batch data events
|
protected Environment |
m_env
Environment variables
|
protected java.util.Queue<Join.InstanceHolder> |
m_firstBuffer
Buffer for the first input (capped at 100 for incremental)
|
protected boolean |
m_firstFinished
Whether the first is finished (incremental mode)
|
protected java.lang.Object |
m_firstInput
The first source of data
|
protected java.lang.String |
m_firstInputConnectionType
Connection type of the first input
|
protected boolean |
m_firstIsWaiting
True if the first input stream is waiting due to a full buffer (incremental
mode only)
|
protected Instances |
m_headerOne
The structure of the first incoming dataset
|
protected java.util.List<Instances> |
m_headerPool
A set of copied outgoing structure instances.
|
protected Instances |
m_headerTwo
The structure of the second incoming dataset
|
protected InstanceEvent |
m_ie
Instance event to use for incremental mode
|
protected boolean |
m_incomingBatchConnections
Upstream components sending us data
|
protected java.util.ArrayList<InstanceListener> |
m_instanceListeners
Downstream steps listening to instance events
|
protected int[] |
m_keyIndexesOne
Indexes of the key fields for the first input
|
protected int[] |
m_keyIndexesTwo
Indexes of the key fields for the second input
|
protected java.lang.String |
m_keySpec
Holds the internal representation of the key specification
|
protected Logger |
m_log
Logging
|
protected Instances |
m_mergedHeader
The structure of the outgoing dataset
|
protected boolean |
m_runningIncrementally
True if the step is running incrementally
|
protected java.util.Queue<Join.InstanceHolder> |
m_secondBuffer
Buffer for the second input (capped at 100 for incremental)
|
protected boolean |
m_secondFinished
Whether the second is finished (incremental mode)
|
protected java.lang.Object |
m_secondInput
The second source of data
|
protected java.lang.String |
m_secondInputConnectionType
Connection type of the second input
|
protected boolean |
m_secondIsWaiting
True if the second input stream is waiting due to a full buffer
(incremental mode only)
|
protected java.util.concurrent.atomic.AtomicBoolean |
m_stopRequested
True if the step has been told to stop processing
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
m_stringAttIndexesOne
Holds indexes of string attributes, keyed by attribute name
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
m_stringAttIndexesTwo
Holds indexes of string attributes, keyed by attribute name
|
protected boolean |
m_stringAttsPresent
True if string attributes are present in the incoming data
|
protected StreamThroughput |
m_throughput
Used for computing streaming throughput stats
|
protected BeanVisual |
m_visual
Default visual for data sources
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
Join()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptDataSet(DataSetEvent e)
Accept and process a data set
|
void |
acceptInstance(InstanceEvent e)
Accept and process an instance event
|
void |
acceptTestSet(TestSetEvent e)
Accept and process a test set
|
void |
acceptTrainingSet(TrainingSetEvent e)
Accept and process a training set
|
void |
addDataSourceListener(DataSourceListener dsl)
Add a data source listener
|
void |
addInstanceListener(InstanceListener dsl)
Add an instance listener
|
protected void |
addToFirstBuffer(Instance inst)
Adds an instance to the first input's buffer
|
protected void |
addToSecondBuffer(Instance inst)
Adds an instance to the second input's buffer
|
protected void |
clearBuffers()
Clear remaining instances in the buffers
|
protected int |
compare(Instance one,
Instance two,
Join.InstanceHolder oneH,
Join.InstanceHolder twoH)
Compares two instances according to the keys
|
boolean |
connectionAllowed(java.beans.EventSetDescriptor esd)
Returns true if the named connection can be made at this time
|
boolean |
connectionAllowed(java.lang.String eventName)
Returns true if the named connection can be made at this time
|
void |
connectionNotification(java.lang.String eventName,
java.lang.Object source)
Deals with a new connection
|
void |
disconnectionNotification(java.lang.String eventName,
java.lang.Object source)
Handles cleanup when an upstream step disconnects
|
boolean |
eventGeneratable(java.lang.String eventName)
Returns true if, at the current time, the named event could be
generated.
|
protected void |
generateMergedHeader()
Generate the header of the output instance structure
|
protected Instance |
generateMergedInstance(Join.InstanceHolder one,
Join.InstanceHolder two)
Generate a merged instance from two input instances that match on the key
fields
|
java.lang.String |
getCustomName()
Get the custom name of this step
|
protected java.lang.Object |
getFirstInput()
Get the first input step
|
protected Instances |
getFirstInputStructure()
Get the first input structure
|
java.lang.String |
getKeySpec()
Get the key specification (in internal format -
k11,k12,...
|
protected java.lang.Object |
getSecondInput()
Get the second input step
|
protected Instances |
getSecondInputStructure()
Get the second input structure
|
Instances |
getStructure(java.lang.String eventName)
Get the output instances structure given an input event type
|
protected Instances |
getUpstreamStructureFirst()
Get the incoming instance structure from the first upstream step (if
possible)
|
protected Instances |
getUpstreamStructureSecond()
Get the incoming instance structure from the second upstream step (if
possible)
|
BeanVisual |
getVisual()
Get the visual for this step
|
java.lang.String |
globalInfo()
Global info for the method
|
boolean |
isBusy()
Returns true if we are doing something
|
protected Instance |
processBuffers()
Process the current state of the two buffers.
|
void |
removeDataSourceListener(DataSourceListener dsl)
Remove a data souce listener
|
void |
removeInstanceListener(InstanceListener dsl)
Remove an instance listener
|
void |
setCustomName(java.lang.String name)
Set a custom name for this step
|
void |
setEnvironment(Environment env)
Set environment variables to use
|
void |
setKeySpec(java.lang.String ks)
Set the key specification (in internal format -
k11,k12,...
|
void |
setLog(Logger logger)
Set a log to use
|
void |
setVisual(BeanVisual newVisual)
Set the visual for this step
|
void |
stop()
Attempt to stop processing
|
void |
useDefaultVisual()
Use the default visual for this step
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected static final java.lang.String KEY_SPEC_SEPARATOR
protected transient Logger m_log
protected transient Environment m_env
protected boolean m_incomingBatchConnections
protected java.lang.Object m_firstInput
protected java.lang.Object m_secondInput
protected transient boolean m_firstFinished
protected transient boolean m_secondFinished
protected java.lang.String m_firstInputConnectionType
protected java.lang.String m_secondInputConnectionType
protected transient java.util.Queue<Join.InstanceHolder> m_firstBuffer
protected transient java.util.Queue<Join.InstanceHolder> m_secondBuffer
protected InstanceEvent m_ie
protected transient Instances m_headerOne
protected transient Instances m_headerTwo
protected transient Instances m_mergedHeader
protected transient java.util.List<Instances> m_headerPool
protected transient java.util.concurrent.atomic.AtomicInteger m_count
protected boolean m_stringAttsPresent
protected boolean m_runningIncrementally
protected int[] m_keyIndexesOne
protected int[] m_keyIndexesTwo
protected java.lang.String m_keySpec
protected boolean m_busy
protected java.util.concurrent.atomic.AtomicBoolean m_stopRequested
protected java.util.Map<java.lang.String,java.lang.Integer> m_stringAttIndexesOne
protected java.util.Map<java.lang.String,java.lang.Integer> m_stringAttIndexesTwo
protected boolean m_firstIsWaiting
protected boolean m_secondIsWaiting
protected BeanVisual m_visual
protected java.util.ArrayList<DataSourceListener> m_dataListeners
protected java.util.ArrayList<InstanceListener> m_instanceListeners
protected transient StreamThroughput m_throughput
public java.lang.String globalInfo()
public void setKeySpec(java.lang.String ks)
ks - the keys specificationpublic java.lang.String getKeySpec()
public boolean eventGeneratable(java.lang.String eventName)
EventConstraintseventGeneratable in interface EventConstraintseventName - the name of the event in questionprotected void generateMergedHeader()
protected Instance generateMergedInstance(Join.InstanceHolder one, Join.InstanceHolder two)
one - the first input instancetwo - the second input instancepublic void acceptInstance(InstanceEvent e)
InstanceListeneracceptInstance in interface InstanceListenere - an InstanceEvent valueprotected void addToFirstBuffer(Instance inst)
inst - the instance to addprotected void addToSecondBuffer(Instance inst)
inst - the instance to addprotected void clearBuffers()
protected Instance processBuffers()
protected int compare(Instance one, Instance two, Join.InstanceHolder oneH, Join.InstanceHolder twoH)
one - the first instancetwo - the second instanceoneH - the first instance holder (in case string attributes are
present and we are running incrementally)twoH - the second instance holderpublic void acceptTestSet(TestSetEvent e)
acceptTestSet in interface TestSetListenere - the test set event encapsulating the test setpublic void acceptTrainingSet(TrainingSetEvent e)
acceptTrainingSet in interface TrainingSetListenere - the training set event encapsulating the training setpublic void acceptDataSet(DataSetEvent e)
acceptDataSet in interface DataSourceListenere - the data set event encapsulating the data setpublic void addDataSourceListener(DataSourceListener dsl)
addDataSourceListener in interface DataSourcedsl - the data source listener to addpublic void removeDataSourceListener(DataSourceListener dsl)
removeDataSourceListener in interface DataSourcedsl - the data source listener to removepublic void addInstanceListener(InstanceListener dsl)
addInstanceListener in interface DataSourcedsl - the instance listener to addpublic void removeInstanceListener(InstanceListener dsl)
removeInstanceListener in interface DataSourcedsl - the instance listener to removepublic void useDefaultVisual()
useDefaultVisual in interface Visiblepublic void setVisual(BeanVisual newVisual)
public BeanVisual getVisual()
public void setCustomName(java.lang.String name)
setCustomName in interface BeanCommonname - the custom name to usepublic java.lang.String getCustomName()
getCustomName in interface BeanCommonpublic void stop()
stop in interface BeanCommonpublic boolean isBusy()
isBusy in interface BeanCommonpublic void setLog(Logger logger)
setLog in interface BeanCommonlogger - the log to usepublic boolean connectionAllowed(java.beans.EventSetDescriptor esd)
connectionAllowed in interface BeanCommonesd - the event set descriptor of the connectionpublic boolean connectionAllowed(java.lang.String eventName)
connectionAllowed in interface BeanCommoneventName - the name of the connectionpublic void connectionNotification(java.lang.String eventName,
java.lang.Object source)
connectionNotification in interface BeanCommoneventName - the event type of the connectionsource - the source steppublic void disconnectionNotification(java.lang.String eventName,
java.lang.Object source)
disconnectionNotification in interface BeanCommoneventName - the event type of the connectionsource - the source stepprotected Instances getUpstreamStructureFirst()
protected Instances getUpstreamStructureSecond()
protected java.lang.Object getFirstInput()
protected Instances getFirstInputStructure()
protected java.lang.Object getSecondInput()
protected Instances getSecondInputStructure()
public Instances getStructure(java.lang.String eventName)
getStructure in interface StructureProducereventName - the name of the input event typepublic void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - the environment variables to use