cox.jmatt.java.MathTools.demo
Class MathEnginePizza

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by cox.jmatt.java.MathTools.demo.PizzaPanel
                  extended by cox.jmatt.java.MathTools.demo.MathEnginePizza
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class MathEnginePizza
extends PizzaPanel

This PizzaPanel demonstrates MathEngine methods. The parameter types are specified on the Choice component and the indicated method is called by clicking the [Go!] button.

The demonstrations in this panel are:

  1. Generate int.0 calls to random() and print them. A 'high-low' count is kept and printed: low is below 0.5, high is greater or equal. If greater than zero, double.1 and double.2 are used to set adjustRandom(). CAUTION: This does stay in effect until specifically unset!
  2. Generate int.0 random numbers between int.1 (inclusive) and int.2 (exclusive). If boolean.3 is true, the method used is MathEngine.nzRandom() otherwise, MathEngine.random() is called.
  3. Enter a Knobs string into String.0: An even number of numbers separated by spaces. MathEngine.setKnobs() is then called on this and the results printed.
  4. This demo splick()'s String.0 by the character entered in String.1. If String.1 is blank, a space is used. Once the entries are split, a random one is picked.
  5. String.0 and String.1 are each split on spaces, a random element is chosen, and it is converted to an int. The results from splickInt()-ing String.0 and String.1 are then added and printed.
  6. String.0 is fed into MathEngine.parseRPN() as a postfix-formatted calculation String. This is the actual method behind QuickRPNCalculator.
  7. Create and fill an expression. See MathEngine.createExpression() for details.
  8. Read a block of 'par' lines and print them. The block starts at 'par.0' and stops at the first blank parameter line. First the lines are printed then they are read into a single String and printed. Finally, a random line is chosen (blick()).
  9. The isoKnobs() method is called on String.0 and then on the resultint String five times and the output printed.
  10. Splint String.0 and arCat() it back together. boolean.1 determines 'and', and boolean.2 determines whether or not to number-word them.
  11. Split String.0 on spaces and use the String arCat() to concatenate it. String.1 is the separator, String.2 is the last separator and Boolean.3 is descending/ascending.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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 java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MathEnginePizza()
           
 
Method Summary
 java.awt.Panel getNorthPanel()
          Retrieve the component to be displayed in the NORTH part of the Panel.
 void processGoButton()
          This is where things get interesting.
 
Methods inherited from class cox.jmatt.java.MathTools.demo.PizzaPanel
_addToPizza, actionPerformed, asBoolean, asDouble, asInt, asLong, asNullString, asString, clearParams, eatPizza, getRawPizza, resetParams, resetParams
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MathEnginePizza

public MathEnginePizza()
Method Detail

getNorthPanel

public java.awt.Panel getNorthPanel()
Description copied from class: PizzaPanel
Retrieve the component to be displayed in the NORTH part of the Panel. Defaults to a title Label.

Overrides:
getNorthPanel in class PizzaPanel

processGoButton

public void processGoButton()

This is where things get interesting. Selecting an option and clicking the button triggers a call to the selected method. The parameter index and type are specified as L.0, i.0, d.0, s.0 and b.0 for long, int, double, string and boolean respectively. The number indicates the parameter that must be of that particular type. The delimiter is '<>'.

Overrides:
processGoButton in class PizzaPanel