faraday
Class Faraday

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byedu.davidson.tools.SApplet
                      extended byfaraday.Faraday
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, edu.davidson.tools.SStepable

public class Faraday
extends SApplet
implements edu.davidson.tools.SStepable

Simulates the Faraday effect using a sliding wire.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.davidson.tools.SApplet
destroyed
 
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
 
Method Summary
 int addObject(java.lang.String name, java.lang.String parList)
          Creates an object and add it to the Physlet.
 void cyclingClock()
           
 void forward()
          Starts the animation.
 int getGraphID()
          Gets the ID for the graph.
 void reset()
          Stops the applet, clears the graph, and puts the applet into a predfined state.
 void reverse()
          Resumes the simulation with a negative time step.
 boolean setAnimationSlave(int masterID, int slaveID)
          Force an object to follow another object on the screen.
 void setAutoRefresh(boolean auto)
          Sets the autoRefresh property.
 void setBScale(double min, double max)
          Sets the range corresponding to blue and red for the B field color.
 boolean setConstraint(int id, int constraintID)
          Sets a motion constraint on an object.
 void setDefault()
          Stops the applet, clears the graph, and puts the applet into a predfined state.
 boolean setDisplayOffset(int id, int xOff, int yOff)
          Offset the object's position on the screen from its default drawing position.
 boolean setDragable(int id, boolean canDrag)
          Make the object with the given id dragable.
 void setDragMode(boolean dm)
          Sets the drag mode on the wire.
 void setFieldFunction(java.lang.String str)
          Sets the magnetic field, B(x,t), into or out of the wire loop.
 boolean setFont(int id, java.lang.String family, int style, int size)
          Sets the object's font.
 boolean setFormat(int id, java.lang.String fstr)
          Change the object's format for the display of numeric data.
 void setMaxTime(double tm)
          Sets the maximum time for the graph and for cycle mode.
 void setMeterMinMax(double min, double max)
          Sets the range on the meter and the graph.
 boolean setObjectFont(int id, java.lang.String family, int style, int size)
          Sets the object's font if the object has text that can be displayed.
 void setPixPerUnit(int ppu)
          Sets the scale.
 boolean setPosFunction(java.lang.String str)
          Sets the slider postion as a function of time.
 boolean setRGB(int id, int r, int g, int b)
          Sets the color of an object.
 void setShowBOnDrag(boolean show)
          Show the Magnetic field on mouse drag.
 void setShowColor(boolean show)
          Show a color corresponding to the local magnetic field on the schematic.
 boolean setShowCoordinates(int id, boolean show)
          Have the object show its coordinates on screen.
 void setShowCurrentArrow(int id, boolean show)
          Show the current arrow on the schematic.
 void setShowGraph(boolean sg)
          Display the graph, V(t).
 void setShowGrid(boolean show)
          Show a dot or an x corresponding to the local magnetic field on the schematic.
 void setShowMeter(int id, boolean show)
          Show the meter on the UWire schematic.
 void setTimeContinuous()
          Let the animation time increase indefinitely.
 void setTimeCycle(double max)
          Sets a time loop for the animation from 0 to max.
 void setTimeInterval(double min, double max)
          Sets a time loop for the animation.
 void setTimeOneShot(double max, java.lang.String msg)
          Run the simulation one time.
 boolean setTrajectory(int id, java.lang.String xStr)
          Sets the trajectory of an object on the screen.
 boolean setVisibility(int id, boolean show)
          Show the visibility of the object.
 void step(double dt, double time)
           
 void stepBack()
           
 void stepForward()
          Steps forward one time step.
 void stepTimeBack()
          Steps the simulation one negative time step.
 void stepTimeForward()
          Steps one positive time step.
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, checkAppletNames, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, formatValue, getAppletName, getClockID, getClockTime, getDataFromDS, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getSourceData, getSourceVariables, isClockRunning, isValidFunction, makeDataConnection, pause, removeDataListener, removeDataSource, sendDataToListener, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setConnectionWindowX, setConnectionWindowY, setDebugLevel, setDt, setExternalClock, setFPS, setIndependentClock, startClock, stepClock, stepTime, stop, stopClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, 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, 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, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

