godel
Class godel1

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by godel.godel1
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class godel1
extends java.applet.Applet
implements java.awt.event.KeyListener, java.awt.event.ActionListener

This is an applet to implement a Gödel numbering scheme. It translates between formal arithmetic statements and positive integers. For further information see Gödel numbering applet

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
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
(package private)  javax.swing.JCheckBox binar
          check if Godel numbers are to be in binary
(package private)  javax.swing.plaf.basic.BasicArrowButton but1
          Press to convert from Gödel numbers to arithmetic formulae
(package private)  javax.swing.plaf.basic.BasicArrowButton but2
          Press to convert from arithmetic formulae to Gödel numbers
(package private)  java.awt.Font cf1
           
(package private)  boolean endflg
          Set when end of input number reached
(package private)  java.math.BigInteger FOUR
           
(package private)  boolean html
          Output text as HTML
(package private)  java.lang.Error InvInp
          Thrown if text input is not valid
(package private)  javax.swing.JTextArea numed
          Text Area for Godel Numbers
(package private)  java.math.BigInteger numin
          Value of (Gödel) number entered.
(package private)  javax.swing.JCheckBox ohtml
          Check to generate output in the form of HTML (doesn't work for input)
(package private)  int pos
          Current position in text
(package private)  int radx
          radix - swapped between 10 and 2
private static long serialVersionUID
           
(package private)  int spct
          counter which is used to put regular nbsp's into html, to help with wrapping
(package private)  java.lang.String strin
           
(package private)  java.math.BigInteger THREE
           
(package private)  javax.swing.JCheckBox twrap
          Check to wrap number rather than having multiple numbers
(package private)  javax.swing.JTextArea txta
          Text Area for aritmetic formulae
 
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
godel1()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          react to up and down buttons, and binary and text-wrap checkbox changes
(package private)  java.math.BigInteger binop(java.math.BigInteger x1, int op, java.math.BigInteger x2)
          Applies a binary operator to a pair of terms or formulae.
(package private)  boolean chkch(char c)
          checks whether current character matches a given one
(package private)  void chkchv(char c)
          requires current character to match a given one
(package private)  int get2()
          Get 2 bits of input bitstream
 java.lang.String getAppletInfo()
           
(package private)  java.lang.String getvar()
          Get variable from input bitstream
(package private)  java.math.BigInteger getvarn(char c)
          Translates a text variable into a bitstream form
 void init()
          Set up applet
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
          replace alt_A with ∀ and > with ⇒
(package private)  char nxtch()
          Gets next character from text
(package private)  java.math.BigInteger parse1()
          Main routine for parsing strin Handles ⇒ ⇒ is right associative A⇒B⇒C means A⇒(B⇒C)
(package private)  java.math.BigInteger parse2()
          Handles ∀,¬ and equality
(package private)  java.math.BigInteger parse3()
          HAndles addition
(package private)  java.math.BigInteger parse4()
          Handles multiplication
(package private)  java.math.BigInteger parse5()
          Handles successor operator
(package private)  java.math.BigInteger parse6()
          Handles lowest level items in expression zero, variables and (expression)
(package private)  java.lang.String term(int p)
          Get term from input bitstream
(package private)  java.math.BigInteger unop(int op, java.math.BigInteger x1)
          Applies a unary operator to a term or formula.
(package private)  java.lang.String wff()
          Get formula from input bitstream
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
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, 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, 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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

cf1

java.awt.Font cf1

txta

javax.swing.JTextArea txta
Text Area for aritmetic formulae


numed

javax.swing.JTextArea numed
Text Area for Godel Numbers


strin

java.lang.String strin

pos

int pos
Current position in text


numin

java.math.BigInteger numin
Value of (Gödel) number entered. This is the input bitstream


endflg

boolean endflg
Set when end of input number reached


html

boolean html
Output text as HTML


but1

javax.swing.plaf.basic.BasicArrowButton but1
Press to convert from Gödel numbers to arithmetic formulae


but2

javax.swing.plaf.basic.BasicArrowButton but2
Press to convert from arithmetic formulae to Gödel numbers


THREE

final java.math.BigInteger THREE

FOUR

final java.math.BigInteger FOUR

InvInp

java.lang.Error InvInp
Thrown if text input is not valid


binar

javax.swing.JCheckBox binar
check if Godel numbers are to be in binary


twrap

javax.swing.JCheckBox twrap
Check to wrap number rather than having multiple numbers


ohtml

javax.swing.JCheckBox ohtml
Check to generate output in the form of HTML (doesn't work for input)


radx

int radx
radix - swapped between 10 and 2


spct

int spct
counter which is used to put regular nbsp's into html, to help with wrapping

Constructor Detail

godel1

public godel1()
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
replace alt_A with ∀ and > with ⇒

Specified by:
keyTyped in interface java.awt.event.KeyListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
react to up and down buttons, and binary and text-wrap checkbox changes

Specified by:
actionPerformed in interface java.awt.event.ActionListener

init

public void init()
Set up applet

Overrides:
init in class java.applet.Applet

get2

int get2()
Get 2 bits of input bitstream


getvar

java.lang.String getvar()
Get variable from input bitstream

Returns:
variable in text form

term

java.lang.String term(int p)
Get term from input bitstream

Returns:
term in text form

wff

java.lang.String wff()
Get formula from input bitstream

Returns:
formula in text form

nxtch

char nxtch()
Gets next character from text


chkch

boolean chkch(char c)
checks whether current character matches a given one

Parameters:
c - the character to match
Returns:
true for a match

chkchv

void chkchv(char c)
requires current character to match a given one

Parameters:
c - the character to match

getvarn

java.math.BigInteger getvarn(char c)
Translates a text variable into a bitstream form

Parameters:
c - - the initial letter of the variable
Returns:
bitstream form of variable

unop

java.math.BigInteger unop(int op,
                          java.math.BigInteger x1)
Applies a unary operator to a term or formula. Also used for operator part of binary operators.

Parameters:
op - code for operator ' 5,¬ 1
x1 - code for input term or formula
Returns:
code for resulting term or formula

binop

java.math.BigInteger binop(java.math.BigInteger x1,
                           int op,
                           java.math.BigInteger x2)
Applies a binary operator to a pair of terms or formulae.

Parameters:
x1 - first term or formula
op - code for binary operator
x2 - second term or formula
Returns:
code for resulting term or formula

parse6

java.math.BigInteger parse6()
Handles lowest level items in expression zero, variables and (expression)

Returns:
code for item.

parse5

java.math.BigInteger parse5()
Handles successor operator

Returns:
code for term

parse4

java.math.BigInteger parse4()
Handles multiplication

Returns:
code for term

parse3

java.math.BigInteger parse3()
HAndles addition

Returns:
code for term

parse2

java.math.BigInteger parse2()
Handles ∀,¬ and equality

Returns:
code for formula

parse1

java.math.BigInteger parse1()
Main routine for parsing strin Handles ⇒ ⇒ is right associative A⇒B⇒C means A⇒(B⇒C)

Returns:
code for formula

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet