|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
net.sourceforge.webcompmath.awt.ExpressionInput
net.sourceforge.webcompmath.awt.beans.WCMExpressionInputBean
public class WCMExpressionInputBean
This class is primarily for use with GUI builders like Eclipse VE. To make it easier to create the most common case (an ExpressionInput represents a function's definition), this class extends ExpressionInput but then decorates it with Function, ParserExtension, and ExpressionCommand features. Hence you can set the function property of a WCMGraph1DBean to this class, since this class implements function. You can also add an instance of this class to a parser, since this class implements ParserExtendion.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sourceforge.webcompmath.awt.ExpressionInput |
|---|
ExpressionInput.EI |
| Nested classes/interfaces inherited from class javax.swing.JTextField |
|---|
javax.swing.JTextField.AccessibleJTextField |
| Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
|---|
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.webcompmath.awt.ExpressionInput |
|---|
errorMessage, expr, hasChanged, parser, throwErrors |
| Fields inherited from class javax.swing.JTextField |
|---|
notifyAction |
| Fields inherited from class javax.swing.text.JTextComponent |
|---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| 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 |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
WCMExpressionInputBean()
Default constructor; create a bean with a default parser, a variable called "x", and uses a default definition of "1" for the function. |
|
| Method Summary | |
|---|---|
void |
appendOutputString(ExpressionProgram prog,
int myIndex,
java.lang.StringBuffer buffer)
Just pass this method on to func |
void |
apply(StackOfDouble stack,
Cases cases)
Just pass this method on to func |
void |
compileDerivative(ExpressionProgram prog,
int myIndex,
ExpressionProgram deriv,
Variable wrt)
Just pass this method on to func |
boolean |
dependsOn(Variable x)
Just pass this method on to func |
Function |
derivative(int wrt)
Just pass this method on to func |
Function |
derivative(Variable x)
Just pass this method on to func |
void |
doParse(Parser p,
ParserContext context)
Just pass this method on to func |
int |
extent(ExpressionProgram prog,
int myIndex)
Just pass this method on to func |
int |
getArity()
Pass this through to func. |
Function |
getFunction()
Just pass this method on to func |
MathObject |
getMathObject()
Since this is a ParserExtension, just returns itself. |
java.lang.String |
getName()
Just pass this method on to func |
int |
getNumVariables()
Just pass this method on to func |
double |
getVal(double[] arguments)
Just pass this method on to func |
double |
getValueWithCases(double[] arguments,
Cases cases)
Just pass this method on to func |
double |
getValWithCases(Cases cases)
Get the value, when used as just an expression, but with cases. |
Variable |
getVariable()
Get the variable to be used when this class is treaded as a function of one variable |
Variable |
getVariable2()
Get the variable to be used when this class is treaded as a function of one variable |
void |
setName(java.lang.String name)
Pass this on to func. |
void |
setNumVariables(int a)
Set the arity, which can be either 1 or 2. |
void |
setParensCanBeOptional(boolean b)
Set this property true if this is a function of one variable and you want it to behave like a standard function in that parentheses can be optional around the argument of the function. |
void |
setVariable(Variable v)
Set the variable to be used when this class is treated as a function of one variable. |
void |
setVariable2(Variable v)
Set the variable to be used when this class is treated as a function of one variable. |
| Methods inherited from class net.sourceforge.webcompmath.awt.ExpressionInput |
|---|
actionPerformed, changedUpdate, checkInput, forceCheckInput, getErrorMessage, getExpression, getFunction, getFunction, getOnTextChange, getOnUserAction, getParser, getThrowErrors, getVal, insertUpdate, notifyControllerOnChange, removeUpdate, setOnTextChange, setOnUserAction, setParser, setText, setThrowErrors, toString |
| Methods inherited from class javax.swing.JTextField |
|---|
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset |
| Methods inherited from class javax.swing.text.JTextComponent |
|---|
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sourceforge.webcompmath.data.beans.ParserMathObject |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Constructor Detail |
|---|
public WCMExpressionInputBean()
| Method Detail |
|---|
public void setVariable(Variable v)
v - public Variable getVariable()
public void setVariable2(Variable v)
v - public Variable getVariable2()
public int getArity()
getArity in interface Functionpublic int getNumVariables()
Function.getArity()public void setNumVariables(int a)
a - either 1 or 2public double getValWithCases(Cases cases)
cases - the cases
public double getVal(double[] arguments)
getVal in interface Functionarguments - array of argument values
Function.getVal(double[])
public double getValueWithCases(double[] arguments,
Cases cases)
getValueWithCases in interface Functionarguments - array of argument valuescases - the cases to use
Function.getValueWithCases(double[],
net.sourceforge.webcompmath.data.Cases)public Function derivative(int wrt)
derivative in interface Functionwrt - argument Number with respect to
Function.derivative(int)public Function derivative(Variable x)
derivative in interface Functionx - variable with respect to
Function.derivative(net.sourceforge.webcompmath.data.Variable)public boolean dependsOn(Variable x)
dependsOn in interface ExpressionCommanddependsOn in interface Functionx - variable to check
Function.dependsOn(net.sourceforge.webcompmath.data.Variable)
public void doParse(Parser p,
ParserContext context)
doParse in interface ParserExtensionp - parser to usecontext - parser context to useParserExtension.doParse(net.sourceforge.webcompmath.data.Parser,
net.sourceforge.webcompmath.data.ParserContext)
public void apply(StackOfDouble stack,
Cases cases)
apply in interface ExpressionCommandstack - contains results of previous commands in the program.cases - if non-null, any case information generated during evaluation
should be recorded here.ExpressionCommand.apply(net.sourceforge.webcompmath.data.StackOfDouble,
net.sourceforge.webcompmath.data.Cases)
public void compileDerivative(ExpressionProgram prog,
int myIndex,
ExpressionProgram deriv,
Variable wrt)
compileDerivative in interface ExpressionCommandprog - program in which ExpressionCommand occurs.myIndex - point at which ExpressionCommand occurs in the
ExpressionProgram.deriv - the derivative of the ExpressionPorgram prog, which is in the
process of being computed. Commands should added to deriv that
will compute the derivative of this ExpressionCommand.wrt - commands are added to deriv with respect to this Variable.ExpressionCommand.compileDerivative(net.sourceforge.webcompmath.data.ExpressionProgram,
int, net.sourceforge.webcompmath.data.ExpressionProgram,
net.sourceforge.webcompmath.data.Variable)
public int extent(ExpressionProgram prog,
int myIndex)
extent in interface ExpressionCommandprog - ExpressionProgram in which this ExpressionCommand occurs.myIndex - index at which ExpressionCommand occurs in prog.
ExpressionCommand.extent(net.sourceforge.webcompmath.data.ExpressionProgram,
int)
public void appendOutputString(ExpressionProgram prog,
int myIndex,
java.lang.StringBuffer buffer)
appendOutputString in interface ExpressionCommandprog - program containing the expressionmyIndex - location of the expressionbuffer - string to appendExpressionCommand.appendOutputString(net.sourceforge.webcompmath.data.ExpressionProgram,
int, java.lang.StringBuffer)public MathObject getMathObject()
getMathObject in interface ParserMathObjectParserMathObject.getMathObject()public Function getFunction()
WrapperFunction.getFunction()public java.lang.String getName()
getName in interface MathObjectgetName in class java.awt.ComponentFunctionParserExtension.getName()public void setName(java.lang.String name)
setName in interface MathObjectsetName in class java.awt.Componentname - the new nameFunctionParserExtension.setName(java.lang.String)public void setParensCanBeOptional(boolean b)
b - true or falseFunctionParserExtension.setParensCanBeOptional(boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||