forward

public void forward()
Starts the animation. Animation is in real time using the computer's internal clock.

Overrides:
forward in class SApplet

reverse

public void reverse()
Resumes the simulation with a negative time step.

Overrides:
reverse in class SApplet

stepTimeForward

public void stepTimeForward()
Steps one positive time step.

Overrides:
stepTimeForward in class SApplet

stepForward

public void stepForward()
Steps forward one time step.


stepTimeBack

public void stepTimeBack()
Steps the simulation one negative time step.

Overrides:
stepTimeBack in class SApplet

stepBack

public void stepBack()

step

public void step(double dt,
                 double time)
Specified by:
step in interface edu.davidson.tools.SStepable

cyclingClock

public void cyclingClock()

getGraphID

public int getGraphID()
Gets the ID for the graph. The graph is a data listener.


setDefault

public void setDefault()
Stops the applet, clears the graph, and puts the applet into a predfined state.

Overrides:
setDefault in class SApplet

reset

public void reset()
Stops the applet, clears the graph, and puts the applet into a predfined state.

Overrides:
reset in class SApplet

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Creates an object and add it to the Physlet. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. For example, a circle can be added a follows:

addObject ("circle", "x = 0, y = -1.0, r = 10");

See the supplemental documentation for a list of object names and parameters.

Parameters:
name - the type of object to be created.
parList - a list of parameters to be set
Returns:
id that identifies the object.

setConstraint

public boolean setConstraint(int id,
                             int constraintID)
Sets a motion constraint on an object.

Parameters:
id - the ID of the object.
constraintID - the ID of the constraint.
Returns:
true if successful.

setAutoRefresh

public void setAutoRefresh(boolean auto)
Sets the autoRefresh property. AutoRefresh will repaint the graph whenever data changes but slows down the system and may cause flicker.

Overrides:
setAutoRefresh in class SApplet
Parameters:
auto - AutoRefresh the graph?

setShowColor

public void setShowColor(boolean show)
Show a color corresponding to the local magnetic field on the schematic.

Parameters:
show - Show the color.

setShowGrid

public void setShowGrid(boolean show)
Show a dot or an x corresponding to the local magnetic field on the schematic.

Parameters:
show - Show the grid.

setShowBOnDrag

public void setShowBOnDrag(boolean show)
Show the Magnetic field on mouse drag.

Parameters:
show - Show B.

setShowCurrentArrow

public void setShowCurrentArrow(int id,
                                boolean show)
Show the current arrow on the schematic.

Parameters:
id - the object identifier
show - true to show the current arrow.

setShowCoordinates

public boolean setShowCoordinates(int id,
                                  boolean show)
Have the object show its coordinates on screen.

Parameters:
id - The id of the object.
show - Show the coordinates?
Returns:
True if successful.

setShowMeter

public void setShowMeter(int id,
                         boolean show)
Show the meter on the UWire schematic.

Parameters:
id - the object identifier of the UWire
show - true to show the meter.

setDragMode

public void setDragMode(boolean dm)
Sets the drag mode on the wire. Will disable the postion function

Parameters:
dm - Boolean drag mode.

setMeterMinMax

public void setMeterMinMax(double min,
                           double max)
Sets the range on the meter and the graph.

Parameters:
min - The minimum value.
max - The maximum value.

setPixPerUnit

public void setPixPerUnit(int ppu)
Sets the scale. All functions and readings will use this scale factor.

Parameters:
ppu - pPxels per unit.

setShowGraph

public void setShowGraph(boolean sg)
Display the graph, V(t).

Parameters:
sg - True will display V(t).

setPosFunction

public boolean setPosFunction(java.lang.String str)
Sets the slider postion as a function of time.

Parameters:
str - The position of the slider, x(t).
Returns:
boolean true if the functions is valid, false otherwise
See Also:
Faraday.setDragMode(boolean)

