faraday
Class Faraday

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--faraday.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

Simulate the Faraday effect using a sliding wire.

See Also:
Serialized Form

Fields inherited from class edu.davidson.tools.SApplet
clock, dataConnections, dataListeners, dataSources, lock
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Faraday()
           
 
Method Summary
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 void cyclingClock()
           
 void destroy()
          Destroy all threads and cleanup the applet.
 void forward()
          start the animation.
 java.lang.String getAppletInfo()
           
 int getGraphID()
          Get the ID for the graph.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 void init()
           
 void reset()
          Stop the applet, clear the graph, and put the applet into a predfined state.
 void reverse()
          Resume 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)
          Set the autoRefresh property.
 void setBScale(double min, double max)
          Set the range corresponding to blue and red for the B field color.
 boolean setConstraint(int id, int constraintID)
          Set a motion constraint on an object.
 void setDefault()
          Stop the applet, clear the graph, and put 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)
          Set the drag mode on the wire.
 void setFieldFunction(java.lang.String str)
          Set 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)
          change the object's font for any text4 that is displayed.
 boolean setFormat(int id, java.lang.String fstr)
          Change the object's format for the display of numeric data.
 void setMaxTime(double tm)
          Set the maximum time for the graph and for cycle mode.
 void setMeterMinMax(double min, double max)
          Set the range on the meter and the graph.
 void setPixPerUnit(int ppu)
          Set the scale.
 boolean setPosFunction(java.lang.String str)
          Set the slider postion as a function of time.
 boolean setRGB(int id, int r, int g, int b)
          Set 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)
          Set a time loop for the animation from 0 to max.
 void setTimeInterval(double min, double max)
          Set a time loop for the animation.
 void setTimeOneShot(double max, java.lang.String msg)
          Run the simulaiton one time.
 boolean setTrajectory(int id, java.lang.String xStr)
          Set the trajectory of an object on the screen.
 boolean setVisibility(int id, boolean show)
          Show the visibility of the object.
 void start()
           
 void step(double dt, double time)
           
 void stepBack()
           
 void stepForward()
           
 void stepTimeBack()
          Step the simulation one negative time step.
 void stepTimeForward()
          Step the simulation one positive time step.
 void stop()
          Stop the animation.
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, getClockID, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, removeDataListener, removeDataSource, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setFPS, setRunningID, setRunningID, startClock, stepClock, stepTime, stopClock, updateDataConnection, updateDataConnections, useMasterClock
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Faraday

public Faraday()
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

init

public void init()
Overrides:
init in class java.applet.Applet

forward

public void forward()
start the animation. Animation is in real time using the computer's internal clock.
Overrides:
forward in class SApplet

reverse

public void reverse()
Resume the simulation with a negative time step.
Overrides:
reverse in class SApplet

stepTimeForward

public void stepTimeForward()
Step the simulation one positive time step.
Overrides:
stepTimeForward in class SApplet

stepForward

public void stepForward()

stepTimeBack

public void stepTimeBack()
Step the simulation one negative time step.
Overrides:
stepTimeBack in class SApplet

stepBack

public void stepBack()

destroy

public void destroy()
Destroy all threads and cleanup the applet.
Overrides:
destroy in class SApplet

start

public void start()
Overrides:
start in class java.applet.Applet

stop

public void stop()
Stop the animation.
Overrides:
stop in class java.applet.Applet

step

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

cyclingClock

public void cyclingClock()

getAppletInfo

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

getGraphID

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

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

setDefault

public void setDefault()
Stop the applet, clear the graph, and put the applet into a predfined state.
Overrides:
setDefault in class SApplet

reset

public void reset()
Stop the applet, clear the graph, and put the applet into a predfined state.
Overrides:
reset in class SApplet

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Create 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");

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)
Set 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)
Set 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)
Set the drag mode on the wire. Will disable the postion function
Parameters:
dm - Boolean drag mode.

setMeterMinMax

public void setMeterMinMax(double min,
                           double max)
Set the range on the meter and the graph.
Parameters:
min - The minimum value.
max - The maximum value.

setPixPerUnit

public void setPixPerUnit(int ppu)
Set 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)
Set 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:
setDragMode(boolean)

setTrajectory

public boolean setTrajectory(int id,
                             java.lang.String xStr)
Set 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)
Set 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)
Set 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)
Set the maximum time for the graph and for cycle mode.
Parameters:
tm - maximum time
See Also:
setTimeContinuous(), setTimeCycle(double)

setTimeCycle

public void setTimeCycle(double max)
Set 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:
setTimeContinuous(), setTimeInterval(double, double)

setTimeInterval

public void setTimeInterval(double min,
                            double max)
Set 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:
setTimeContinuous()

setTimeContinuous

public void setTimeContinuous()
Let the animation time increase indefinitely. May overflow for very long times.
Overrides:
setTimeContinuous in class SApplet
See Also:
setTimeOneShot(double, java.lang.String), setTimeInterval(double, double)

setTimeOneShot

public void setTimeOneShot(double max,
                           java.lang.String msg)
Run the simulaiton one time.
Overrides:
setTimeOneShot in class SApplet
Parameters:
max - Reset the simulation to t=0 when t>=max and stop the simulation.
string - the message to be displayed on the screen when the max time is reached.

setFont

public boolean setFont(int id,
                       java.lang.String family,
                       int style,
                       int size)
change the object's font for any text4 that is 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.
xoff - The x offset.
yoff - The y offset.
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)
Set the color of an object.
Parameters:
id - The id of the object.
r - red
g - green
b - blue
Returns:
True if successful.

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page