Class Word

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JButton
                                |
                                +--Word
Direct Known Subclasses:
NullWord, SourceWord, TargetWord

public class Word
extends javax.swing.JButton

A Word, displayed on the screen as a clickable text token.

Author:
Noah A. Smith
See Also:
JButton, Serialized Form

Inner classes inherited from class javax.swing.JButton
javax.swing.JButton.AccessibleJButton
 
Inner classes inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static SPTableModel emptyDistTM
          An empty fertility table.
static SPTableModel emptyFertTM
           
static SPTableModel emptyTransTM
          An empty distortion table.
protected  int index
           
protected  java.util.Vector links
           
protected  SPTableModel translations
           
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Word()
          Creates a degenerate word.
Word(java.lang.String text, int i, Web web)
          Instantiate word 'text' in position 'i' of the sentence, with Web web.
 
Method Summary
 void addLink(Link l)
          Add a Link to the Word's list of things it is linked to.
 java.lang.String getBareWord()
          Return the Word's text (the token) as a String.
 SPTableModel getDistortions()
          Return this Word's distortion table information.
 SPTableModel getFertilities()
          Return this Word's fertility table information.
 SPTableModel getTranslations()
          Return this Word's translation table information.
 int getX()
          Return the x coordinate of the Word.
 int getY()
          Return the y coordinate of the Word.
 int index()
          Return the location in the sentence of this word.
 boolean isHuman()
          Tell whether this is a HumanWord (i.e., from a reference translation).
 boolean isNull()
          Tell whether this is the NullWord.
 boolean isSource()
          Tell whether this is a SourceWord.
 boolean isTarget()
          Tell whether this is a TargetWord.
 void readTranslation(java.io.StreamTokenizer st, Sentence translationSent, boolean corr)
          Read in a translation, up to and including a newline character.
 java.lang.String toString()
          Convert the Word to a printable String.
 void updateColors()
          Update the colors of the Word's translation tables.
protected  void updateTranslationColors()
          Update the colors of the items in the translation table so that they reflect the alignments to which they belong.
 
Methods inherited from class javax.swing.JButton
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, setDefaultCapable, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected int index

translations

protected SPTableModel translations

links

protected java.util.Vector links

emptyFertTM

public static SPTableModel emptyFertTM

emptyDistTM

public static SPTableModel emptyDistTM
An empty fertility table.

emptyTransTM

public static SPTableModel emptyTransTM
An empty distortion table.
Constructor Detail

Word

public Word()
Creates a degenerate word.

Word

public Word(java.lang.String text,
            int i,
            Web web)
Instantiate word 'text' in position 'i' of the sentence, with Web web.
Method Detail

getX

public int getX()
Return the x coordinate of the Word.
Overrides:
getX in class javax.swing.JComponent

getY

public int getY()
Return the y coordinate of the Word.
Overrides:
getY in class javax.swing.JComponent

isSource

public boolean isSource()
Tell whether this is a SourceWord.

isTarget

public boolean isTarget()
Tell whether this is a TargetWord.

isHuman

public boolean isHuman()
Tell whether this is a HumanWord (i.e., from a reference translation).

isNull

public boolean isNull()
Tell whether this is the NullWord.

index

public int index()
Return the location in the sentence of this word.

readTranslation

public void readTranslation(java.io.StreamTokenizer st,
                            Sentence translationSent,
                            boolean corr)
                     throws FormatException
Read in a translation, up to and including a newline character.

getTranslations

public SPTableModel getTranslations()
Return this Word's translation table information.

getFertilities

public SPTableModel getFertilities()
Return this Word's fertility table information.

getDistortions

public SPTableModel getDistortions()
Return this Word's distortion table information.

toString

public java.lang.String toString()
Convert the Word to a printable String.
Overrides:
toString in class java.awt.Component

getBareWord

public java.lang.String getBareWord()
Return the Word's text (the token) as a String.

addLink

public void addLink(Link l)
Add a Link to the Word's list of things it is linked to.

updateColors

public void updateColors()
Update the colors of the Word's translation tables.

updateTranslationColors

protected void updateTranslationColors()
Update the colors of the items in the translation table so that they reflect the alignments to which they belong.