setTrajectory

public boolean setTrajectory(int id,
                             java.lang.String xStr)
Sets the trajectory of an object on the screen.

Parameters:
id - the id of the thing
xStr - the function x(t)
Returns:
boolean True if the function is valid and the trajectory has been set.

setFieldFunction

public void setFieldFunction(java.lang.String str)
Sets the magnetic field, B(x,t), into or out of the wire loop. Can be a function of x but not y.

Parameters:
str - The magnetic field, B(x,t).

setBScale

public void setBScale(double min,
                      double max)
Sets the range corresponding to blue and red for the B field color.

Parameters:
min - the bfield minimum.
max - the bfield maximum.

setMaxTime

public void setMaxTime(double tm)
Sets the maximum time for the graph and for cycle mode.

Parameters:
tm - maximum time
See Also:
Faraday.setTimeContinuous(), Faraday.setTimeCycle(double)

setTimeCycle

public void setTimeCycle(double max)
Sets a time loop for the animation from 0 to max. Animation will run continuously.

Overrides:
setTimeCycle in class SApplet
Parameters:
max - The ending time for the loop.
See Also:
Faraday.setTimeContinuous(), Faraday.setTimeInterval(double, double)

setTimeInterval

public void setTimeInterval(double min,
                            double max)
Sets a time loop for the animation. Animation will run continuously.

Parameters:
min - The starting time value for the loop
max - The ending time for the loop.
See Also:
Faraday.setTimeContinuous()

setTimeContinuous

public void setTimeContinuous()
Let the animation time increase indefinitely. May overflow for very long times.

Overrides:
setTimeContinuous in class SApplet
See Also:
Faraday.setTimeOneShot(double, java.lang.String), Faraday.setTimeInterval(double, double)

setTimeOneShot

public void setTimeOneShot(double max,
                           java.lang.String msg)
Run the simulation one time.

Overrides:
setTimeOneShot in class SApplet
Parameters:
max - Reset the simulation to t=0 when t>=max and stop the simulation.
msg -

setFont

public boolean setFont(int id,
                       java.lang.String family,
                       int style,
                       int size)
Sets the object's font. Invoke setObjectFont for Java 1.4 compatibility.


setObjectFont

public boolean setObjectFont(int id,
                             java.lang.String family,
                             int style,
                             int size)
Sets the object's font if the object has text that can be displayed.

Parameters:
id - The id of the object.
family - The font family: Helvetica, Times.
style - The style, 0=plain, 1=bold.
size - The size of the font;
Returns:
true if successful.

setFormat

public boolean setFormat(int id,
                         java.lang.String fstr)
Change the object's format for the display of numeric data. Us this method to control the number of significant digits in calculations with text objects. Use Unix printf conventions. For example fstr="%6.3f"

Parameters:
id - The id of the object.
fstr - the format string.
Returns:
True if successful.

setDisplayOffset

public boolean setDisplayOffset(int id,
                                int xOff,
                                int yOff)
Offset the object's position on the screen from its default drawing position.

Parameters:
id - The id of the object.
Returns:
True if successful.

setDragable

public boolean setDragable(int id,
                           boolean canDrag)
Make the object with the given id dragable.

Parameters:
id - of the object.
canDrag - Is the object dragable?
Returns:
true if successful false otherwise

setVisibility

public boolean setVisibility(int id,
                             boolean show)
Show the visibility of the object.

Parameters:
show - true will show object on screen
Returns:
true if successful false otherwise

setAnimationSlave

public boolean setAnimationSlave(int masterID,
                                 int slaveID)
Force an object to follow another object on the screen.

Parameters:
masterID - The id of the master object.
slaveID - The id of the slave object.
Returns:
true if successful.

setRGB

public boolean setRGB(int id,
                      int r,
                      int g,
                      int b)
Sets the color of an object.

Parameters:
id - The id of the object.
r - red
g - green
b - blue
Returns:
True if successful.


Visit the Davidson College Physlet Site for additional information.